This commit is contained in:
cdle
2021-10-26 06:56:08 +08:00
parent b0096e86c1
commit 4c638e2c2d
2 changed files with 15 additions and 5 deletions
+5
View File
@@ -42,4 +42,9 @@ func init() {
initSys()
Duration = time.Duration(sillyGirl.GetInt("duration", 5)) * time.Second
sillyGirl.Set("started_at", time.Now().Format("2006-01-02 15:04:05"))
api_key := sillyGirl.Get("api_key")
if api_key == "" {
api_key := time.Now().UnixNano()
sillyGirl.Set("api_key", api_key)
}
}
+10 -5
View File
@@ -9,6 +9,7 @@ import (
"os"
"regexp"
"strings"
"sync"
"github.com/axgle/mahonia"
"github.com/beego/beego/v2/adapter/httplib"
@@ -169,6 +170,8 @@ func init() {
})
}
var wxbase sync.Map
var myip = ""
var relaier = wx.Get("relaier")
@@ -259,12 +262,14 @@ func (sender *Sender) Reply(msgs ...interface{}) (int, error) {
switch item.(type) {
case string:
pmsg.Msg = item.(string)
// images := []string{}
// for _, v := range regexp.MustCompile(`\[CQ:image,file=base64://([^\[\]]+)\]`).FindAllStringSubmatch(pmsg.Msg, -1) {
// images = append(images, v[1])
// message = strings.Replace(message, fmt.Sprintf(`[CQ:image,file=base64://%s]`, v[1]), "", -1)
images := []string{}
for _, v := range regexp.MustCompile(`\[CQ:image,file=base64://([^\[\]]+)\]`).FindAllStringSubmatch(pmsg.Msg, -1) {
images = append(images, v[1])
pmsg.Msg = strings.Replace(pmsg.Msg, fmt.Sprintf(`[CQ:image,file=base64://%s]`, v[1]), "", -1)
}
// for _, image := range images {
// wxbase
// }
// if
case []byte:
pmsg.Msg = string(item.([]byte))
case core.ImageUrl: