A plugin to run go-cqhttp directly in NoneBot2, without additional download and installation.
Project description
nonebot-plugin-gocqhttp
A plugin to run go-cqhttp directly in NoneBot2, without additional download and installation.
一款在NoneBot2中直接运行go-cqhttp的插件, 无需额外下载安装.
为什么?
-
为了不用同时手动启动
go-cqhttp
和nonebot
进程, 非常方便 -
为了便于Docker等进行部署, 只需制作一个
nonebot
容器即可
怎么用?
安装
推荐使用nb-cli
进行安装
配置
本项目提供以下配置项, 请在.env
中自行进行配置
如果想要获取更多配置文件相关信息, 请阅读源代码
-
ACCOUNTS
: 要登录的QQ账号列表, 为一个json数组-
支持的字段:
uin
: QQ账号 (必填)password
: QQ密码, 不填将使用扫码登录protocol
: 数字, 是登录使用的客户端协议config_extra
: 配置文件拓展, 用于覆盖默认配置- 由于在每次程序启动时
go-cqhttp
启动配置文件都会被覆盖, 所以请在该项目中设置你要添加的配置项- 当直接填写json对象时, 原样传入并更新配置文件
- 当传入以
ref:
开头的字符串时, 它将尝试读取之后目录中的文件, 来更改配置文件 - 当传入以
override:
开头的字符串时, 它将尝试尝试读取之后目录中的文件, 来覆盖配置文件
- 由于在每次程序启动时
device_extra
: 和config_extra
类似, 但是是用来覆盖device.json
中配置的
-
示例:
[ { "uin":"QQ帐号", "password":"密码", } ]
-
-
DOWNLOAD_REPO
: 要下载的仓库, 默认为Mrs4s/gocqhttp
-
DOWNLOAD_VERSION
: 要下载的版本, 默认为latest
, 即最新版本 -
DOWNLOAD_URL
: 下载URL, 支持多个占位符 -
FORCE_DOWNLOAD
: 强制在启动时下载, 默认为false
-
PROCESS_RESTARTS
: 尝试重启进程的次数, 小于0则不限制, 默认为-1
使用
配置好了以后启动你的Bot即可
- 需要注意以下几点:
- 本插件会在工作目录下创建
accounts
文件夹用于存储go-cqhttp
的二进制和数据文件, 如果你使用版本管理工具(如git
), 请自行将该文件夹加入忽略列表 - 本插件通过子进程调用实现, 如果你在外部终止了Bot进程, 请检查开启的子进程是否也同样已终止
- 本插件会在工作目录下创建
本插件提供了一个仅SUPERUSERS
能用的命令: gocq
, 可以用来查看当前运行的go-cqhttp
进程状态
鸣谢
koishijs/koishi-plugin-gocqhttp
: 本项目直接参考(直接开抄)Mrs4s/gocqhttp
,nonebot/nonebot2
:(看看项目名, 什么成分不用多说了吧)本项目的套壳的核心
开源许可证
由于go-cqhttp
使用了AGPL-3.0许可证, 本项目也同样使用该许可
注意! 如果在您的项目中使用了该插件, 您的项目也同样以该许可开源!
A plugin to run go-cqhttp directly in NoneBot2, without additional download and installation.
Copyright (C) 2022 Mix
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for nonebot-plugin-gocqhttp-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96e72ac375291c2a1c85e5e7bfb2fb8df1b7188782841acc8932f119bda53c08 |
|
MD5 | fd1f4809ccb63bbc0d640394d9277567 |
|
BLAKE2b-256 | bdb4318cad9efcc34ec5890e64602b4666c48b4b0ca752a44fff8aa7bece86a9 |
Hashes for nonebot_plugin_gocqhttp-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08c07d7575c0a65499efafcb5ae16856c950074e51c7720470cf290fd126ee04 |
|
MD5 | 3da0e9984da4f4a64b3568888bc66400 |
|
BLAKE2b-256 | 755656bbcf028809ef2061d2c8d5f0a50d0947dd7575325fc5fd967404f72a0a |