killrebeest
killrebeest

Reputation: 348

Am I using the on_guild_leave function correctly?

So I looked at many sources saying that on_guild_leave is how it is used, but I can't get it to work. Here is my code:

@client.event
async def on_guild_join(guild): # noqa
    try:
        await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(client.guilds)} Servers | !help"))
    except Exception as e:
        print(e)


@client.event
async def on_guild_leave(guild): # noqa
    try:
        await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(client.guilds)} Servers | !help"))
    except Exception as e:
        print(e)

Can anyone seem to help?

on_guild_join works, but on_guild_leave doesn't.

Upvotes: 0

Views: 484

Answers (1)

tk421
tk421

Reputation: 281

on_guild_leave doesn't exist, use on_guild_remove instead. Docs for on_guild_remove

Upvotes: 2

Related Questions