fix(bot): 🚑 Hangup not working.

This commit is contained in:
Nyeki.py
2024-10-18 14:08:04 -03:00
parent 6f56ee7320
commit 71afe924e0
+10 -8
View File
@@ -466,20 +466,22 @@ class Calls(base.Cog):
constants.CHANNELS_ONCALL_SET, str(channel_id), str(other_channel.id) constants.CHANNELS_ONCALL_SET, str(channel_id), str(other_channel.id)
) )
try: if other_channel is not None:
await (await self.bot.get_or_fetch_channel(other_channel.id)).send( try:
f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_YOU)}" await (await self.bot.get_or_fetch_channel(other_channel.id)).send(
) f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_YOU)}"
)
except errors.DiscordException: except errors.DiscordException:
pass pass
other_channel.call = None
await ctx.send(f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_ME)}") await ctx.send(f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_ME)}")
channel.call = None channel.call = None
other_channel.call = None
await models.Channel.bulk_update([channel, other_channel], ["call_id"]) await models.Channel.bulk_update([channel] + ([other_channel] if other_channel is not None else []), ["call_id"])
call.ended_at = datetime.now(timezone.utc) call.ended_at = datetime.now(timezone.utc)
await call.save() await call.save()