支持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

@ -54,6 +54,7 @@ type Config struct {
PostAddr string `json:"post_addr" mapstructure:"post_addr"` PostAddr string `json:"post_addr" mapstructure:"post_addr"`
SuperUser int64 `json:"super_user" mapstructure:"super_user"` SuperUser int64 `json:"super_user" mapstructure:"super_user"`
WhiteList []int64 `json:"white_list" mapstructure:"white_list"` WhiteList []int64 `json:"white_list" mapstructure:"white_list"`
AccessToken string `json:"access_token" mapstructure:"access_token"`
} }
Cron string `json:"cron" yaml:"cron" mapstructure:"cron"` Cron string `json:"cron" yaml:"cron" mapstructure:"cron"`
CronRandomWait int `json:"cron_random_wait" yaml:"cron_random_wait" mapstructure:"cron_random_wait"` 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", "action": "send_group_msg",
"params": map[string]any{ "params": map[string]any{
"group_id": groupId, "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", "action": "send_private_msg",
"params": map[string]any{ "params": map[string]any{
"user_id": userId, "user_id": userId,