i made a tts bot that joins the voice chat. i create an object with some logic when using a slash command, and then i delete it and create a new one when using an unfollow command, or when disconnecting the bot manually.
im using on_voice_state_update for the disconnect part, like this:
@client.event
async def on_voice_state_update(member: discord.Member, before: discord.VoiceState, after: discord.VoiceState):
if before.channel == after.channel:
return
if member == client.user:
# the bot was disconnected, reset everything
if after.channel is None:
readers[member.guild] = GuildReader(member.guild)
# more stuff...
the thing is, apparently, discord reconnects all users every two hours or so, for some reason, and then that gets called, the object gets recreated, and the tts no longer works.
so, is there a way to detect when the bot was disconnected manually, specifically because of an admin disconnect? like with the right click menu, so i dont recreate the object in any other case