From 6ea4bd829e055091afa07f4b66336a4a3700740e Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Fri, 18 Dec 2020 23:47:49 +0800 Subject: [PATCH] fix issue of get_msg image url empty. #503 --- coolq/cqcode.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coolq/cqcode.go b/coolq/cqcode.go index 50fbd54..f7d04e2 100644 --- a/coolq/cqcode.go +++ b/coolq/cqcode.go @@ -10,6 +10,7 @@ import ( "fmt" "io/ioutil" "math" + "math/rand" "net/url" "path" "runtime" @@ -871,7 +872,7 @@ func (bot *CQBot) makeImageElem(d map[string]string, group bool) (message.IMessa return nil, errors.New("invalid hash") } if group { - rsp, err := bot.Client.QueryGroupImage(1, hash, size) + rsp, err := bot.Client.QueryGroupImage(int64(rand.Uint32()), hash, size) if err != nil { if url != "" { return bot.makeImageElem(map[string]string{"file": url}, group) @@ -880,7 +881,7 @@ func (bot *CQBot) makeImageElem(d map[string]string, group bool) (message.IMessa } return rsp, nil } - rsp, err := bot.Client.QueryFriendImage(1, hash, size) + rsp, err := bot.Client.QueryFriendImage(int64(rand.Uint32()), hash, size) if err != nil { if url != "" { return bot.makeImageElem(map[string]string{"file": url}, group)