feat: ++ の連打 (++++) でもポイントを付与できるようにする#146
Open
t-daisuke wants to merge 1 commit into
Open
Conversation
448380c to
89916a3
Compare
`++` ちょうど2文字にしかマッチしない正規表現のため、テンションが上がって
`++++` のように3文字以上連打すると無反応になっていた。
演算子を `\+{2,}` `-{2,}` `={2,}` (2文字以上) に緩め、parseOperator も
先頭文字で判定するよう変更し、連打でも +1 されるようにする。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
89916a3 to
1b6548f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ
Slack で「テンションが上がって
++++連打した時でもプラスされて欲しい」という要望がありました。https://pepabo.slack.com/archives/C0BBA6Z49DK/p1782716382278819
現状、演算子の正規表現が
\+\+(ちょうど2文字)にしかマッチせず、直後に行末を要求するため、++++のように3文字以上連打するとマッチ全体が失敗して無反応になっていました(
+が3個以上だと反応しない)。parseOperatorもcase "++"の完全一致でした。なにを
bot/bot.goの+のみ 2文字以上許容に変更(\+\+→\+{2,}、user メンション・絵文字の両パターン)--/==は 従来どおり2文字ちょうど(----・====は無反応のまま)parseOperatorを先頭文字での判定に変更(+++,++++を拾えるように)++++++++でも +1。pointsChange = 1固定のまま)テスト
++++/+++++++++/ 絵文字+++は PointUp、----/====は NoOperationgo test ./bot/(-race含む)全パス。単独+は無反応・演算子は行末必須、といった既存仕様は維持動作(修正後)
@user ++@user ++++/++++++++:sake: +++@user +(単独)@user ----/====🤖 Generated with Claude Code