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: "" //thath's what i'm searching for,
},
]
},
);
I tried browsing and reading the documentation but I couldn't find anything
CodePudding user response:
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 |
CodePudding user response:
The docs say it's type 3.
In discord.js you can also do this:
v13
const { Constants } = require('discord.js');
and then use
Constants.ApplicationCommandOptionTypes.STRING
v14
const { ApplicationCommandOptionType } = require('discord.js');
and then use
ApplicationCommandOptionType.String