Skip to content

fix: ターゲットとオペレーター検出を統合し誤検出を防止#114

Merged
buty4649 merged 1 commit intomainfrom
fix/unify-detection-and-extraction
Apr 10, 2026
Merged

fix: ターゲットとオペレーター検出を統合し誤検出を防止#114
buty4649 merged 1 commit intomainfrom
fix/unify-detection-and-extraction

Conversation

@haruotsu
Copy link
Copy Markdown
Contributor

@haruotsu haruotsu commented Apr 10, 2026

Summary

  • detectPointOperationextractTargetFromText が独立していたため、:emoji:テキスト ++ のようにターゲットとオペレーターの間に文字が入った場合に誤検出する可能性があった
  • detectOperationAndTarget 関数に統合し、1つの正規表現でターゲット抽出とオペレーション検出を同時に実行するよう修正
  • 不要になった extractUserID, extractEmojiName, extractTargetFromText を削除

Test plan

  • :haruotsu-no1:hogehogehogege ++ で反応しないことを確認
  • :haruotsu-no1:hogehogehogege -- で反応しないことを確認
  • :sake:hogehoge++ で反応しないことを確認
  • :sake: ++ / :sake:++ で正常に反応することを確認
  • <@U123456> ++ で正常に反応することを確認
  • 複数絵文字パターン(hello :foo:bar :baz: ++)で正しいターゲット(:baz:)が選ばれることを確認
  • 全テストパス (go test ./...)

detectPointOperationとextractTargetFromTextが独立して動作していたため、
複数の絵文字パターンが含まれるテキストでターゲットとオペレーターの対応が
ずれる問題があった。detectOperationAndTarget関数に統合し、1つの正規表現で
ターゲット抽出とオペレーション検出を同時に行うよう修正。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@haruotsu haruotsu requested a review from buty4649 April 10, 2026 05:34
Copy link
Copy Markdown
Contributor

@buty4649 buty4649 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx!!

@buty4649 buty4649 merged commit 43d3081 into main Apr 10, 2026
2 checks passed
@buty4649 buty4649 deleted the fix/unify-detection-and-extraction branch April 10, 2026 05:40
@pepabo-pr-maker pepabo-pr-maker Bot mentioned this pull request Apr 10, 2026
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.

2 participants