Skip to content

Commit

Permalink
Fix 400 bad request if message replied to was deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
joinemm committed Nov 28, 2023
1 parent ae8670e commit 5f95480
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/media_embedders.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,14 @@ async def send_reply(
message_contents = await self.create_message(
message.channel, media, options=options
)
msg = await message.reply(
**message_contents, mention_author=False, suppress_embeds=True
)
try:
msg = await message.reply(
**message_contents, mention_author=False, suppress_embeds=True
)
except discord.errors.HTTPException:
# the original message was deleted, so we can't reply
msg = await message.channel.send(**message_contents, suppress_embeds=True)

message_contents["view"].message_ref = msg
message_contents["view"].approved_deletors.append(message.author)

Expand Down

0 comments on commit 5f95480

Please sign in to comment.