#๐Ÿ”’ code not working

46 messages ยท Page 1 of 1 (latest)

turbid patioBOT
#

@topaz lynx

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.

shut token
#

The error is telling you the token is None instead of an actual token.

winter bobcat
#

where have you defined the TOKEN variable?

stable folio
#

If it's defined using os.environ.get, make sure you've set an environment variable with the token

#

Oh, you have an .env file, so you're presumably reading that?

teal vapor
#
bot.command("name")
async def name(ctx):
#

are you trying to get the bot to send that

#
bot.command('commando')
async def commando(ctx,userinput):
  await ctx.send(get_respone(userinput))
#

read the document

#

you need import discord

#

yes

#

bot = discord.Bot()

#

before the client

final vault
#

i can't help with the code, but you should put it all in a pastebin instead of images.

#

!paste

turbid patioBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

winter bobcat
#

I believe it should be discord.Client, not discord.Bot

#

like in ur screenshot

#

name error

#

you used uppercase Bot for ur var name

#

check squiggly lines

#

those are helpful

#

Bot = discord.client

#

line 7

#

you always use lowercase bot after that

#

name and case gotta match

#

yeah thats better

#

so you can know what you're doing

#

well where are you getting the code you have

#

like where did you get slash_command

#

yea good idea

#

i would use discordpy tutorials to learn

#

if documentation is bad

#

they're very helpful to get started

copper pelican
#

you're kinda trying to walk a tightrope over a volcano, when you haven't learned to stand on solid ground yet.
discord bots are highly complex, and doing that without any python foundation will be difficult.

winter bobcat
#

agree with Sani

#

python fundamentals before different libraries

copper pelican
#

you could do that, but not in this server.

#

(against the rules)

winter bobcat
#

running the program turns the bot on

copper pelican
#

you have to keep your computer on 24/7

#

or get a cheap vps where you can host it

turbid patioBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.