Comments (5)
那个 issue 是比较久远的了,描述的是上一代(legacy
分支),现在新的 NoneBot 还是看现在的文档就好,指南里的目录结构就是比较建议的结构(至少我自己的项目就是这么个结构)。
命令名字不需要跟文件名一样,一个文件(模块)里也可以有多个命令,命令名也可以是一个 tuple。
from nonebot.
反复验证了一下,命名是可以不一样。但是plugins的子目录prim里边注册的命令还是不能用。
awesome-bot
├── awesome
│ └── plugins
| └── prim
│ └── weather.py
├── bot.py
└── config.py
如上,所以我干脆在plugins下新建了一个prim.py,心想着用prim目录做业务处理,用prim.py调用,然后发现prim.py里注册的命令用不了了,把prim目录改为别的名字就行了,这算是一个缺陷吗?
from nonebot.
你这个 prim
目录具体是什么内容,业务相关的代码吗?还是数据?如果是代码的话建议 prim/__init__.py
这样的形式,因为如果你同时存在 prim
目录和 prim.py
的话,Python 并不知道该导入哪个,对 Python 来说它们都是 awesome.plugins.prim
from nonebot.
具体可以参考指南里的「编写自然语言处理器」的第一节
from nonebot.
哦哦,忘了还有这种操作了,我很少用__init__.py的😅
参考了一下也确实解决了,多谢大佬
from nonebot.
Related Issues (20)
- 请问如何在只是User is calling me的情况下保持会话? HOT 2
- scheduler与message_preprocessor不在同一个eventloop导致两者之间很难进行同步 HOT 6
- nonebot+cqhttp反向websocket 时出现错误: websocket: bad handshake HOT 8
- [提问]如何关闭heartbeat的logging HOT 6
- aget 无法发送prompt HOT 3
- 1.8.3移除`CommandSession.args`导致类 Shell 参数解析Command出错 HOT 2
- 以 node-onebot 为后端无法正确设置 `ctx['to_me']` HOT 5
- 加載“失敗”的插件注冊的命令仍然可用 HOT 1
- 考慮移除 sched HOT 1
- NLPSession无法处理被两个qq表情夹着的关键词 HOT 11
- 运行`nb run`命令后直接抛出`cannot import name 'WebSocketSetup' from 'nonebot.drivers' ` HOT 1
- say 和 echo失踪 HOT 3
- NLPSession在较长的句子中不能识别到关键词 HOT 2
- 1
- 关于Pyinstaller打包后的exe为什么会报错的解决方案【建议调整一部分代码】
- 启动时遇到ImportError HOT 2
- m1 运行报错cannot import name 'escape' from 'jinja2' HOT 9
- ImportError: cannot import name 'overrides' from 'nonebot.typing' HOT 1
- 无法正确识别“回复”类型消息中的指令 HOT 2
- 按组一同注册命令的关键词 内容 权限 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nonebot.