Coder Social home page Coder Social logo

hcg-ace / nonebot-plugin-gocqhttp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mnixry/nonebot-plugin-gocqhttp

0.0 0.0 0.0 7.28 MB

一款在NoneBot2中直接运行go-cqhttp的插件, 无需额外下载安装 / A plugin to run go-cqhttp directly in NoneBot2, without additional download and installation.

License: GNU Affero General Public License v3.0

Python 29.25% JavaScript 8.49% Vue 22.22% TypeScript 37.53% Shell 1.27% SCSS 0.55% HTML 0.69%

nonebot-plugin-gocqhttp's Introduction

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: 数字, 是登录使用的客户端协议
    • config_extra: 配置文件拓展, 用于覆盖默认配置
      • 由于在每次程序启动时go-cqhttp启动配置文件都会被覆盖, 所以请在该项目中设置你要添加的配置项
        • 当直接填写 json 对象时, 原样传入并更新配置文件
        • 当传入以ref:开头的字符串时, 它将尝试读取之后目录中的文件, 来更改配置文件
        • 当传入以override:开头的字符串时, 它将尝试尝试读取之后目录中的文件, 来覆盖配置文件
    • device_extra: 和config_extra类似, 但是是用来覆盖device.json中配置的
  • 示例:

    [
      {
        "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/>.

nonebot-plugin-gocqhttp's People

Contributors

mnixry avatar dependabot[bot] avatar well2333 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.