#๐Ÿ”’ My code isn't working

26 messages ยท Page 1 of 1 (latest)

viscid lodge
#

Traceback (most recent call last):
File "c:/Users/----/Downloads/_1/main.py", line 13, in <module>
@client.event
NameError: name 'client' is not defined
PS C:\Users----\Downloads_1> & C:/Users/----/AppData/Local/Programs/Python/Python38/python.exe c:/Users/----/Downloads/_1/main.py
Traceback (most recent call last):
File "c:/Users/----/Downloads/_1/main.py", line 13, in <module>
@client.event
NameError: name 'client' is not defined

balmy lavaBOT
#

@viscid lodge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hushed mountain
#

well, maybe you need to define that name somewhere then?

#

oh, and please update to a supported Python version

#

yours is quite old

viscid lodge
#

I use 3.8

hushed mountain
#

so it seems, but you should be using something newer

#

3.13 unless you have a good reason to use something older

viscid lodge
#

alrighty, I'll download it. Can you send me the link to it?

hushed mountain
viscid lodge
#

aight

viscid lodge
hushed mountain
#

you can't just throw random code together and expect it to work

#

there has to be some kind of conscious plan on what it will do

#

like what do you expect @client.event to do?

viscid lodge
#

@client.event
async def on_ready():
print("The bot is ready")

hushed mountain
#

and?

#

what's client here?

#

where is it defined?

viscid lodge
#

I didn't define it yet, would be nice if you told me how to define it

hushed mountain
#

maybe start with something simpler than writing a discord bot without any coding experience

#

so you can get familiar with the basics

#

then progress to more complex tasks such as this

viscid lodge
#

alright

balmy lavaBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.