#Command not being detected

1 messages · Page 1 of 1 (latest)

barren sleet
#

In attempts to learn disnake and create a bot, I've been following the commands tutorial provided in disnakes documentation to make some commands for my bot.(https://docs.disnake.dev/en/stable/ext/commands/commands.html)

I currently cannot figure out what's wrong, but I can say thats the on_ready() event does run successfully. This code is the main and orly module being run. I appreciate any help!

import disnake
from disnake.ext import commands

client = disnake.Client(intents=disnake.Intents.all())
bot = commands.Bot(command_prefix='$')

@client.event
async def on_ready():
    print(f'We have logged in as {client.user}')

@bot.command()
async def test(ctx, arg):
    ctx.send(arg)

client.run('')
#

Sorry, forgot to add this:

When I do run my code, I get a message about the Message Content intent not being enabled, and that I should set it to true to use prefix commands. How would I set the intent to true?

rare epoch
#

alright I'm confused

#

you have both bot and client?

barren sleet
#

Yes

#

Not a good thing?

rare epoch
#

not a good thing

#

Move the intents=disnake.Intents.all() bit from Client() to Bot(), remove the client = ... line, replace client in your code with bot, rerun

barren sleet
#

I'll let you know how it goes

rare epoch
#

also you just shared your token to everyone who looks at this thread, sadlol

barren sleet
#

Shoot, I meant to remove that

#

Guess I'm renewing that

#

Okay it worked, but for the sake of understanding, could you tell me why it's bad to use both the client and bot?

#

And thanks so much for the help, btw

rare epoch
#

without threading or other shenanigans, you're only running one of them

rare epoch
#

also, having 2 bots running on the same token can cause weird issues, both with slash and prefix commands

barren sleet
#

Ah ok

#

Thanks for the help!