This commit is contained in:
cdle
2023-06-05 16:05:25 +08:00
parent dab997e54a
commit 0599f15f9e
6 changed files with 47750 additions and 1 deletions
+13
View File
@@ -7,6 +7,8 @@ import (
"regexp"
"strconv"
"strings"
"github.com/cdle/sillyplus/emoji"
)
type Strings struct {
@@ -159,3 +161,14 @@ func convertParams(params map[string]interface{}) map[string]string {
}
return result
}
func (sender *Strings) ReplaceEmojis(str string, f func([]string) string) string {
return emoji.ReplaceEmojisWithFunc(str, func(e emoji.Emoji) string {
return f(e.CodePoint2)
})
}
// `\[emoji=([0-9A-Z]{4})\]`
func (sender *Strings) ReplaceToEmojis(str string, pattern string) string {
return emoji.ReplaceToEmojis(str, pattern)
}