'Is there an event that is fired when a discord channel is renamed?

Can't find this anywhere, any help would be appreciated.

I have a really hacky method that works, but isn't efficient at all.



Solution 1:[1]

The event fired is on_guild_channel_update. Note that this event also fires for updates like topic changes or permissions changes, not just renaming.

Example use:

@bot.event
async def on_guild_channel_update(before, after):
    if before.name != after.name:
        # This update renamed the channel.
        print(f"On guild {before.guild.name} channel {before.name} was updated to {after.name}")

Output:

On guild Achxy's server channel foo was updated to bar

Read more:
class discord.abc.GuildChannel

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user2357112