fix(manager): 回应表情

This commit is contained in:
源文雨
2024-05-04 23:51:42 +09:00
parent d57d7a7abf
commit 2a820cfc54
5 changed files with 23 additions and 64 deletions

View File

@@ -195,55 +195,3 @@ var emojis = map[rune]int64{
127819: 20210521, // 🍋 lemon
127818: 20211115, // 🍊 tangerine orange
}
var qqface = map[int]rune{
0: 128558, // 😮 face exhaling
1: 128556, // 😬 grimacing face
2: 128525, // 😍 smiling face with heart-eyes
4: 128526, // 😎 smiling face with sunglasses
5: 128557, // 😭 loudly crying face
6: 129402, // 🥺 pleading face
7: 129296, // 🤐 zipper-mouth face
8: 128554, // 😪 sleepy face
11: 128545, // 😡 pouting face
12: 128539, // 😛 face with tongue
13: 128513, // 😁 beaming face with smiling eyes
14: 128578, // 🙂 slightly smiling face
15: 128577, // 🙁 slightly frowning face
16: 128526, // 😎 smiling face with sunglasses
19: 129326, // 🤮 face vomiting throw
20: 129325, // 🤭 face with hand over mouth embarrassed
21: 128522, // 😊 smiling face with smiling eyes
23: 128533, // 😕 confused face
24: 128523, // 😋 face savoring food
27: 128531, // 😓 downcast face with sweat
28: 128516, // 😄 grinning face with smiling eyes
31: 129324, // 🤬 face with symbols on mouth
32: 129300, // 🤔 thinking face question hmmm
33: 129323, // 🤫 shushing face quiet whisper
34: 128565, // 😵 face with crossed-out eyes
35: 128547, // 😣 persevering face
37: 128128, // 💀 skull
46: 128055, // 🐷 pig face
53: 127874, // 🎂 birthday cake
59: 128169, // 💩 pile of poo
60: 9749, // ☕ hot beverage coffee cup tea
63: 127801, // 🌹 rose flower
66: 10084, // ❤ mending heart
67: 128148, // 💔 broken heart
69: 127873, // 🎁 wrapped-gift
74: 127774, // 🌞 sun with face
75: 127772, // 🌜 last quarter moon face
96: 128517, // 😅 grinning face with sweat
104: 129393, // 🥱 yawning face
109: 128535, // 😗 kissing face
110: 128562, // 😲 astonished face
111: 129402, // 🥺 pleading face
172: 128539, // 😛 face with tongue
182: 128514, // 😂 face with tears of joy
187: 128123, // 👻 ghost
247: 128567, // 😷 face with medical mask
272: 128579, // 🙃 upside-down face
320: 129395, // 🥳 partying face
325: 128561, // 😱 face screaming in fear
}

View File

@@ -113,7 +113,7 @@ func face2emoji(face message.MessageSegment) rune {
if err != nil {
return 0
}
if r, ok := qqface[id]; ok {
if r, ok := message.Emoji[id]; ok {
return r
}
return 0

View File

@@ -407,8 +407,19 @@ func init() { // 插件主体
Handle(func(ctx *zero.Ctx) {
msgid := ctx.State["regex_matched"].([]string)[1]
face := ctx.State["regex_matched"].([]string)[2]
if len(face) > 0 {
_ = ctx.SetMessageEmojiLike(msgid, face)
if len(face) == 0 {
ctx.SendChain(message.Text("ERROR: 表情长度为 0"))
return
}
x := []rune(face)
if len(x) == 0 {
ctx.SendChain(message.Text("ERROR: 解析后表情长度为 0"))
return
}
err := ctx.SetMessageEmojiLike(msgid, x[0])
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
})
// 入群欢迎