D
D
DetectivePikachu2021-03-11 12:15:56
Python
DetectivePikachu, 2021-03-11 12:15:56

Issuing roles by reaction?

import discord

@client.event
async def on_ready():
    Channel = client.get_channel('819245759706300437')
    Text= "819248816892936222"
    Moji = await client.send_message(Channel, Text)
    await client.add_reaction(Moji, emoji='')
@client.event
async def on_reaction_add(reaction, user):
    Channel = client.get_channel('819245759706300437')
    if reaction.message.channel.id != Channel
    return
    if reaction.emoji == "":
      Role = discord.utils.get(user.server.roles, name="Деранкер FACEIT")
      await client.add_roles(user, Role)

client = RoleReactClient(intents=intents)
client.run("тут токен")


I get this error on startup: line 3, in
@client.event
NameError: name 'client' is not defined

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuriy Vorobyov, 2021-03-11
@YuriyVorobyov1333

You need to initialize the client before the functions, move it client = RoleReactClient(intents=intents)to the beginning of the code or add it client = discord.Client()at the beginning

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question