I've searched a lot on stack overflow, but cant seem to find anything about this. Is there an event that makes something happen when the bot leaves the server?
I have it so that when a command is run, it sets a variable to be on, and when that variable is on it makes a message happen in every channel created like so:
@client.command(pass_context=True)
async def channel(ctx):
global Toggle
Toggle = True
await ctx.send("Channel messages enabled!")
@client.event
async def on_guild_channel_create(channel):
if Toggle == True:
await channel.send("HELLO :D")
else:
pass
Problem is, when !channel is run, it makes this server wide. How would i make it so that when a bot leaves, toggle is reverted to false?