fix(shard): 🐛 Channel webhooks suddenly stopping working.
This commit is contained in:
+27
-20
@@ -247,7 +247,7 @@ class Calls(base.Cog):
|
||||
),
|
||||
)
|
||||
|
||||
message_content = self.bot.clean_message(message, call)
|
||||
message_content = self.bot.clean_message(message)
|
||||
|
||||
if message.stickers:
|
||||
if participant.user.flag & (
|
||||
@@ -289,7 +289,7 @@ class Calls(base.Cog):
|
||||
other_channel
|
||||
).fetch_message(original_message_id)
|
||||
|
||||
replied_message_content = self.bot.clean_message(replied_message, call)
|
||||
replied_message_content = self.bot.clean_message(replied_message)
|
||||
replied_participant = await call.get_participant(
|
||||
replied_message.author.id
|
||||
)
|
||||
@@ -364,26 +364,33 @@ class Calls(base.Cog):
|
||||
)
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
webhook = discord.Webhook.from_url(
|
||||
await self.bot.call_handler.get_channel_webhook_url(other_channel),
|
||||
session=session,
|
||||
bot_token=constants.TOKEN,
|
||||
)
|
||||
for _ in range(3):
|
||||
try:
|
||||
webhook = discord.Webhook.from_url(
|
||||
await self.bot.call_handler.get_channel_webhook_url(other_channel),
|
||||
session=session,
|
||||
bot_token=constants.TOKEN,
|
||||
)
|
||||
|
||||
propagated_msg = await webhook.send(
|
||||
content=message_content,
|
||||
username=participant.display_name,
|
||||
avatar_url=participant.display_avatar_url,
|
||||
embeds=embeds,
|
||||
wait=True,
|
||||
)
|
||||
propagated_msg = await webhook.send(
|
||||
content=message_content,
|
||||
username=participant.display_name,
|
||||
avatar_url=participant.display_avatar_url,
|
||||
embeds=embeds,
|
||||
wait=True,
|
||||
)
|
||||
|
||||
await call.set_message(
|
||||
message.id,
|
||||
message.channel.id,
|
||||
propagated_msg.id,
|
||||
message.author.id,
|
||||
)
|
||||
await call.set_message(
|
||||
message.id,
|
||||
message.channel.id,
|
||||
propagated_msg.id,
|
||||
message.author.id,
|
||||
)
|
||||
|
||||
break
|
||||
|
||||
except discord.errors.DiscordException:
|
||||
await self.bot.call_handler.refresh_channel_webhook_url(other_channel)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_raw_message_delete(
|
||||
|
||||
Reference in New Issue
Block a user