A
A
Andrey Gavrilov2020-11-18 08:13:05
Python
Andrey Gavrilov, 2020-11-18 08:13:05

It throws an error when using @bot.event, what am I doing wrong? Discord.py?

Here is the error displayed -
@bot.event
NameError: name 'bot' is not defined

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Demidov, 2020-11-19
@Helfik

import discord
from discord.ext import commands


TOKEN = "тут был токен!"

bot = commands.Bot(command_prefix='ПРЕФИКС')

bot.run(TOKEN)

the bot variable is responsible for the bot, but you may have a client, and for this you have an error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question