update
This commit is contained in:
+15
-8
@@ -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,"")
|
||||
|
||||
Reference in New Issue
Block a user