1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

feat enable_self_message config.

This commit is contained in:
Mrs4s 2021-03-03 19:14:24 +08:00
parent 93da16897a
commit a90af94eda
3 changed files with 55 additions and 47 deletions

View File

@ -61,7 +61,9 @@ func NewQQBot(cli *client.QQClient, conf *global.JSONConfig) *CQBot {
} }
bot.Client.OnPrivateMessage(bot.privateMessageEvent) bot.Client.OnPrivateMessage(bot.privateMessageEvent)
bot.Client.OnGroupMessage(bot.groupMessageEvent) bot.Client.OnGroupMessage(bot.groupMessageEvent)
if conf.EnableSelfMessage {
bot.Client.OnSelfGroupMessage(bot.groupMessageEvent) bot.Client.OnSelfGroupMessage(bot.groupMessageEvent)
}
bot.Client.OnTempMessage(bot.tempMessageEvent) bot.Client.OnTempMessage(bot.tempMessageEvent)
bot.Client.OnGroupMuted(bot.groupMutedEvent) bot.Client.OnGroupMuted(bot.groupMutedEvent)
bot.Client.OnGroupMessageRecalled(bot.groupRecallEvent) bot.Client.OnGroupMessageRecalled(bot.groupRecallEvent)

View File

@ -21,6 +21,7 @@ go-cqhttp 支持导入CQHTTP的配置文件, 具体步骤为:
"encrypt_password": false, "encrypt_password": false,
"password_encrypted": "", "password_encrypted": "",
"enable_db": true, "enable_db": true,
"enable_self_message": false,
"access_token": "", "access_token": "",
"relogin": { "relogin": {
"enabled": true, "enabled": true,
@ -42,7 +43,9 @@ go-cqhttp 支持导入CQHTTP的配置文件, 具体步骤为:
"host": "0.0.0.0", "host": "0.0.0.0",
"port": 5700, "port": 5700,
"timeout": 5, "timeout": 5,
"post_urls": {"url:port": "secret"} "post_urls": {
"url:port": "secret"
}
}, },
"ws_config": { "ws_config": {
"enabled": true, "enabled": true,
@ -68,6 +71,7 @@ go-cqhttp 支持导入CQHTTP的配置文件, 具体步骤为:
| encrypt_password | bool | 是否对密码进行加密. | | encrypt_password | bool | 是否对密码进行加密. |
| password_encrypted | string | 加密后的密码(请勿修改) | | password_encrypted | string | 加密后的密码(请勿修改) |
| enable_db | bool | 是否开启内置数据库, 关闭后将无法使用 **回复/撤回** 等上下文相关接口 | | enable_db | bool | 是否开启内置数据库, 关闭后将无法使用 **回复/撤回** 等上下文相关接口 |
| enable_self_message | bool | 是否启用 `message_sent` 事件 |
| access_token | string | 同CQHTTP的 `access_token` 用于身份验证 | | access_token | string | 同CQHTTP的 `access_token` 用于身份验证 |
| relogin | bool | 是否自动重新登录 | | relogin | bool | 是否自动重新登录 |
| relogin_delay | int | 重登录延时(秒) | | relogin_delay | int | 重登录延时(秒) |
@ -127,6 +131,7 @@ go-cqhttp 支持导入CQHTTP的配置文件, 具体步骤为:
将文件 `address.txt` 创建到 `go-cqhttp` 工作目录, 并键入 `IP:PORT` 以换行符为分割即可. 将文件 `address.txt` 创建到 `go-cqhttp` 工作目录, 并键入 `IP:PORT` 以换行符为分割即可.
示例: 示例:
```` ````
1.1.1.1:53 1.1.1.1:53
1.1.2.2:8899 1.1.2.2:8899

View File

@ -145,6 +145,7 @@ type JSONConfig struct {
EncryptPassword bool `json:"encrypt_password"` EncryptPassword bool `json:"encrypt_password"`
PasswordEncrypted string `json:"password_encrypted"` PasswordEncrypted string `json:"password_encrypted"`
EnableDB bool `json:"enable_db"` EnableDB bool `json:"enable_db"`
EnableSelfMessage bool `json:"enable_self_message"`
AccessToken string `json:"access_token"` AccessToken string `json:"access_token"`
ReLogin struct { ReLogin struct {
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`