Drop getUserId() call in Matrix bot startup — its whoami request 404s against Continuwuity
build-agent / build-and-push (push) Successful in 10s
build-agent / build-and-push (push) Successful in 10s
Not actually needed: self-message filtering was only used to avoid the bot reacting to its own replies, but those never match the !claude command pattern anyway, so parseCommand() already filters them out for free.
This commit is contained in:
@@ -24,13 +24,13 @@ export async function startMatrixBot() {
|
|||||||
const client = new MatrixClient(HOMESERVER_URL, ACCESS_TOKEN, storage);
|
const client = new MatrixClient(HOMESERVER_URL, ACCESS_TOKEN, storage);
|
||||||
AutojoinRoomsMixin.setupOnClient(client);
|
AutojoinRoomsMixin.setupOnClient(client);
|
||||||
|
|
||||||
const selfUserId = await client.getUserId();
|
|
||||||
|
|
||||||
client.on("room.message", async (roomId, event) => {
|
client.on("room.message", async (roomId, event) => {
|
||||||
// Invite-only control room enforces who can reach the bot at all; this just
|
// Invite-only control room enforces who can reach the bot at all; this just scopes
|
||||||
// scopes command handling to that one room and ignores the bot's own messages.
|
// command handling to that one room. No need to fetch/compare the bot's own user ID
|
||||||
|
// to filter out its own messages — its replies ("Working on it...", "Opened PR:...",
|
||||||
|
// "Failed:...") never match the !claude command pattern below, so they're ignored
|
||||||
|
// by parseCommand() returning null, same as any other non-command message.
|
||||||
if (roomId !== CONTROL_ROOM_ID) return;
|
if (roomId !== CONTROL_ROOM_ID) return;
|
||||||
if (event.sender === selfUserId) return;
|
|
||||||
const body = event.content?.body;
|
const body = event.content?.body;
|
||||||
if (!body) return;
|
if (!body) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user