支持qq推送与交互

This commit is contained in:
johlanse 2022-11-08 20:28:37 +08:00
parent ffff6a9992
commit 865f9f9322
2 changed files with 7 additions and 6 deletions

View File

@ -50,10 +50,11 @@ type Config struct {
CommonUser map[string]string `json:"common_user" yaml:"common_user" mapstructure:"common_user"`
} `json:"web" yaml:"web" mapstructure:"web"`
QQ struct {
Enable bool `json:"enable" mapstructure:"enable"`
PostAddr string `json:"post_addr" mapstructure:"post_addr"`
SuperUser int64 `json:"super_user" mapstructure:"super_user"`
WhiteList []int64 `json:"white_list" mapstructure:"white_list"`
Enable bool `json:"enable" mapstructure:"enable"`
PostAddr string `json:"post_addr" mapstructure:"post_addr"`
SuperUser int64 `json:"super_user" mapstructure:"super_user"`
WhiteList []int64 `json:"white_list" mapstructure:"white_list"`
AccessToken string `json:"access_token" mapstructure:"access_token"`
}
Cron string `json:"cron" yaml:"cron" mapstructure:"cron"`
CronRandomWait int `json:"cron_random_wait" yaml:"cron_random_wait" mapstructure:"cron_random_wait"`

View File

@ -289,7 +289,7 @@ func (e *Event) sendGroupMsg(groupId int64, message any) int {
},
}
}
response, err := utils.GetClient().R().SetBodyJsonMarshal(map[string]any{
response, err := utils.GetClient().R().SetHeader("Authorization", conf.GetConfig().QQ.AccessToken).SetBodyJsonMarshal(map[string]any{
"action": "send_group_msg",
"params": map[string]any{
"group_id": groupId,
@ -319,7 +319,7 @@ func (e *Event) sendPrivateMsg(userId int64, message any) int {
},
}
}
response, err := utils.GetClient().R().SetBodyJsonMarshal(map[string]any{
response, err := utils.GetClient().R().SetHeader("Authorization", conf.GetConfig().QQ.AccessToken).SetBodyJsonMarshal(map[string]any{
"action": "send_private_msg",
"params": map[string]any{
"user_id": userId,