Skip to main content

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的插件, 无需额外下载安装.

PyPI

GitHub issues GitHub forks GitHub stars GitHub license

为什么?

  • 为了对标koishijs/koishi-plugin-gocqhttp

  • 为了不用同时手动启动go-cqhttpnonebot进程, 非常方便

  • 为了便于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进程状态

鸣谢

开源许可证

由于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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot-plugin-gocqhttp-0.2.2.tar.gz (335.0 kB view details)

Uploaded Source

Built Distribution

nonebot_plugin_gocqhttp-0.2.2-py3-none-any.whl (339.1 kB view details)

Uploaded Python 3

File details

Details for the file nonebot-plugin-gocqhttp-0.2.2.tar.gz.

File metadata

  • Download URL: nonebot-plugin-gocqhttp-0.2.2.tar.gz
  • Upload date:
  • Size: 335.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.10.93-1-MANJARO

File hashes

Hashes for nonebot-plugin-gocqhttp-0.2.2.tar.gz
Algorithm Hash digest
SHA256 96e72ac375291c2a1c85e5e7bfb2fb8df1b7188782841acc8932f119bda53c08
MD5 fd1f4809ccb63bbc0d640394d9277567
BLAKE2b-256 bdb4318cad9efcc34ec5890e64602b4666c48b4b0ca752a44fff8aa7bece86a9

See more details on using hashes here.

Provenance

File details

Details for the file nonebot_plugin_gocqhttp-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_gocqhttp-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 08c07d7575c0a65499efafcb5ae16856c950074e51c7720470cf290fd126ee04
MD5 3da0e9984da4f4a64b3568888bc66400
BLAKE2b-256 755656bbcf028809ef2061d2c8d5f0a50d0947dd7575325fc5fd967404f72a0a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page