Skip to content

Commit

Permalink
Attempt to send it to a channel.
Browse files Browse the repository at this point in the history
I'm not really sure if this is wanted or needed but I like it. If anyone complains it can always be removed.
  • Loading branch information
BabyBoySnow committed Oct 13, 2023
1 parent 0823941 commit 764bc3b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions musicbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4435,9 +4435,19 @@ async def on_timer_expired(self, voice_channel):
guild = self.get_guild(guild_id)
vc = guild.get_channel(voice_channel.id)
if vc:
log.info(
f"Leaving voice channel {voice_channel.name} in {voice_channel.guild} due to inactivity."
) # At some point I want to send this to a channel instead of just logging it
try:
last_np_msg = last_np_msg = self.server_specific_data[guild][
"last_np_msg"
]
channel = last_np_msg.channel
await self.safe_send_message(
channel,
f"Leaving voice channel {voice_channel.name} in {voice_channel.guild} due to inactivity.",
)
except:
log.info(
f"Leaving voice channel {voice_channel.name} in {voice_channel.guild} due to inactivity."
)
await self.disconnect_voice_client(guild)
del timers[voice_channel.id]

Expand Down Expand Up @@ -4480,7 +4490,7 @@ async def on_voice_state_update(self, member, before, after):
timers[after.channel.id].cancel()
log.info(
f"Cancelling timer for {after.channel.name} in {after.channel.guild} as channel is no longer inactive."
) # same here
)
del timers[after.channel.id]

for channel_id in list(timers.keys()):
Expand Down

0 comments on commit 764bc3b

Please sign in to comment.