#Slash Command Error

1 messages · Page 1 of 1 (latest)

undone raven
#

What's the error?

#

All fields are required. To make it optional you assign it a default value in the async def

#

You have not made a slash command however.

#

I suggest you poke around there

coral oracle
#

disnake doesn't use a tree

#

and don't do this:

async def on_ready():
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name='your every move'))
undone raven
coral oracle
#

Actually learning the language and build a base knowledge of programming in general will go a very long way

undone raven
#

100%

coral oracle
#

well naturally.

#

because you're trying to use discord slash commands with disnake.

#

It looks like this is probably all you have done.. do yourself a favor and don't try to translate disnake = discord Just write in in disnake and eliminate the self confusion

#

drop the on_message.

#

That is NOT how you make commands

#

negative

#

not really necessary since you're trying to use slash commands.

#

But also it would be @bot.command()

#

for each command

#
discord = disnake
intents = discord.Intents.default()
intents.typing = True
intents.presences = True
intents.message_content = True

intent = discord.Intents
client = discord.Client(intents=intents)
bot = commands.Bot(command_prefix="!", intents = discord.Intents.all())

and this is absolutely pointless.

#

you're defining all these intents, then just passing disnake.Intents.all() to the bot constructor

#

like.. if you're going to do that, you don't need to define all the intents above

#

And you don't need Client AND commands.Bot

#

one or the other

#

you're using client.run and there's nothing registered to the client.

#

like...

#

look at the code examples.

#

and delete all the client stuff

#

wut

#

type hint disnake.Member or disnake.User. depends on if it's a guild command or not

#

you would annotate the type

#

In this case it would be disnake.Member or disnake.User

#

a disnake.Member is essentially just a disnake.User that has a guild and a couple extra methods like add_roles and guild specific stuff like that

#

-d disnake.Member

hollow iglooBOT
#

property id```
Equivalent to [`User.id`](https://docs.disnake.dev/page/api.html#disnake.User.id "disnake.User.id")
undone raven
#

user: disnake.Member.id thats not valid scrap the .id

coral oracle
#

Use docstrings

#

then you're not looking hard enough because that link literally provides an example

coral oracle
#

A parameter to...

#

Seriously.. read the guide

#

show code

stark cosmosBOT
#
Solved!

Marked the thread as solved. If your question has not been answered, please open a new thread in #1019642966526140566.