#Can not register commands for type ApplicationCommandModule

1 messages · Page 1 of 1 (latest)

sleek glacier
#

The type 'DiscordBotTutorial.Commands.MyCommands' cannot be used as type parameter 'T' in the generic type or method 'CommandsNextExtension.RegisterCommands<T>()'. There is no implicit reference conversion from 'DiscordBotTutorial.Commands.FunCommands' to 'DSharpPlus.CommandsNext.BaseCommandModule'. [ceesharp]

#
            Commands.RegisterCommands<MyCommands>();
mint yarrow
#

your command class has to inherit from ApplicationCommandModule

#

like public class FunCommands : ApplicationCommandModule { }

sleek glacier
#

oh i thought it needed another type for application commands

#

thanks

mint yarrow
#

you need ApplicationCommandModule

sleek glacier
#

ah alr

mint yarrow
sleek glacier
#

it returns the error again

#

when using ApplicationCommandModule

mint yarrow
#

you're trying to register on a CommandsNextExtension

#

if you want slash commands you have to use the SlashCommandsExtension

sleek glacier
#

There is no argument given that corresponds to the required formal parameter 'description' of 'SlashCommandAttribute.SlashCommandAttribute(string, string, bool)' [ceesharp]csharp(CS7036)

#

@mint yarrow any idea?

mint yarrow
#

you're supposed to have a second parameter to the slash command attribute

mint yarrow
sleek glacier
# mint yarrow as long as you follow this properly it should be fine

i have a error at registering, technically i did everything right in documentation but i get this
System.ArgumentException: Arguments must have the Option attribute!
at DSharpPlus.SlashCommands.SlashCommandsExtension.ParseParameters(ParameterInfo[] parameters, Nullable`1 guildId)
at DSharpPlus.SlashCommands.SlashCommandsExtension.<>c__DisplayClass39_0.<<RegisterCommands>b__0>d.MoveNext()

Commands = Client.UseSlashCommands();
Commands.RegisterCommands<MyCommands>();

mint yarrow
#

the error means you did not read the documentation properly

sleek glacier
#

Then tell me whats wrong