Kord-Extensions / kord-extensions

Kord extensions framework, providing commands and distinct units of functionality
https://kordex.dev
European Union Public License 1.2
112 stars 27 forks source link

Global commands not setting `dm_permission` property #174

Closed Galarzaa90 closed 2 years ago

Galarzaa90 commented 2 years ago

Description

The property allowInDms for slash commands is not being used when registering the commands to Discord, resulting in the commands being visible in DMs.

Versions

kordex-1.5.5-SNAPSHOT

Reproduction

ephemeralSlashCommand {
    name = "events"
    description = "Description"
    allowInDms = false
    action { 
        //..
    }
}

The command will still be available in private messages.

Suggestions

This is the part that is registering each command: https://github.com/Kord-Extensions/kord-extensions/blob/develop/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/DefaultApplicationCommandRegistry.kt#L204-L210

However, when that register method is being called, it is calling: ChatInputCreateBuilder.register and not GlobalChatInputCreateBuilder.register, so dmPermissions is never set to false on the payload sent to the API.

Galarzaa90 commented 2 years ago

This was fixed in #175