1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-06 03:53:50 +08:00

fix issue of get_msg image url empty. #503

This commit is contained in:
Mrs4s 2020-12-18 23:47:49 +08:00
parent 6e3501a6f8
commit 6ea4bd829e

View File

@ -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)