From 8578c9b78749cbe3ce9a791ab69740b5b8085f8c Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Sat, 23 Oct 2021 14:08:21 +0800 Subject: [PATCH] update --- im/tg/tg.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/im/tg/tg.go b/im/tg/tg.go index 6dc6c93..e0e1c35 100644 --- a/im/tg/tg.go +++ b/im/tg/tg.go @@ -284,14 +284,13 @@ func (sender *Sender) Reply(msgs ...interface{}) (int, error) { } paths := []string{} for _, v := range regexp.MustCompile(`\[CQ:image,file=([^\[\]]+)\]`).FindAllStringSubmatch(message, -1) { - paths = append(paths, "data/images/"+v[1]) + paths = append(paths, v[1]) message = strings.Replace(message, fmt.Sprintf(`[CQ:image,file=%s]`, v[1]), "", -1) } if len(paths) > 0 { is := []tb.InputMedia{} for index, path := range paths { if strings.Contains(path, "base64") { - decodeBytes, _ := base64.StdEncoding.DecodeString(path) i := &tb.Photo{File: tb.FromReader(bytes.NewReader(decodeBytes))} if index == 0 { @@ -299,7 +298,7 @@ func (sender *Sender) Reply(msgs ...interface{}) (int, error) { } is = append(is, i) } else { - data, err := os.ReadFile(path) + data, err := os.ReadFile("data/images/" + path) if err == nil { url := regexp.MustCompile("(https.*)").FindString(string(data)) if url != "" {