Having choices as both strings and numbers for the same option?
I am trying to make an option for a slash command have a choices of one being a number and the other being a word/string. Is there a work around for this?
35 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
Error: "There was an error: DiscordAPIError[50035]: Invalid Form Body
0.options[1].choices[0].value[STRING_TYPE_CONVERT]: Could not interpret "0" as string."
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah, I was just testing to see if I could delegate those separately to fix my issue.
Is there any work around to make it not "type: ApplicationCommandOptionType.String," and something that allows both strings and numbers to be the choices?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Even if I do '0' instead of just 0, it still says it's not recognized as a string value.
Okay, I didn't think it was possible. Thought to ask though.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Of course. They always are. Autosave on VS Code is a lifesaver.
Thank you for your time and the quick response. 🙂 Have a good one!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Actually. Wait!
Can a String value be a space?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
like so?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah, gave me the same error..
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'm creating an RCON ban command. This is the set up of the in game command:
/ban (IGN or ID) (Duration: 0, 1m, 1h, 1d) (Admin Reason) (Player Reason)
0 bans forever, and so does leaving it blank
So, "/ban munxo 0 test test" would ban me forever
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and so would "/ban munxo test test"
but this is how I'm sending the command to the game server:
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I feel as though I need to use an "if" or an "else" somehow.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
switch
The switch statement evaluates an expression, matching the expression's value against a series of case clauses, and executes statements after the first case clause with a matching value, until a break statement is encountered. The default clause of a switch statement will be jumped to if no case matches the expression's value.
That is the code to send a command straight to the server.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Game server
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
That is the slash command I have built for the Discord bot
But that gives me DiscordAPIError[50035]: Invalid Form Body
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
There was an error: DiscordAPIError[50035]: Invalid Form Body
0.options[0].name[STRING_TYPE_REGEX]: String value did not match validation regex.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'll change that now
@Jô 🌈 🦄 ofc that was the issue.. I was fully overlooking that and didn't even think twice about it...
My commands registered succesfully now..
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I kept seeing 0's in the error and figured it was something wrong with the '0' for the permanent.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah, so '0' words as the string