russellbanks / Notify

A Discord bot written in Kotlin to send notifications when people join voice channels.
GNU General Public License v3.0
13 stars 0 forks source link

shorthand to type-safe values #40

Closed HopeBaron closed 2 years ago

HopeBaron commented 2 years ago

https://github.com/BanDev/Notify/blob/8c4b194f142dba4c546882e500938a4b37f4f237/src/main/kotlin/Main.kt#L31

        if (interaction.command.rootName == "configure") configureInteraction(interaction)

you can also check if the command is a subcommand or group command by checking types

 val command = interaction.command
 if(command is RootCommand) 
 // OR for subcommand
 if(command is SubCommand)
 // OR for group subcommand
 if(command is GroupSubCommand)

each of these types provide more context based on type.