Skip to content

Discord: onSlashCommand handlers never invoked via HTTP Interactions #131

@luminus-xd

Description

@luminus-xd

Bug Description

onSlashCommand handlers registered via bot.onSlashCommand(...) are never invoked
when slash commands arrive through Discord's HTTP Interactions (webhook).

The handleWebhook method correctly returns DeferredChannelMessageWithSource to
acknowledge the interaction, but never calls this.chat.processSlashCommand().
As a result, Discord shows "The application did not respond" after the timeout.

Steps to Reproduce

  1. Register a slash command handler:
    bot.onSlashCommand("help", async (event) => {
      await event.channel.post("Hello!");
    });
  2. Set Interactions Endpoint URL in the Discord Developer Portal
  3. Invoke /help in Discord
  4. Discord shows "The application did not respond"

Root Cause

In handleWebhook, MessageComponent (button clicks) correctly calls
handleComponentInteraction() which invokes this.chat.processAction().
However, the ApplicationCommand branch only returns a deferred response
without processing:

// ✅ MessageComponent — handler is invoked
if (interaction.type === InteractionType.MessageComponent) {
  this.handleComponentInteraction(interaction, options); // calls processAction()
  return this.respondToInteraction({ type: InteractionResponseType.DeferredUpdateMessage });
}

// ❌ ApplicationCommand — handler is never invoked
if (interaction.type === InteractionType.ApplicationCommand) {
  return this.respondToInteraction({
    type: InteractionResponseType.DeferredChannelMessageWithSource,
  });
  // Missing: this.handleSlashCommandInteraction(interaction, options)
}

There is no handleSlashCommandInteraction method in DiscordAdapter,
and this.chat.processSlashCommand() is never called anywhere in the adapter.

Expected Behavior

onSlashCommand handlers are invoked and their response is sent back to Discord
via the interaction follow-up API.

Actual Behavior

The deferred response is sent but the handler is never called, resulting in
"The application did not respond" in the Discord client.

Chat SDK Version

4.15.0

Platform Adapter

Discord

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions