I am creating a Discord bot to collect user information when joining a community by prompting the user to provide the required profile data.
I have the following command:
const JOIN_COMMAND = {
name: 'join',
description: 'User requests to join the community and need to provide his/her profile information',
//type: 1,
options: [
{
type: 3, // STRING
name: 'name',
description: 'Please provide your name',
required: true,
},
{
type: 4, // INTEGER
name: 'age',
description: 'Please provide your age',
required: true,
min_value: 18,
max_value: 90
},
{
type: 1, // SUB_COMMAND
name: 'gender',
description: 'Please provide your gender',
//required: true,
"options": [
{
"name": "male",
"description": "Male",
"type": 3 // 1 is type SUB_COMMAND
},
{
"name": "female",
"description": "Female",
"type": 3
}
]
},
],
integration_types: [0, 1],
contexts: [0, 1, 2],
};
I get the following error when using PUT
to update the existing command:
{
"message": "Invalid Form Body",
"code": 50035,
"errors": {
"1": {
"options": {
"2": {
"_errors": [
{
"code": "APPLICATION_COMMAND_OPTIONS_TYPE_INVALID",
"message": "Sub-command and sub-command group option types are mutually exclusive to all other types"
}
]
}
}
}
}
}
It's strange because there is no "sub-command group" (type: 2) in the structure.
const JOIN_COMMAND = {
name: 'join',
description: 'User requests to join the community',
type: 1,
options: [
{
type: 3, // STRING
name: 'name',
description: 'Please provide your name',
required: true,
},
{
type: 4, // INTEGER
name: 'age',
description: 'Please provide your age',
required: true,
min_value: 18,
max_value: 90
},
{
type: 3, // SUB_COMMAND
name: 'gender',
description: 'Please provide your gender',
required: true,
choices: [
{
name: "Male",
value: "Male"
},
{
name: "Female",
value: "Female"
},
],
},
],
integration_types: [0, 1],
contexts: [0, 1, 2],
};