|
| 1 | +# QQ Chat Recorder |
| 2 | + |
| 3 | +**中文** | English (WIP) |
| 4 | + |
| 5 | +腾讯QQ客户端经常会吞掉我们的聊天记录,有可能几天前的群聊聊天记录都找不到了,而我也因此丢掉了一些重要的私聊信息,我十分不满,于是该项目应运而生。 |
| 6 | + |
| 7 | +## 安装 |
| 8 | + |
| 9 | +#### 下载项目源文件 |
| 10 | + |
| 11 | +```bash |
| 12 | +git clone https://github.com/NoNormalCreeper/QQ-chat-recorder.git |
| 13 | +cd QQ-chat-recorder |
| 14 | +``` |
| 15 | + |
| 16 | +#### 安装 `pip` 包 |
| 17 | + |
| 18 | +```bash |
| 19 | +pip install -r requirements.txt |
| 20 | +``` |
| 21 | + |
| 22 | +#### 配置 go-cqhttp |
| 23 | + |
| 24 | +在 [此处](https://github.com/Mrs4s/go-cqhttp/releases/) 下载最新的 release 版本。 |
| 25 | + |
| 26 | +首次启动 go-cqhttp,应有如下提示,输入 `23` 以创建正向、反向 Websocket 通信。 |
| 27 | + |
| 28 | +```plaintext |
| 29 | +未找到配置文件,正在为您生成配置文件中! |
| 30 | +请选择你需要的通信方式: |
| 31 | +> 0: HTTP通信 |
| 32 | +> 1: 云函数服务 |
| 33 | +> 2: 正向 Websocket 通信 |
| 34 | +> 3: 反向 Websocket 通信 |
| 35 | +请输入你需要的编号(0-9),可输入多个,同一编号也可输入多个(如: 233) |
| 36 | +您的选择是: |
| 37 | +``` |
| 38 | + |
| 39 | +输入 `23` 后,应有如下提示: |
| 40 | + |
| 41 | +```plaintext |
| 42 | +您的选择是:23 |
| 43 | +默认配置文件已生成,请修改 config.yml 后重新启动! |
| 44 | +``` |
| 45 | + |
| 46 | +修改 `config.yml` 中的账号、密码。 |
| 47 | + |
| 48 | +```yml |
| 49 | +account: # 账号相关 |
| 50 | + uin: 123345 # QQ账号 |
| 51 | + password: '' |
| 52 | +``` |
| 53 | +
|
| 54 | +修改 `config.yml` 中注释处的 Websocket 配置。 |
| 55 | + |
| 56 | +```yml |
| 57 | +servers: |
| 58 | + - ws: |
| 59 | + address: 127.0.0.1:8080 # 修改正向ws端口 |
| 60 | + middlewares: |
| 61 | + <<: *default |
| 62 | + - ws-reverse: |
| 63 | + universal: ws://localhost:8081 # 修改添加反向ws端口 |
| 64 | +``` |
| 65 | + |
| 66 | +使用如 screen, tmux 的工具在后台运行 go-cqhttp。 |
| 67 | + |
| 68 | +#### 配置 |
| 69 | + |
| 70 | +复制 `config-config.json` 到 `config.json`。 |
| 71 | + |
| 72 | +修改 `config.json` 中 `port-send` 字段为 go-cqhttp 中配置的正向ws端口,`port` 字段为 go-cqhttp 中配置的反向ws端口。 |
| 73 | + |
| 74 | +```json |
| 75 | +{ |
| 76 | + "general": {}, |
| 77 | + "ws": { |
| 78 | + "host": "localhost", |
| 79 | + "port-send": 9601, |
| 80 | + "port": 9602 |
| 81 | + } |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +## 用法 |
| 86 | + |
| 87 | +```bash |
| 88 | +python main.py [-h] {send,stop,start} ... |
| 89 | +``` |
| 90 | + |
| 91 | +### 帮助信息 |
| 92 | + |
| 93 | +```bash |
| 94 | +positional arguments: |
| 95 | + {send,stop,start} |
| 96 | + send Send a message to a user or group. |
| 97 | + stop Stop the recorder. |
| 98 | + start Start the recorder. |
| 99 | +
|
| 100 | +options: |
| 101 | + -h, --help show this help message and exit |
| 102 | +``` |
| 103 | + |
| 104 | +## 运行示例 |
| 105 | + |
| 106 | +#### 启动记录器 |
| 107 | + |
| 108 | +```bash |
| 109 | +python main.py |
| 110 | +``` |
| 111 | + |
| 112 | +### 发送一条私聊消息 |
| 113 | + |
| 114 | +给用户 `114514` 发送一条私聊消息以表示喜爱。 |
| 115 | + |
| 116 | +```bash |
| 117 | +python main.py send -u 114514 --message "[CQ:face,id=318] suki" |
| 118 | +``` |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | +返回如下提示: |
| 123 | + |
| 124 | +```plaintext |
| 125 | +2022-08-28 22:18:25.945 | INFO | src.log:write_log:16 - Response < |
| 126 | +{ |
| 127 | + "data": { |
| 128 | + "message_id": -207246359 |
| 129 | + }, |
| 130 | + "echo": "send_mannually_by_cmd_1661696305.9210277", |
| 131 | + "retcode": 0, |
| 132 | + "status": "ok" |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | +## 贡献 |
| 137 | + |
| 138 | +欢迎大家贡献代码、改进文档、寻找bug、提出新功能建议等。 |
| 139 | + |
| 140 | +## 关于 |
0 commit comments