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

便于部署: 部署时只需启动一个 Bot 进程即可, 无需其他附加工具

易于使用: 本插件提供一个简单的 WebUI, 可以直接在图形界面中添加账户:

添加帐号 控制进程
查看状态 还有更多...
如果你觉得这个插件很赞, 欢迎返图!

跨平台支持: 根据反馈, 本插件已可以在MacOS/Linux/Windows上运行, 且不受异步子进程调用带来的限制

使用

安装

推荐使用nb-cli进行安装

要求最低 Python 版本为 3.8

配置

本项目提供以下可选配置项, 请在.env中自行进行配置

如果想要获取更多配置文件相关信息, 请阅读源代码

账号配置

GOCQ_ACCOUNTS: 要登录的 QQ 账号列表, 为一个 json 数组

  • 支持的字段:

    • uin: QQ 账号 (必填)
    • password: QQ 密码, 不填将使用扫码登录
    • protocol: 数字, 是登录使用的客户端协议
  • 示例:

    [
      {
        "uin": "QQ帐号",
        "password": "密码"
      }
    ]
    

下载地址配置

GOCQ_URL: 下载 URL, 默认为空, 设置该项目后以下几个与下载有关的配置项目将失效

GOCQ_DOWNLOAD_DOMAIN: 下载域名, 默认为download.fastgit.org

GOCQ_REPO: 要下载的仓库, 默认为Mrs4s/gocqhttp

GOCQ_VERSION: 要下载的版本, 默认为空, 即下载最新版本

GOCQ_FORCE_DOWNLOAD: 强制在启动时下载, 默认为 false

其他配置

GOCQ_PROCESS_KWARGS: 创建进程时的可选参数, 请参照代码进行修改

GOCQ_WEBUI_USERNAME/GOCQ_WEBUI_PASSWORD: WebUI 的登录凭证, 不设置即不进行验证

开始使用

配置好了以后启动你的 Bot 即可

  • 需要注意以下几点:

    • 本插件会在 Bot 工作目录下创建accounts文件夹用于存储go-cqhttp的二进制和账户数据文件, 如果你使用版本管理工具(如git), 请自行将该文件夹加入忽略列表

    • 本插件通过子进程调用实现, 如果你在外部通过手段强行终止了 Bot 进程, 请检查开启的子进程是否也同样已终止

    • 如果你的 Bot 监听来自所有主机的连接(比如监听了0.0.0.0), 或者它向公网开放, 强烈建议设置 WebUI 登录凭证以防止被未授权访问

  • 本插件提供了一个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.5.0.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

nonebot_plugin_gocqhttp-0.5.0-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot-plugin-gocqhttp-0.5.0.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.15.32-1-MANJARO

File hashes

Hashes for nonebot-plugin-gocqhttp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fb6d8f86f3b3cd2865d1564209cc0e7994ad6c2ca2e03c7cd0c5ae11a046b5de
MD5 82e747a1cc5f210e008d6a97eca726f9
BLAKE2b-256 c65ec6253f8fd958dff2215c8f4afffb94a99bb0a6cf1b379d3dfeff85bce792

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_gocqhttp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 203f378ab424098352b36a331533300f7cb4eb1ce391dfe39104f53294a09eba
MD5 fc95cdf2c2ab788b556c6a5bc6bc999f
BLAKE2b-256 66bf789dd658b4512d5aa79eb84e5a9fb8c55e8b3a5a7d6825ecda59633d584f

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