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.0.tar.gz (332.3 kB view details)

Uploaded Source

Built Distribution

nonebot_plugin_gocqhttp-0.2.0-py3-none-any.whl (335.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot-plugin-gocqhttp-0.2.0.tar.gz
  • Upload date:
  • Size: 332.3 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.0.tar.gz
Algorithm Hash digest
SHA256 2361c53d553d55a29537e5af81b546515539c14b905feaefe7ddfcac8cc617c6
MD5 29f6eac4d9e61db5a8da178f89dbeea2
BLAKE2b-256 8cec933054c928abb67d7585a67db63bd924c187ac75430d0cf9b03cec2036f4

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_gocqhttp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2585cc3e7fac79b7cbb7541111a732de3cf805b2cb15c6d742b247b699574b2
MD5 3999116f104e781e45e6ef46bbfce871
BLAKE2b-256 e5734eaa0ad4b79463d3fa572c94b51198d0ed665ae6aa9c23a1744973de0304

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