Giter VIP home page Giter VIP logo

Comments (5)

stdrc avatar stdrc commented on August 23, 2024

那个 issue 是比较久远的了,描述的是上一代(legacy 分支),现在新的 NoneBot 还是看现在的文档就好,指南里的目录结构就是比较建议的结构(至少我自己的项目就是这么个结构)。

命令名字不需要跟文件名一样,一个文件(模块)里也可以有多个命令,命令名也可以是一个 tuple。

from nonebot.

yunsii avatar yunsii commented on August 23, 2024

反复验证了一下,命名是可以不一样。但是plugins的子目录prim里边注册的命令还是不能用。

awesome-bot
├── awesome
│   └── plugins
|    └── prim
│    └── weather.py
├── bot.py
└── config.py

如上,所以我干脆在plugins下新建了一个prim.py,心想着用prim目录做业务处理,用prim.py调用,然后发现prim.py里注册的命令用不了了,把prim目录改为别的名字就行了,这算是一个缺陷吗?

from nonebot.

stdrc avatar stdrc commented on August 23, 2024

你这个 prim 目录具体是什么内容,业务相关的代码吗?还是数据?如果是代码的话建议 prim/__init__.py 这样的形式,因为如果你同时存在 prim 目录和 prim.py 的话,Python 并不知道该导入哪个,对 Python 来说它们都是 awesome.plugins.prim

from nonebot.

stdrc avatar stdrc commented on August 23, 2024

具体可以参考指南里的「编写自然语言处理器」的第一节

from nonebot.

yunsii avatar yunsii commented on August 23, 2024

哦哦,忘了还有这种操作了,我很少用__init__.py的😅
参考了一下也确实解决了,多谢大佬

from nonebot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.