Hi, I'd like help with the following error.
It keeps happening and its really annoying
Traceback (most recent call last):
File "/home/container/main.py", line 13, in <module>
tree = app_commands.CommandTree(client)
File "/home/container/.local/lib/python3.8/site-packages/discord/app_commands/tree.py", line 150, in init
raise ClientException('This client already has an associated command tree.')
discord.errors.ClientException: This client already has an associated command tree.
#Help
1 messages · Page 1 of 1 (latest)
Heads up @opal anvil! We've detected one or more tokens in your attachments!
- Found token of 1294654800427880481 (Casino Manager) in attachment
message.txt. You can regenerate it here.
Fyi: Each token might trigger a system message by discord, if it's valid.
Please avoid uploading tokens in future, even if they aren't valid anymore.
Stay Safe!
This is discord.py not pycord
you already have a tree with bot.tree
Um
Like what should I edit from code sir
remove tree = … line
Yeah, and then it says that tree isn't defined
use bot.tree instead of tree
wdym
ok
@near juniper
So I remove that tree = line and change every cmd thingies to bot.tree.cmd?
yes
tree = app_commands.CommandTree(client)
ok trying
1 min
@near juniper
Traceback (most recent call last):
File "/home/container/main.py", line 117, in <module>
@bot.tree.command(name="blackjack", description="Play a game of Blackjack.")
NameError: name 'bot' is not defined
oh you use client instead of bot
so @near juniper
client.tree then
what are you asking?
...with all due respect, 1) it feels like you don't know your own code and 2) this is the wrong server (your code is discord.py), even if squid happens to know the library you should be asking there instead
what do I put
client.tree.command
or
client.command
the first one
ask discord.py please
no one is mean. you're in the wrong place to ask for help.
and idk coding
- we should be good in a bit
where should I ask
the discord.py server
i mean yeah it's a pretty simple issue so i'm not really inclined to "stop" anything but it shouldn't really be here either
No
If it's so urgent you can also Google it yourself
google = random not working
if you make me look it up it's slower
do u think I haven't tried?
eh did we go over this?
yes, 2 years ago
client
?
bot.client.run(token)?
Traceback (most recent call last):
File "/home/container/main.py", line 418, in <module>
bot.run(token)
NameError: name 'bot' is not defined
If you got all this code from a friend and seem to not hugely understand it, and regardless of your level of programming, I'd recommend to first learn it yourself before trying to debug other's code like this
client.run
Sorry bro
But no need to be always saying some random bad comment
because even if we can help with non library specific stuff for discord.py here, it makes helping infinitely harder
the only reason I say this is because youre, as nelo already said, in the wrong place and with little to no understanding of your code
I know
which are both detrimental to getting helped properly
it's on their GitHub repo iirc