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

Uploaded Source

Built Distribution

nonebot_plugin_gocqhttp-0.3.0-py3-none-any.whl (342.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nonebot-plugin-gocqhttp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 eff112fc9ff7c07763dc59490859be5f243c773f9b976731db0cba4c040c1fef
MD5 4fa52c2b2343288fece4b665ff3150af
BLAKE2b-256 f0a27aeacdf7b7635e75ef4ce350fdbe39768ace3a0b26c77cd7b25c929b0c46

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_gocqhttp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd4fc990ca00d7cb8aa615b149393b8e4520d81b31b576911649368a3f8d5f09
MD5 bcee48125c5f1f0a4a8033338eb1a2b4
BLAKE2b-256 a5d802b652c6a7251af4d8aaa12d988222875ac1d10981e2db50615b7d47e159

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