fix(shard): 🐛 Fix not found in on_message() when replying to a bot within the same channel.

This commit is contained in:
2025-03-16 11:09:29 -03:00
parent c4df5a31e7
commit ec3142f606
+16 -2
View File
@@ -285,10 +285,15 @@ class Calls(base.Cog):
original_message_id is not None original_message_id is not None
and original_message_id != replied_message.id and original_message_id != replied_message.id
): ):
try:
replied_message = await self.bot.get_partial_messageable( replied_message = await self.bot.get_partial_messageable(
other_channel other_channel
).fetch_message(original_message_id) ).fetch_message(original_message_id)
except discord.errors.NotFound:
replied_message = None
if replied_message is not None:
replied_message_content = self.bot.clean_message(replied_message) replied_message_content = self.bot.clean_message(replied_message)
replied_participant = await call.get_participant( replied_participant = await call.get_participant(
replied_message.author.id replied_message.author.id
@@ -326,6 +331,11 @@ class Calls(base.Cog):
"\n-# ⓘ In reply to a message from outside this call." "\n-# ⓘ In reply to a message from outside this call."
) )
else:
message_content += (
"\n-# ⓘ In reply to a message from outside this call."
)
if was_mask_toggled: if was_mask_toggled:
if not participant.is_masked: if not participant.is_masked:
if participant.user.flag & models.UserFlag.SUPPORTER: if participant.user.flag & models.UserFlag.SUPPORTER:
@@ -367,7 +377,9 @@ class Calls(base.Cog):
for _ in range(3): for _ in range(3):
try: try:
webhook = discord.Webhook.from_url( webhook = discord.Webhook.from_url(
await self.bot.call_handler.get_channel_webhook_url(other_channel), await self.bot.call_handler.get_channel_webhook_url(
other_channel
),
session=session, session=session,
bot_token=constants.TOKEN, bot_token=constants.TOKEN,
) )
@@ -390,7 +402,9 @@ class Calls(base.Cog):
break break
except discord.errors.DiscordException: except discord.errors.DiscordException:
await self.bot.call_handler.refresh_channel_webhook_url(other_channel) await self.bot.call_handler.refresh_channel_webhook_url(
other_channel
)
@commands.Cog.listener() @commands.Cog.listener()
async def on_raw_message_delete( async def on_raw_message_delete(