strip_leading_mentions (commands.py)

deer-flow · integration

Shared command definitions used by all channel implementations. Keeping the authoritative command set in one place ensures that channel parsers (e.g. Feishu) and the ChannelManager dispatcher stay in sync automatically — adding or removing a command here is the single edit requir

"""Shared command definitions used by all channel implementations.

Keeping the authoritative command set in one place ensures that channel
parsers (e.g. Feishu) and the ChannelManager dispatcher stay in sync
automatically — adding or removing a command here is the single edit
required.
"""

from __future__ import annotations

KNOWN_CHANNEL_COMMANDS: frozenset[str] = frozenset(
    {
        "/bootstrap",
        "/goal",
        "/new",
        "/status",
        "/models",
        "/memory",
        "/help",
    }
)


def _is_leading_mention_token(token: str) -> bool:
    """Return whether *token* looks like a platform bot/user mention.

    Group chats often require ``@bot`` before the message is delivered. Slack
    and Discord strip those tokens before connect parsing; Feishu / DingTa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key