Solution for Discord bot slash command
is Given Below:
I’m trying to create a bot with multiple commands on discord, I was able to implement it for one command as per sample:
{
"name": "blep",
"description": "Send a random adorable animal photo",
"options": [
{
"name": "animal",
"description": "The type of animal",
"type": 3,
"required": True,
"choices": [
{
"name": "Dog",
"value": "animal_dog"
},
{
"name": "Cat",
"value": "animal_cat"
},
{
"name": "Penguin",
"value": "animal_penguin"
}
]
},
{
"name": "only_smol",
"description": "Whether to show only baby animals",
"type": 5,
"required": False
}
]
}
Now I want to add another command, I try to modify the JSON to be an array but it does not accept it, I also try to create multiple objects on the JSON also does not work, does anyone know-how is the best way to make it work?
You need to call the <ApplicationCommandManager>.create(<ApplicationCommandData>)
method again, where the new <ApplicationCommandData>
is your new commands data object.