Skip to content

Commit 591b1ad

Browse files
committed
fix: heisi image name
1 parent 8ecaebb commit 591b1ad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugin/heisi/heisi.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package heisi
44
import (
55
"math/rand"
66
"strconv"
7+
"strings"
78
"unsafe"
89

910
rei "github.com/fumiama/ReiBot"
@@ -105,18 +106,20 @@ func init() { // 插件主体
105106
case "网红":
106107
pic = mcnPic[i]
107108
}
108-
data, err := web.RequestDataWith(web.NewTLS12Client(), pic.String(), "GET", "http://hs.heisiwu.com/", web.RandUA(), nil)
109+
u := pic.String()
110+
data, err := web.RequestDataWith(web.NewTLS12Client(), u, "GET", "http://hs.heisiwu.com/", web.RandUA(), nil)
109111
if err != nil {
110112
_, _ = ctx.Caller.Send(tgba.NewCallbackWithAlert(ctx.Value.(*tgba.CallbackQuery).ID, "ERROR: "+err.Error()))
111113
return
112114
}
115+
name := ctx.State["regex_matched"].([]string)[1] + strconv.Itoa(i) + u[strings.LastIndex(u, "."):]
113116
_, err = ctx.Caller.Send(&tgba.DocumentConfig{
114117
BaseFile: tgba.BaseFile{
115118
BaseChat: tgba.BaseChat{
116119
ChatID: ctx.Message.Chat.ID,
117120
ReplyToMessageID: ctx.Message.MessageID,
118121
},
119-
File: tgba.FileBytes{Bytes: data},
122+
File: tgba.FileBytes{Name: name, Bytes: data},
120123
},
121124
})
122125
if err != nil {

0 commit comments

Comments
 (0)