fix(bot): 🚑 Hangup not working.

This commit is contained in:
Nyeki.py
2024-10-18 14:08:04 -03:00
parent 6f56ee7320
commit 71afe924e0
+4 -2
View File
@@ -466,6 +466,7 @@ 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)
) )
if other_channel is not None:
try: try:
await (await self.bot.get_or_fetch_channel(other_channel.id)).send( await (await self.bot.get_or_fetch_channel(other_channel.id)).send(
f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_YOU)}" f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_YOU)}"
@@ -474,12 +475,13 @@ class Calls(base.Cog):
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()