用于运行CommanderBot实例的命令行接口。
commanderbot的Python项目详细描述
CommanderBot命令行
用于运行CommanderBot实例的命令行接口。在
运行你的机器人
您可以运行自己的bot而不编写任何代码。在
您需要以下各项:
- 你自己的Discord Application和机器人令牌。在
- 机器人的configuration file。在
- 安装了
commanderbot
包的python3.8+环境。- 为此,建议使用virtual environment。在
- 运行
pip install commanderbot
来安装bot核心包。在
- (可选)
commanderbot-ext
包;如果您使用提供的任何扩展。- 运行
pip install commanderbot-ext
安装bot扩展包。在
- 运行
首先应检查CLI帮助菜单:
python -m commanderbot --help
有三种方法可以提供您的bot令牌:
- (推荐)作为
BOT_TOKEN
环境变量:BOT_TOKEN=put_your_bot_token_here
- 作为CLI选项:
--token put_your_bot_token_here
- 启动过程中出现提示时手动执行
下面是一个提供bot令牌作为参数的示例:
^{pr2}$配置bot
当前的配置选项集是有限的。下面是设置命令前缀并加载status
和faq
扩展的示例配置。在
Note that with this configuration, the
faq
extension will require read-write access tofaq.json
in the working directory.
{"command_prefix":">","extensions":["commanderbot_ext.status",{"name":"commanderbot_ext.faq","enabled":true,"options":{"database":"faq.json","prefix":"?"}}]}
- 项目
标签: