feat: isolate comment command handlers and skip bot authors (4.2, 8.1)
- /recheck, /conflict, and @bot now run independently via allSettled - bot-authored comments are skipped before dispatch to prevent loops
This commit is contained in:
1 parent
84276bcd1e
commit
70f964070d
2 files changed
+82
-25
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { containsBotMention } from "../src/chat/processor.js";
|
||||
|
||||
test("bot mention detection accepts configured aliases", () => {
|
||||
assert.equal(containsBotMention("@bot help me", "ghbot"), true);
|
||||
assert.equal(containsBotMention("@ghbot please review", "ghbot"), true);
|
||||
assert.equal(containsBotMention("@ghbot[bot] ping", "ghbot[bot]"), true);
|
||||
});
|
||||
|
||||
test("partial usernames and ordinary text never trigger the bot", () => {
|
||||
assert.equal(containsBotMention("email me at user@botmail.com", "ghbot"), false);
|
||||
assert.equal(containsBotMention("the @botanist knows", "ghbot"), false);
|
||||
assert.equal(containsBotMention("no mention here", "ghbot"), false);
|
||||
assert.equal(containsBotMention("@anotherbot hi", "ghbot"), false);
|
||||
});
|
||||
|
||||
test("mention detection is case-insensitive", () => {
|
||||
assert.equal(containsBotMention("@BOT hello", "ghbot"), true);
|
||||
assert.equal(containsBotMention("@GHBOT[BOT] hello", "ghbot[bot]"), true);
|
||||
});
|
||||
Reference in new issue
Block a user