Skip to content

[Bug]Discord适配器中,注册命令匹配正则 [a-z0-9_-] 应当改成 [\w-] #9101

Description

@NLKASHEI

What happened / 发生了什么

泥嚎,我在部署Discord的机器人时,发现斜杠命令名是cmd_name,但cmd_name被astrbot的discord适配器正则[a-z0-9_-]过滤了一遍,如果cmd_name为中文,则无法通过注册,建议改为[\w-]

Reproduce / 如何复现?

管理行为中,将原本为英文的命令重命名为中文,重启后会发现斜杠指令里就不存在了,是被适配器正则过滤了

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

4.26.3 Windows Docker Desktop Discord

OS

Windows

Logs / 报错日志

[2026-07-01 18:03:15.906] [Core]
[INFO]
[discord.discord_platform_adapter:420]: [Discord] Collecting and registering slash commands...
[2026-07-01 18:03:15.907] [Core]
[INFO]
[discord.discord_platform_adapter:460]: [Discord] Ready to sync 2 commands: sid, buy
将buy改为购买
会发现就没了

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:platformThe bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on.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