Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: SlashChoice Breaking Interactions #1080

Open
1 task done
neverabsolute opened this issue Jan 19, 2025 · 1 comment
Open
1 task done

[Bug]: SlashChoice Breaking Interactions #1080

neverabsolute opened this issue Jan 19, 2025 · 1 comment
Assignees
Labels
bug Something isn't working unverified

Comments

@neverabsolute
Copy link

What happened?

I have a bot I use for moderation. In the /ban command, there is a parameter for the ban reason. That parameter has SlashChoice options like so:

@SlashChoice({
	name: "DM spam/scam",
	value: "DM spam/scam"
})
@SlashChoice({
	name: "Server spam/scam",
	value: "Server spam/scam"
})
@SlashChoice({
	name: "Exposing PII",
	value: "Exposing PII"
})
@SlashChoice({
	name: "Extreme toxicity",
	value: "Extreme toxicity"
})
@SlashChoice({
	name: "Illegal content",
	value: "Illegal content"
})
@SlashChoice({
	name: "Other flagrant violation of Discord ToS",
	value: "Other flagrant violation of Discord ToS"
})
@SlashOption({
	name: "reason",
	description: "Reason for ban",
	type: ApplicationCommandOptionType.String,
	required: true
})

It's been running fine for a year up until today. Now, when I type the /ban command, I fill in the user, then the autocomplete option that appears ahead of the reason field fails to load.

Image

What's odd is this is entirely unrelated to that field. In devtools I see:

{
    "message": "Invalid Form Body",
    "code": 50035,
    "errors": {
        "data": {
            "options": {
                "0": {
                    "options": {
                        "2": {
                            "value": {
                                "_errors": [
                                    {
                                        "code": "BASE_TYPE_CHOICES",
                                        "message": "Value must be one of {'DM spam/scam', 'Exposing PII', 'Other flagrant violation of Discord ToS', 'Extreme toxicity', 'Illegal content', 'Server spam/scam'}."
                                    }
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}

Commenting out all the slash options immediately returns functionality to normal. There are no error logs whatsoever from the bot during any of this.

Reproduction

  • Create a slash command
  • Have multiple fields
  • Have an autocompleting field anywhere in the command builder
  • Have one of the fields be one that is required with choices

Package

discordx

Relevant log output

{
    "message": "Invalid Form Body",
    "code": 50035,
    "errors": {
        "data": {
            "options": {
                "0": {
                    "options": {
                        "2": {
                            "value": {
                                "_errors": [
                                    {
                                        "code": "BASE_TYPE_CHOICES",
                                        "message": "Value must be one of {'DM spam/scam', 'Exposing PII', 'Other flagrant violation of Discord ToS', 'Extreme toxicity', 'Illegal content', 'Server spam/scam'}."
                                    }
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@neverabsolute
Copy link
Author

Relevant requirements:

"dependencies": {
		"@discordx/importer": "^1.3.1",
		"@discordx/pagination": "^3.5.5",
		"@discordx/utilities": "^5.2.1",
		"discord.js": "^14.17.3",
		"discordx": "^11.12.2",
		"reflect-metadata": "^0.1.14",
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

2 participants