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

fix: make subcommand options optional #241

Merged
merged 4 commits into from
Nov 19, 2021
Merged

Conversation

gc
Copy link
Contributor

@gc gc commented Nov 19, 2021

Please describe the changes this PR makes and why it should be merged:

Subcommand options can be optional,
example:

	options: [
		{
			name: 'command',
			description: 'The command you want to invoke.',
			type: ApplicationCommandOptionType.SubcommandGroup,
			options: [
				{
					name: 'spawnrandomcards',
					description: 'Spawn lots of random cards.',
					type: ApplicationCommandOptionType.Subcommand
				}
			]
		}
	],

and discord sends:

[
    {
        "type": 2,
        "options": [
            {
                "type": 1,
                "name": "spawnrandomcards"
                // types think that "options" is always here
            }
        ],
        "name": "command"
    }
]

Reference Discord API Docs PRs or commits:

Not sure if this is even listed in the discord docs, but I deduced this just based off console.log'ing an interaction.

@vladfrangu vladfrangu changed the title Make subcommand options optional fix: make subcommand options optional Nov 19, 2021
@vladfrangu vladfrangu merged commit 7379a34 into discordjs:main Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants