Skip to content

Commit

Permalink
Test4 (#25)
Browse files Browse the repository at this point in the history
* Compiled main.go and pushed changes

* test

* 适配了频道私聊,用bolt数据库取代ini

* 适配了nonebot2

* add license

* add a lot

* trss support

* add action

* add action

* add action

* fixbug

* add wss

* bugfix

* fix action

* fix action again

* fa

* fix

* add a lot

* add ws server token

* bugifx

* fixat

* bugfix

* bugfix
  • Loading branch information
Hoshinonyaruko authored Oct 28, 2023
1 parent e4bc889 commit 8d387ce
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions handlers/message_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"path/filepath"
"regexp"
"runtime"
"strings"

"github.com/hoshinonyaruko/gensokyo/callapi"
Expand Down Expand Up @@ -117,8 +118,15 @@ func parseMessageContent(paramsMessage callapi.ParamsContent) (string, map[strin
}

// 正则表达式部分
localImagePattern := regexp.MustCompile(`\[CQ:image,file=file:///([^\]]+?)\]`)
urlImagePattern := regexp.MustCompile(`\[CQ:image,file=http://(.+)\]`)
var localImagePattern *regexp.Regexp

if runtime.GOOS == "windows" {
localImagePattern = regexp.MustCompile(`\[CQ:image,file=file:///([^\]]+?)\]`)
} else {
localImagePattern = regexp.MustCompile(`\[CQ:image,file=file://([^\]]+?)\]`)
}

urlImagePattern := regexp.MustCompile(`\[CQ:image,file=https?://(.+)\]`)
base64ImagePattern := regexp.MustCompile(`\[CQ:image,file=base64://(.+)\]`)
base64RecordPattern := regexp.MustCompile(`\[CQ:record,file=base64://(.+)\]`)

Expand Down

0 comments on commit 8d387ce

Please sign in to comment.