From cd3b53018a80e34ece54aba15ebd8fb98524d931 Mon Sep 17 00:00:00 2001 From: Vargoshi Date: Sun, 15 Oct 2023 19:41:41 +0000 Subject: [PATCH] fix: ignore other bots (#22) fixes #5 Reviewed-on: https://git.foxo.me/pinks/eris/pulls/22 Co-authored-by: Vargoshi Co-committed-by: Vargoshi --- bot/img2imgCommand.ts | 6 +++++- bot/txt2imgCommand.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bot/img2imgCommand.ts b/bot/img2imgCommand.ts index 45ba4c6..ed8b635 100644 --- a/bot/img2imgCommand.ts +++ b/bot/img2imgCommand.ts @@ -28,7 +28,11 @@ async function img2img( includeRepliedTo: boolean, state: QuestionState = {}, ): Promise { - if (!ctx.message?.from?.id) { + if (!ctx.from) { + return; + } + + if (ctx.from.is_bot) { return; } diff --git a/bot/txt2imgCommand.ts b/bot/txt2imgCommand.ts index 6b2ae1a..851ed74 100644 --- a/bot/txt2imgCommand.ts +++ b/bot/txt2imgCommand.ts @@ -20,7 +20,11 @@ export async function txt2imgCommand(ctx: CommandContext) { } async function txt2img(ctx: ErisContext, match: string, includeRepliedTo: boolean): Promise { - if (!ctx.message?.from?.id) { + if (!ctx.from) { + return; + } + + if (ctx.from.is_bot) { return; }