This commit is contained in:
cdle
2021-10-07 08:45:54 +08:00
parent cb6a769986
commit 7bd3eb46a2
+15 -8
View File
@@ -64,6 +64,7 @@ func init() {
paths = append(paths, core.ExecPath+"/data/images/"+v[1])
s = strings.Replace(s, fmt.Sprintf(`[CQ:image,file=%s]`, v[1]), "", -1)
}
s = regexp.MustCompile(`\[CQ:([^\[\]]+)\]`).ReplaceAllString(s, "")
{
t := []string{}
for _, v := range strings.Split(s, "\n") {
@@ -80,14 +81,19 @@ func init() {
if err == nil {
url := regexp.MustCompile("(https.*)").FindString(string(data))
if url != "" {
rsp, err := httplib.Get(url).Response()
if err == nil {
i := &tb.Photo{File: tb.FromReader(rsp.Body)}
if index == 0 {
i.Caption = s
}
is = append(is, i)
// rsp, err := httplib.Get(url).Response()
// if err == nil {
// i := &tb.Photo{File: tb.FromReader(rsp.Body)}
// if index == 0 {
// i.Caption = s
// }
// is = append(is, i)
// }
i := &tb.Photo{File: tb.FromURL(url)}
if index == 0 {
i.Caption = s
}
is = append(is, i)
}
}
}
@@ -97,7 +103,8 @@ func init() {
b.Send(ct, s)
}
b.Handle(tb.OnPhoto, func(m *tb.Message) {
b.Send(m.Chat, m.Caption+" "+m.AlbumID)
// m.
// b.Send(m.Chat, m.Caption+" "+m.AlbumID)
// b.Download()
// b.Download(&m.Photo.File,"")