fix: ++/--/== の後に文字列が続く場合は反応しないよう修正#117
Merged
buty4649 merged 1 commit intopepabo:mainfrom Apr 10, 2026
Merged
Conversation
オペレーターの後に別の単語が続く場合(例: `:neko: -- Settings`)は 意図的な操作ではなく文章の一部である可能性が高いため、 ++/--/== の直後がスペースのみ・行末・改行の場合のみ反応するよう正規表現を修正した。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
背景
:stamp1: Check it out :point-down::skin-tone-2:/ -- Settingsのようなメッセージで、意図せず:stamp1:のポイントが減算されるという問題があった。#114 は「絵文字などの間に文字がある場合にも反応してしまう」問題として修正されたが、元のコードでも絵文字とオペレーターの間に文字がある場合は反応しない実装になっていた。
実際の原因は、
:point-down::skin-tone-2:/ --の部分にあった。:skin-tone-2:と--が隣接(または近接)しており、これが正規表現にマッチしていた。:stamp1:にポイントが減算されていた:skin-tone-2:がターゲットになるようになった。しかしスキントーンがポイントの対象になるのも意図した挙動ではない変更内容
根本的な解決策として、
++/--/==の後に別の文字列が続く場合は反応しないよう正規表現を修正した。userOperationPattern/emojiOperationPatternの末尾に[ ]*($|\n)を追加し、オペレーターの直後がスペースのみ・行末・改行の場合のみ反応するようにした。これにより
-- Settingsのように--の後に単語が続くケースでは反応しなくなる。