Skip to content

tsukinene33/yoshino-bot

Repository files navigation

ともたけ よしの bot


🌱 This project is based on the go-cqhttp and fnbot development of QQ entertainment robot 🌱

语言 | Language: 🇨🇳 EN

Quick Start

  • 此项目用go-cqhttp作为前端, python3作为后端, 搭建的QQ机器人
  • 核心代码集中放在fnbot文件夹中, 方便导入使用(pip install fnbot)
  • 插件代码集中放在plugins文件夹中, 方便管理

Chatgpt Analysis Report

使用chatgpt解析本项目, 如果有问题那就怪chatgpt

for Windows

下载go-cqhttp

  • 启动后注意选择0: HTTP通信

  • 如果第一次使用, 可以先看看官方文档(点我)

  • 修改生成的config.yml

    需要修改的内容
    account: # 账号相关
      uin: 123456789 # QQ账号
      password: '' # 密码为空时使用扫码登录

    and

    # 连接服务列表
    servers:
      # 添加方式,同一连接方式可添加多个,具体配置说明请查看文档
      #- http: # http 通信
      #- ws:   # 正向 Websocket
      #- ws-reverse: # 反向 Websocket
      #- pprof: #性能分析服务器
    
      - http: # HTTP 通信设置
          address: 127.0.0.1:9900 # HTTP监听地址
          timeout: 5      # 反向 HTTP 超时时间, 单位秒,<5 时将被忽略
          long-polling:   # 长轮询拓展
            enabled: false       # 是否开启
            max-queue-size: 2000 # 消息队列大小,0 表示不限制队列大小,谨慎使用
          middlewares:
            <<: *default # 引用默认中间件
          post:           # 反向HTTP POST地址列表
          #- url: ''                # 地址
          #  secret: ''             # 密钥
          #  max-retries: 3         # 最大重试,0 时禁用
          #  retries-interval: 1500 # 重试时间,单位毫秒,0 时立即
            - url: http://127.0.0.1:9901/ # 地址
              secret: ''                  # 密钥
              max-retries: 10             # 最大重试,0 时禁用
              retries-interval: 1000      # 重试时间,单位毫秒,0 时立即

下载和配置python代码

cd qqbot
git clone https://github.com/Co1Li1La1/yoshino-bot
cd yoshino-bot
python -m pip install -r requirements.txt
  • 临时换源
python -m pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
  • 修改pybot.toml

    需要修改的内容
    host = "127.0.0.1"
    port = 9900 # 对应gocq的config.yml中的 address: 127.0.0.1:9900
    post = 9901 # 对应gocq的config.yml中的 - url: http://127.0.0.1:9901/
    bot_qq = 123456789 # qq账号
    group_list = [123456,1234567] # 需要添加的qq群号

最后运行main.py

python main.py

建议

  • 新建配置文件config.tomlconfig.json替代pybot.tomlpybot.json

  • 新建bot.py文件代替main.py


for Linux

预先安装python3和git(可跳过)

apt install python3
apt install git

下载gocq

  • 可手动可命令两种方式下载, 这里选择命令的方式
  • 这里以arm架构为例
mkdir qqbot
cd qqbot
mkdir gocq
cd gocq
wget https://github.com/Mrs4s/go-cqhttp/releases/download/v1.0.0-rc5/go-cqhttp_linux_arm64.tar.gz
tar -xvf go-cqhttp_linux_arm64.tar.gz
./go-cqhttp
  • 选择0: HTTP通信

  • 修改的配置信息和上面在windows配置的一样

也可以使用别的修改, 这里以vim为例

vim config.yml这条命令执行完后, 会进入新的界面

输入i键后进入编辑模式, 点esc键退出编辑模式

h左移光标, j下移光标, k上移光标, l右移光标

如果需要退出并保存, 点esc后, 依次输入:, w, q, 回车

如果:wq退出保存不了, 使用:wq!强制退出并保存

vim config.yml
./go-cqhtttp

注意,如果使用的是termux, 最新版本的gocq会出点小问题

  • 可使用termux-chroot避免这个bug
termux-chroot
./go-cqhttp

下载和配置python代码

  • 修改的配置信息和上面在windows配置的一样
cd qqbot
git clone https://github.com/Co1Li1La1/yoshino-bot yoshino-bot
cd yoshino-bot
python -m pip install -r requirements.txt

临时换源

python -m pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
vim pybot.toml
python3 main.py

unfinished to be continued

......

TODO

  • []
  • [×] ......
  • [√] ......

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages