mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 12:03:50 +08:00
fix issue of get_msg image url empty. #503
This commit is contained in:
parent
6e3501a6f8
commit
6ea4bd829e
@ -10,6 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
|
"math/rand"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -871,7 +872,7 @@ func (bot *CQBot) makeImageElem(d map[string]string, group bool) (message.IMessa
|
|||||||
return nil, errors.New("invalid hash")
|
return nil, errors.New("invalid hash")
|
||||||
}
|
}
|
||||||
if group {
|
if group {
|
||||||
rsp, err := bot.Client.QueryGroupImage(1, hash, size)
|
rsp, err := bot.Client.QueryGroupImage(int64(rand.Uint32()), hash, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if url != "" {
|
if url != "" {
|
||||||
return bot.makeImageElem(map[string]string{"file": url}, group)
|
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
|
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 err != nil {
|
||||||
if url != "" {
|
if url != "" {
|
||||||
return bot.makeImageElem(map[string]string{"file": url}, group)
|
return bot.makeImageElem(map[string]string{"file": url}, group)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user