admin管理员组文章数量:1026912
I've seen some bots that have space in the name of their slash mands, ex: /admin ban
But when I try to implement it, I get an error saying that the name of the slash mand does not match a validation regex.
My code:
guildmands.create({
name: 'foo bar',
description: 'random description here'
});
Error:
DiscordAPIError: Invalid Form Body
name: String value did not match validation regex.
I've seen some bots that have space in the name of their slash mands, ex: /admin ban
But when I try to implement it, I get an error saying that the name of the slash mand does not match a validation regex.
My code:
guild.mands.create({
name: 'foo bar',
description: 'random description here'
});
Error:
DiscordAPIError: Invalid Form Body
name: String value did not match validation regex.
Share
Improve this question
edited Mar 24, 2022 at 19:00
Zsolt Meszaros
23.2k19 gold badges58 silver badges69 bronze badges
asked Mar 24, 2022 at 14:18
Ed.anEd.an
1673 silver badges6 bronze badges
1 Answer
Reset to default 5These are called submands. They are a good way to sort mands. For example, instead of using setsomething
and deletesomething
mands, you could use something delete
and something set
.
You can do this with the options
property, and setting the type to SUB_COMMAND
guild.mands.create({
name: "foo",
description: "random description here",
options: [
{
type: "SUB_COMMAND",
name: "bar",
description: "some description"
}
]
})
You can get this in the interactionCreate
event through .getSubmand()
const submand = interaction.options.getSubmand() // "bar"
I've seen some bots that have space in the name of their slash mands, ex: /admin ban
But when I try to implement it, I get an error saying that the name of the slash mand does not match a validation regex.
My code:
guildmands.create({
name: 'foo bar',
description: 'random description here'
});
Error:
DiscordAPIError: Invalid Form Body
name: String value did not match validation regex.
I've seen some bots that have space in the name of their slash mands, ex: /admin ban
But when I try to implement it, I get an error saying that the name of the slash mand does not match a validation regex.
My code:
guild.mands.create({
name: 'foo bar',
description: 'random description here'
});
Error:
DiscordAPIError: Invalid Form Body
name: String value did not match validation regex.
Share
Improve this question
edited Mar 24, 2022 at 19:00
Zsolt Meszaros
23.2k19 gold badges58 silver badges69 bronze badges
asked Mar 24, 2022 at 14:18
Ed.anEd.an
1673 silver badges6 bronze badges
1 Answer
Reset to default 5These are called submands. They are a good way to sort mands. For example, instead of using setsomething
and deletesomething
mands, you could use something delete
and something set
.
You can do this with the options
property, and setting the type to SUB_COMMAND
guild.mands.create({
name: "foo",
description: "random description here",
options: [
{
type: "SUB_COMMAND",
name: "bar",
description: "some description"
}
]
})
You can get this in the interactionCreate
event through .getSubmand()
const submand = interaction.options.getSubmand() // "bar"
本文标签: javascriptHow to create a slash command with spacing in the nameStack Overflow
版权声明:本文标题:javascript - How to create a slash command with spacing in the name? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745653127a2161437.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论