comment supprimer le rôle disque bot python
#you have to edit some parts of this code
import discord
#this is just another way to say @client.event
class MyClient(discord.Client):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.target_message_id = (Your message id)
async def on_ready(self):
print('Running...')
#Reaction added
async def on_raw_reaction_add(self, payload):
if payload.message_id != self.target_message_id:
return
guild = client.get_guild(payload.guild_id)
if payload.emoji.name == '(Your emoji)':
role = discord.utils.get(guild.roles, name='<Your role>')
await payload.member.add_roles(role)
#Reaction removed
async def on_raw_reaction_remove(self, payload):
if payload.message_id != self.target_message_id:
return
guild = client.get_guild(payload.guild_id)
member = guild.get_member(payload.user_id)
if payload.emoji.name == '(Your emoji)':
role = discord.utils.get(guild.roles, name='<Your role>')
await member.remove_roles(role)
intents = discord.Intents.default()
intents.members = True
client = MyClient(intents=intents)
client.run('<Your token>')
#give this a thumbs up if it helped you
Doubtful Dunlin