fixed message context interaction

This commit is contained in:
2024-04-07 16:02:30 +02:00
parent 5f2fc7cbf1
commit 9e613d5adc
2 changed files with 12 additions and 5 deletions

View File

@@ -62,11 +62,14 @@ func ready(e *events.Ready) {
func applicationCommandInteractionCreate(e *events.ApplicationCommandInteractionCreate) {
for _, command := range commands {
if command.Interact != nil && e.SlashCommandInteractionData().CommandName() == command.Definition.CommandName() {
if command.Interact != nil && e.Data.CommandName() == command.Definition.CommandName() {
if !command.AllowDM && e.ApplicationCommandInteraction.GuildID().String() == "" {
e.CreateMessage(discord.NewMessageCreateBuilder().
err := e.CreateMessage(discord.NewMessageCreateBuilder().
SetContent("This command is not available in DMs.").SetEphemeral(true).
Build())
if err != nil {
logrus.Error(err)
}
} else {
command.Interact(e)
}