Skip to content

Commit

Permalink
feat: add app id and bot user id
Browse files Browse the repository at this point in the history
  • Loading branch information
whilefoo committed Sep 10, 2024
1 parent 654e383 commit d292f5a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/github/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function bindHandlers(eventHandler: GitHubEventHandler) {
eventHandler.onAny(tryCatchWrapper((event) => handleEvent(event, eventHandler))); // onAny should also receive GithubContext but the types in octokit/webhooks are weird
}

async function shouldSkipPlugin(event: EmitterWebhookEvent, context: GitHubContext, pluginChain: PluginConfiguration["plugins"][0]) {
if (pluginChain.skipBotEvents && "sender" in event.payload && event.payload.sender?.type === "Bot") {
export async function shouldSkipPlugin(context: GitHubContext, pluginChain: PluginConfiguration["plugins"][0]) {
if (pluginChain.skipBotEvents && "sender" in context.payload && context.payload.sender?.type === "Bot") {
console.log("Skipping plugin chain because sender is a bot");
return true;
}
Expand Down Expand Up @@ -68,7 +68,7 @@ async function handleEvent(event: EmitterWebhookEvent, eventHandler: InstanceTyp
}

for (const pluginChain of pluginChains) {
if (await shouldSkipPlugin(event, context, pluginChain)) {
if (await shouldSkipPlugin(context, pluginChain)) {
continue;
}

Expand Down
3 changes: 2 additions & 1 deletion src/sdk/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ dkRj2Je2kag9b3FMxskv1npNSrPVcSc5lGNYlnZnfxIAnCknOC118JjitlrpT6wd
8wIDAQAB
-----END PUBLIC KEY-----
`;
export const KERNEL_APP_ID = 0;
export const KERNEL_APP_ID = 975031;
export const BOT_USER_ID = 178941584;
2 changes: 1 addition & 1 deletion src/sdk/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { createPlugin } from "./server";
export { createActionsPlugin } from "./actions";
export type { Context } from "./context";
export { KERNEL_APP_ID, KERNEL_PUBLIC_KEY } from "./constants";
export * from "./constants";

0 comments on commit d292f5a

Please sign in to comment.