nonebot / nonebot/plugin-alconna

[Bug] 当响应器命令被覆盖后,源命令的别名也会被继承

Open
#104 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
143
Forks
27
PR merge metrics
No merged PRs in 30d

Description

请确认:

  • 问题的标题明确
  • 我翻阅过其他的issue并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

Bug

问题

当两个不同的插件注册同一个命令后,后加载的插件会覆盖先加载插件的命令。同时,后加载的插件还会继承先加载插件的别名,导致误触发

我装了二次元语录群语录两个不同插件,他们的触发命令都是语录,其中二次元语录插件包含别名二次元;于是就会出现,我在群里发送二次元,而bot发送的是群语录

如何复现

创建test1,test2两个插件,都注册test命令,其中test1插件注册别名test1,运行后,无论输入test还是test1,都返回test2
Image

预期行为

可以有多种预期
1、当出现命令冲突时报错
2、两个插件独立触发,第一个插件进触发别名,第二个插件触发命令

使用环境:

  • Python 版本: 3.11.9
  • Nonebot2 版本: 2.4.2
  • Alconna 版本: 0.58.2

日志/截图

运行过程无出错
Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the issue. Start by reproducing the conflict with two plugins registering test, with one also registering test1, under Python 3.11.9, NoneBot2 2.4.2, and Alconna 0.58.2. Done means the conflicting command and alias behavior follows an explicitly chosen, tested policy without the later plugin unintentionally inheriting the earlier alias.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.