Skip to content

Commit

Permalink
Ignore messages generated by webhooks that aren’t of ‘incoming’ type
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrss committed Jul 6, 2024
1 parent 16b102c commit 00d4949
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions botto/tld_botto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00d4949

Please sign in to comment.