- 此项目用go-cqhttp作为前端, python3作为后端, 搭建的QQ机器人
- 核心代码集中放在
fnbot
文件夹中, 方便导入使用(pip install fnbot
) - 插件代码集中放在
plugins
文件夹中, 方便管理
使用chatgpt解析本项目, 如果有问题那就怪chatgpt
-
启动后注意选择
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 时立即
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群号
python main.py
-
新建配置文件
config.toml
或config.json
替代pybot.toml
或pybot.json
-
新建
bot.py
文件代替main.py
apt install python3
apt install git
- 可手动可命令两种方式下载, 这里选择命令的方式
- 这里以
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-chroot
避免这个bug
termux-chroot
./go-cqhttp
- 修改的配置信息和上面在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
- []
- [×] ......
- [√] ......