Skip to content

feat: ++ の連打 (++++) でもポイントを付与できるようにする#146

Open
t-daisuke wants to merge 1 commit into
mainfrom
support-repeated-plusplus
Open

feat: ++ の連打 (++++) でもポイントを付与できるようにする#146
t-daisuke wants to merge 1 commit into
mainfrom
support-repeated-plusplus

Conversation

@t-daisuke

@t-daisuke t-daisuke commented Jun 29, 2026

Copy link
Copy Markdown

なぜ

Slack で「テンションが上がって ++++ 連打した時でもプラスされて欲しい」という要望がありました。
https://pepabo.slack.com/archives/C0BBA6Z49DK/p1782716382278819

現状、演算子の正規表現が \+\+(ちょうど2文字)にしかマッチせず、直後に行末を要求するため、
++++ のように3文字以上連打するとマッチ全体が失敗して無反応になっていました
+ が3個以上だと反応しない)。parseOperatorcase "++" の完全一致でした。

なにを

  • bot/bot.go+ のみ 2文字以上許容に変更(\+\+\+{2,}、user メンション・絵文字の両パターン)
    • -- / ==従来どおり2文字ちょうど----==== は無反応のまま)
  • parseOperator を先頭文字での判定に変更(+++, ++++ を拾えるように)
  • 加点量は連打数によらず +1++++++++ でも +1。pointsChange = 1 固定のまま)

テスト

  • 連打ケースを追加: ++++ / +++++++++ / 絵文字 +++ は PointUp、---- / ==== は NoOperation
  • go test ./bot/-race 含む)全パス。単独 + は無反応・演算子は行末必須、といった既存仕様は維持

動作(修正後)

入力 修正前 修正後
@user ++ +1 +1
@user ++++ / ++++++++ 無反応 +1
:sake: +++ 無反応 +1
@user +(単独) 無反応 無反応(据え置き)
@user ---- / ==== 無反応 無反応(据え置き)

🤖 Generated with Claude Code

@t-daisuke t-daisuke force-pushed the support-repeated-plusplus branch from 448380c to 89916a3 Compare June 29, 2026 10:00
`++` ちょうど2文字にしかマッチしない正規表現のため、テンションが上がって
`++++` のように3文字以上連打すると無反応になっていた。
演算子を `\+{2,}` `-{2,}` `={2,}` (2文字以上) に緩め、parseOperator も
先頭文字で判定するよう変更し、連打でも +1 されるようにする。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@t-daisuke t-daisuke force-pushed the support-repeated-plusplus branch from 89916a3 to 1b6548f Compare June 29, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant