From 865f9f93223ad479b9cbc9d1e2ba4e03a1f45653 Mon Sep 17 00:00:00 2001 From: johlanse Date: Tue, 8 Nov 2022 20:28:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81qq=E6=8E=A8=E9=80=81=E4=B8=8E?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/config.go | 9 +++++---- push/qq.go | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/conf/config.go b/conf/config.go index 1c00bcc..ae3c171 100644 --- a/conf/config.go +++ b/conf/config.go @@ -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"` diff --git a/push/qq.go b/push/qq.go index 47a3106..326781e 100644 --- a/push/qq.go +++ b/push/qq.go @@ -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,