Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add option that will accept string discord js

I can't find a solution to my problem. I want to create a change_nick command and I don't know the type/number of this option to use.

My command creator:

commands.create
            (
                {
                    name: 'change_nick',
                    description: 'changes nick for specified person',
                    options:
                    [
                        {
                            name: 'user',
                            description: 'user that name will be changed',
                            type: 6,
                        },
                        {
                            name: "new_username",
                            description: "new username",
                            type: "" //that's what I'm searching for,
                        },
                    ]
                },
            );

I tried browsing and reading the documentation but I couldn't find anything

like image 918
Lotar 122 Avatar asked Sep 12 '25 18:09

Lotar 122


1 Answers

If you want to accept a string, then it's number 3:

commands.create({
  name: 'change_nick',
  description: 'changes nick for specified person',
  options: [
    {
      name: 'user',
      description: 'user that name will be changed',
      type: 6,
    },
    {
      name: 'new_username',
      description: 'new username',
      type: 3, //that's what I'm searching for,
    },
  ],
});
type value
Attachment 11
Boolean 5
Channel 7
Integer 4
Mentionable 9
Number 10
Role 8
String 3
Subcommand 1
SubcommandGroup 2
User 6
like image 80
Zsolt Meszaros Avatar answered Sep 14 '25 09:09

Zsolt Meszaros