我找不到解决问题的方法。我想创建一个change_nick
命令,但我不知道要使用的此选项的类型/编号。
我的命令创建者:
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,
},
]
},
);
我试着浏览和阅读文档,但找不到任何
如果你想接受一个字符串,那么它是数字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,
},
],
});
类型 | 值 |
---|---|
布尔型 | 5 |
频道 | 7 |
整数 | 4 |
可提及 | 9 |
数字 | 10 |
角色 | 8 |
字符串 | 3 |
子命令组 | 2 |
用户 | 6 |
文档说它是类型3。
在discord.js中,您也可以这样做:
v13const { Constants } = require('discord.js');
,然后使用Constants.ApplicationCommandOptionTypes.STRING
v14const { ApplicationCommandOptionType } = require('discord.js');
然后使用ApplicationCommandOptionType.String