.. | ||
bugtracker | ||
core | ||
cytoid | ||
github | ||
mcv | ||
mcv_rss | ||
nintendo_err | ||
server | ||
user | ||
utils | ||
weekly | ||
wiki | ||
README.MD |
没人看的信息
如何添加模块
- 新建一个文件夹。
- 在新建的文件夹内新建一个名为
__init__.py
的文件。 - 编写一个异步函数,异步函数接收一个
dict
类型的参数,这个dict
包含从parser.py
和bot.py
传入的信息。 - 在函数外编写一些能够被加载器识别的变量,变量值需为
dict
,以下是能够被加载器识别的变量(不需要的变量可不编写,示例可以看已经写好的模块):
#函数名后面不要带括号
admin = {'绑定指令名': 函数名} #将函数标记为仅超级管理员可用的指令,此变量内的函数会在机器人启动时被强制启用,不可关闭
essential = {'绑定指令名': 函数名} #将函数标记为基础命令,此变量内的函数会在机器人启动时被强制启用,不可关闭
command = {'绑定指令名': 函数名} #将函数标记为模块命令,此变量内的函数需要在机器人启动后进行手动启用
help = {'绑定指令名':{'help': '模块详细帮助'}} #此变量用于编写帮助
regex = {'绑定指令名': 函数名} #将函数标记为正则命令,此变量内的函数在机器人启动后手动启用。标记为正则命令的函数会处理机器人收到的每一条消息。
self_options = ['自定义参数'] #用于检查用户是否要求开启某一项功能,可帮助判断。
options = ['自定义参数'] #用于检查群组是否要求开启某一项功能,可帮助判断。
灵活运用这些东西。