Skip to content

Commit

Permalink
feat: skip bot events
Browse files Browse the repository at this point in the history
  • Loading branch information
whilefoo committed Mar 6, 2024
1 parent 597d9ce commit 37cb25c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/github/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ async function handleEvent(event: EmitterWebhookEvent, eventHandler: InstanceTyp
}

for (const pluginChain of pluginChains) {
if (pluginChain.skipBotEvents && "sender" in event.payload && event.payload.sender?.type === "Bot") {
continue;
}
// invoke the first plugin in the chain
const { plugin, with: settings } = pluginChain.uses[0];
console.log(`Calling handler for event ${event.name}`);
Expand Down
1 change: 1 addition & 0 deletions src/github/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const handlerSchema = T.Array(
command: T.Optional(T.String()),
example: T.Optional(T.String()),
uses: pluginChainSchema,
skipBotEvents: T.Boolean({ default: true }),
}),
{ default: [] }
);
Expand Down

0 comments on commit 37cb25c

Please sign in to comment.