From 00d4949be0fe61aed7193d7d93b75506dee34405 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Sat, 6 Jul 2024 20:48:36 +0100 Subject: [PATCH] =?UTF-8?q?Ignore=20messages=20generated=20by=20webhooks?= =?UTF-8?q?=20that=20aren=E2=80=99t=20of=20=E2=80=98incoming=E2=80=99=20ty?= =?UTF-8?q?pe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- botto/tld_botto.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/botto/tld_botto.py b/botto/tld_botto.py index e7383f7..c912970 100644 --- a/botto/tld_botto.py +++ b/botto/tld_botto.py @@ -438,6 +438,13 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent): ) async def on_message(self, message: Message): + if webhook_id := message.webhook_id: + try: + webhook = await self.fetch_webhook(webhook_id) + if webhook.type != discord.WebhookType.incoming: + return + except discord.NotFound: + pass if message.author.id == self.user.id: log.debug(f"Ignoring message {message.id} from self") return