Commit 53dbb25
fix(discord): send_message for streaming replies with bot mentions (#1112)
* fix(discord): use send_message for streaming replies with bot mentions
When a streaming response contains <@uid> mentions, Discord's
MESSAGE_UPDATE (edit) does not trigger mention notifications for the
mentioned bot. Switch to delete placeholder + send_message (MESSAGE_CREATE)
so the mentioned bot receives the gateway event and can respond.
Fixes #1110
* fix: address review feedback — support <@!UID> and add platform guard
- Support nickname-style mentions (<@!UID>) in contains_bot_mention()
- Add platform == "discord" check so the delete+send path only applies
to Discord, not Slack or other adapters
- Fix misleading comment about '!' being for role mentions
* fix: also detect role mentions (<@&ROLE_ID>) for send_message path
Role mentions (e.g. <@&1496247626675257384>) should also trigger
MESSAGE_CREATE so all bots with that role receive the gateway event.
* test: add unit tests for contains_bot_mention
Covers user mentions (<@uid>), nickname mentions (<@!UID>),
role mentions (<@&ROLE_ID>), and negative cases.
---------
Co-authored-by: 超渡法師 <chaodu@openab.dev>1 parent 94686cc commit 53dbb25
1 file changed
Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
915 | 915 | | |
916 | 916 | | |
917 | 917 | | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
918 | 937 | | |
919 | 938 | | |
920 | 939 | | |
| |||
953 | 972 | | |
954 | 973 | | |
955 | 974 | | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
956 | 1007 | | |
957 | 1008 | | |
958 | 1009 | | |
| |||
1259 | 1310 | | |
1260 | 1311 | | |
1261 | 1312 | | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
1262 | 1341 | | |
1263 | 1342 | | |
1264 | 1343 | | |
| |||
0 commit comments