Reputation: 55
This is a bit of a general question for Discord.py, but how would I check if a role or an emoji has just been created or uploaded in the server? I am using the discord and discord.ext modules and I have the commands.Bot. My code is really long, which is why I will not include it here, and this is a general question anyways, but one of my bot's features is a modlog system. I already have the database and commands set up, but I want an extra feature where my bot can send a message if a new role was just created. Is there any bot.event handler that allows me to do this, like on_role_created or something similar to that?
Upvotes: 0
Views: 300
Reputation: 3994
You may be looking for on_guild_role_create
and on_guild_emojis_update
.
Here's two quick examples of how you can use them:
@bot.event
async def on_guild_role_create(role):
print(f'Server: {role.guild.name}\nRole: {role.name}'
@bot.event
async def on_guild_emojis_update(before, after):
before = ', '.join([emoji.name for emoji in before])
after = ', '.join([emoji.name for emoji in after])
print(f'Emoji list updated :\nBefore : {before}\nAfter : {after}')
Upvotes: 2