Skip to content

[Bug]: Discord /slash commands not being properly recognized when in channel #5865

@dsocolobsky

Description

@dsocolobsky

Bug Description

When adding my discord bot to a channel, and typing for example: "@HermesBot /yolo" the command seems to go unrecognized and the text is processed by the LLM instead of being intercepted, like it works in DMs or within a thread.

note: I do not know if this is a bug, but it certainly seems like the intended behavior should be other than what happens right now. I would expect directly tagging my bot in the channel to behave the same as sending a DM to it.

Steps to Reproduce

  1. Run hermes gateway via Discord
  2. In your home channel type "@bot /yolo" or "@bot /usage" etc.

Expected Behavior

I would expect the command to be recognized and show/perform the deterministic function like how it works in DMs:

Image

Actual Behavior

The text goes through the LLM instead of running the command:
Image

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Discord

Operating System

macOS 15.7.5

Python Version

3.11.11

Hermes Version

0.7.0

Relevant Logs / Traceback

2026-04-08 17:52:36,596 WARNING gateway.platforms.discord: [DEBUG] BEFORE create_thread: message.content = '/yolo'
2026-04-08 17:52:37,093 WARNING gateway.platforms.discord: [DEBUG] AFTER  create_thread: message.content = '<@1490768887665529002> /yolo'

Root Cause Analysis (optional)

create_thread() (called by _auto_create_thread()) restores the original raw message content including the <@mention> prefix, undoing any prior mention stripping. This means message.content starts with <@...> again by the time the / prefix check runs, so slash commands are never detected.

Proposed Fix (optional)

Save a copy of the mention-stripped message text before _auto_create_thread() runs, and use that copy for /command detection instead of message.content.

I believe I have a working PR which I'm testing a bit more but I wanted to get the ok that this is something we want fixed/changed first.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    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