From 4c1642dc1d12bf35bc4b43273138210319b615ae Mon Sep 17 00:00:00 2001 From: Kanri Date: Sat, 12 Feb 2022 00:04:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=20emojimix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 + main.go | 2 + plugin_emojimix/emoji.go | 198 +++++++++++++++++++++++++++++++++++++++ plugin_emojimix/mix.go | 59 ++++++++++++ 4 files changed, 261 insertions(+) create mode 100644 plugin_emojimix/emoji.go create mode 100644 plugin_emojimix/mix.go diff --git a/README.md b/README.md index 67ea82e720..1eb01ec461 100644 --- a/README.md +++ b/README.md @@ -247,6 +247,8 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地 - [x] 讲个笑话[@xxx] | 讲个笑话[qq号] - **抽象话** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_chouxianghua"` - [x] 抽象翻译[xxx] +- **抽象话** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_emojimix"` + - [x] [emoji][emoji] - **绝绝子** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_juejuezi"` - [x] 喝奶茶绝绝子 | 绝绝子吃饭 - **藏头诗** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_cangtoushi"` diff --git a/main.go b/main.go index ce1f0c0ce4..90e9b4fe52 100644 --- a/main.go +++ b/main.go @@ -118,6 +118,8 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_reply" // 人工智能回复 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_emojimix" // 合成emoji + // ^^^^ // // ^^^^^^^^^^^^^^ // // ^^^^^^^低优先级区^^^^^^^ // diff --git a/plugin_emojimix/emoji.go b/plugin_emojimix/emoji.go new file mode 100644 index 0000000000..8486a8a63e --- /dev/null +++ b/plugin_emojimix/emoji.go @@ -0,0 +1,198 @@ +package emojimix + +var emojis = map[string]int64{ + "😄": 20201001, // grinning face with smiling eyes + "😀": 20201001, // grinning face + "🙂": 20201001, // slightly smiling face + "🙃": 20201001, // upside-down face + "😉": 20201001, // winking face + "😊": 20201001, // smiling face with smiling eyes + "😆": 20201001, // grinning squinting face + "😃": 20201001, // grinning face with big eyes + "😁": 20201001, // beaming face with smiling eyes + "🤣": 20201001, // rolling on the floor laughing + "😅": 20201001, // grinning face with sweat + "😂": 20201001, // face with tears of joy + "😇": 20201001, // smiling face with halo + "🥰": 20201001, // smiling face with hearts + "😍": 20201001, // smiling face with heart-eyes + "😘": 20201001, // face blowing a kiss + "🤩": 20201001, // star-struck + "😗": 20201001, // kissing face + "😚": 20201001, // kissing face with closed eyes + "😙": 20201001, // kissing face with smiling eyes + "😛": 20201001, // face with tongue + "😝": 20201001, // squinting face with tongue + "😋": 20201001, // face savoring food + "🥲": 20201001, // smiling face with tear + "🤑": 20201001, // money-mouth face + "😜": 20201001, // winking face with tongue + "🤗": 20201001, // smiling face with open hands hugs + "🤫": 20201001, // shushing face quiet whisper + "🤔": 20201001, // thinking face question hmmm + "🤭": 20201001, // face with hand over mouth embarrassed + "🤨": 20201001, // face with raised eyebrow question + "🤐": 20201001, // zipper-mouth face + "😐": 20201001, // neutral face + "😑": 20201001, // expressionless face + "😶": 20201001, // face without mouth + "🤪": 20201001, // zany face + "😶‍🌫️": 20210218, // face in clouds + "😏": 20201001, // smirking face suspicious + "😒": 20201001, // unamused face + "🙄": 20201001, // face with rolling eyes + "😬": 20201001, // grimacing face + "😮‍💨": 20210218, // face exhaling + "🤥": 20201001, // lying face + "😌": 20201001, // relieved face + "😔": 20201001, // pensive face + "😪": 20201001, // sleepy face + "🤤": 20201001, // drooling face + "😴": 20201001, // sleeping face + "😷": 20201001, // face with medical mask + "🤒": 20201001, // face with thermometer + "🤕": 20201001, // face with head-bandage + "🤢": 20201001, // nauseated face + "🤮": 20201001, // face vomiting throw + "🤧": 20201001, // sneezing face + "🥵": 20201001, // hot face warm + "🥶": 20201001, // cold face freezing ice + "😵": 20201001, // face with crossed-out eyes + "🥴": 20201001, // woozy face drunk tipsy drug high + "🤯": 20201001, // exploding head mindblow + "🤠": 20201001, // cowboy hat face + "🥳": 20201001, // partying face + "🥸": 20201001, // disguised face + "🧐": 20201001, // face with monocle glasses + "😎": 20201001, // smiling face with sunglasses + "😕": 20201001, // confused face + "😟": 20201001, // worried face + "🙁": 20201001, // slightly frowning face + "😮": 20201001, // face with open mouth + "😯": 20201001, // hushed face + "😲": 20201001, // astonished face + "🤓": 20201001, // nerd face glasses + "😳": 20201001, // flushed face + "🥺": 20201001, // pleading face + "😧": 20201001, // anguished face + "😨": 20201001, // fearful face + "😦": 20201001, // frowning face with open mouth + "😰": 20201001, // anxious face with sweat + "😥": 20201001, // sad but relieved face + "😭": 20201001, // loudly crying face + "😩": 20201001, // weary face + "😢": 20201001, // crying face + "😣": 20201001, // persevering face + "😠": 20201001, // angry face + "😓": 20201001, // downcast face with sweat + "😖": 20201001, // confounded face + "🤬": 20201001, // face with symbols on mouth + "😞": 20201001, // disappointed face + "😫": 20201001, // tired face + "😤": 20201001, // face with steam from nose + "🥱": 20201001, // yawning face + "💩": 20201001, // pile of poo + "😡": 20201001, // pouting face + "😱": 20201001, // face screaming in fear + "👿": 20201001, // angry face with horns + "💀": 20201001, // skull + "👽": 20201001, // alien + "😈": 20201001, // smiling face with horns devil + "🤡": 20201001, // clown face + "👻": 20201001, // ghost + "🤖": 20201001, // robot + "💯": 20201001, // hundred points percent + "👀": 20201001, // eyes + "🌹": 20201001, // rose flower + "🌼": 20201001, // blossom flower + "🌷": 20201001, // tulip flower + "🌵": 20201001, // cactus + "🍍": 20201001, // pineapple + "🎂": 20201001, // birthday cake + "🌇": 20210831, // sunset + "🧁": 20201001, // cupcake muffin + "🎧": 20210521, // headphone earphone + "🌸": 20210218, // cherry blossom flower + "🦠": 20201001, // microbe germ bacteria virus covid corona + "💐": 20201001, // bouquet flowers + "🌭": 20201001, // hot dog food + "💋": 20201001, // kiss mark lips + "🎃": 20201001, // jack-o-lantern pumpkin + "🧀": 20201001, // cheese wedge + "☕": 20201001, // hot beverage coffee cup tea + "🎊": 20201001, // confetti ball + "🎈": 20201001, // balloon + "⛄": 20201001, // snowman without snow + "💎": 20201001, // gem stone crystal diamond + "🌲": 20201001, // evergreen tree + "🦂": 20210218, // scorpion + "🙈": 20201001, // see-no-evil monkey + "💔": 20201001, // broken heart + "💌": 20201001, // love letter heart + "💘": 20201001, // heart with arrow + "💟": 20201001, // heart decoration + "💞": 20201001, // revolving hearts + "💓": 20201001, // beating heart + "💕": 20201001, // two hearts + "💗": 20201001, // growing heart + "🧡": 20201001, // orange heart + "💛": 20201001, // yellow heart + "❤️‍🩹": 20210218, // mending heart + "💜": 20201001, // purple heart + "💚": 20201001, // green heart + "💙": 20201001, // blue heart + "🤎": 20201001, // brown heart + "🤍": 20201001, // white heart + "🖤": 20201001, // black heart + "💖": 20201001, // sparkling heart + "💝": 20201001, // heart with ribbon + "🎁": 20211115, // wrapped-gift + "🪵": 20211115, // wood + "🏆": 20211115, // trophy + "🍞": 20210831, // bread + "📰": 20201001, // newspaper + "🔮": 20201001, // crystal ball + "👑": 20201001, // crown + "🐷": 20201001, // pig face + "🦄": 20210831, // unicorn + "🌛": 20201001, // first quarter moon face + "🦌": 20201001, // deer + "🪄": 20210521, // magic wand + "💫": 20201001, // dizzy + "🐱": 20201001, // meow cat face + "🦁": 20201001, // lion + "🔥": 20201001, // fire + "🐦": 20210831, // bird + "🦇": 20201001, // bat + "🦉": 20210831, // owl + "🌈": 20201001, // rainbow + "🐵": 20201001, // monkey face + "🐝": 20201001, // honeybee bumblebee wasp + "🐢": 20201001, // turtle + "🐙": 20201001, // octopus + "🦙": 20201001, // llama alpaca + "🐐": 20210831, // goat + "🐼": 20201001, // panda + "🐨": 20201001, // koala + "🦥": 20201001, // sloth + "🐻": 20210831, // bear + "🐰": 20201001, // rabbit face + "🦔": 20201001, // hedgehog + "🐶": 20211115, // dog puppy + "🐩": 20211115, // poodle dog + "🦝": 20211115, // raccoon + "🐧": 20211115, // penguin + "🐌": 20210218, // snail + "🐭": 20201001, // mouse face rat + "🐟": 20210831, // fish + "🌍": 20201001, // globe showing Europe-Africa + "🌞": 20201001, // sun with face + "🌟": 20201001, // glowing star + "⭐": 20201001, // star + "🌜": 20201001, // last quarter moon face + "🥑": 20201001, // avocado + "🍌": 20211115, // banana + "🍓": 20210831, // strawberry + "🍋": 20210521, // lemon + "🍊": 20211115, // tangerine orange +} diff --git a/plugin_emojimix/mix.go b/plugin_emojimix/mix.go new file mode 100644 index 0000000000..cf6bc84acc --- /dev/null +++ b/plugin_emojimix/mix.go @@ -0,0 +1,59 @@ +package emojimix + +import ( + "fmt" + "net/http" + + "github.com/FloatTech/zbputils/control" + "github.com/FloatTech/zbputils/control/order" + "github.com/FloatTech/zbputils/ctxext" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) + +func init() { + control.Register("emojimix", order.AcquirePrio(), &control.Options{ + DisableOnDefault: false, + Help: "合成emoji\n" + + "- [emoji][emoji]", + }).OnMessage(match(emojis)).SetBlock(true).Limit(ctxext.LimitByUser). + Handle(func(ctx *zero.Ctx) { + r := []rune(ctx.Event.RawMessage) + e1 := string(r[0]) + e2 := string(r[1]) + u1 := fmt.Sprintf("https://www.gstatic.com/android/keyboard/emojikitchen/%d/u%x/u%x_u%x.png", emojis[e1], []rune(e1)[0], []rune(e1)[0], []rune(e2)[0]) + u2 := fmt.Sprintf("https://www.gstatic.com/android/keyboard/emojikitchen/%d/u%x/u%x_u%x.png", emojis[e2], []rune(e2)[0], []rune(e2)[0], []rune(e1)[0]) + client := &http.Client{} + resp1, err := client.Head(u1) + if err == nil && resp1.StatusCode == http.StatusOK { + ctx.SendChain(message.Image(u1)) + resp1.Body.Close() + return + } + resp2, err := client.Head(u2) + if err == nil && resp2.StatusCode == http.StatusOK { + ctx.SendChain(message.Image(u2)) + resp1.Body.Close() + return + } + ctx.SendChain(message.Text("404 Not found")) + }) +} + +func match(emojis map[string]int64) func(ctx *zero.Ctx) bool { + return func(ctx *zero.Ctx) bool { + r := []rune(ctx.Event.RawMessage) + if len(r) != 2 { + return false + } + e1 := string(r[0]) + e2 := string(r[1]) + if _, ok := emojis[e1]; !ok { + return false + } + if _, ok := emojis[e2]; !ok { + return false + } + return true + } +} From b597738dfb2dc8a3f4ccc94915afb93eca2788b6 Mon Sep 17 00:00:00 2001 From: Kanri Date: Sat, 12 Feb 2022 00:11:51 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=E2=9C=8F=EF=B8=8F=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_emojimix/emoji.go | 386 +++++++++++++++++++-------------------- plugin_emojimix/mix.go | 3 +- 2 files changed, 194 insertions(+), 195 deletions(-) diff --git a/plugin_emojimix/emoji.go b/plugin_emojimix/emoji.go index 8486a8a63e..15df03723d 100644 --- a/plugin_emojimix/emoji.go +++ b/plugin_emojimix/emoji.go @@ -1,198 +1,196 @@ +// Package emojimix 合成emoji package emojimix var emojis = map[string]int64{ - "😄": 20201001, // grinning face with smiling eyes - "😀": 20201001, // grinning face - "🙂": 20201001, // slightly smiling face - "🙃": 20201001, // upside-down face - "😉": 20201001, // winking face - "😊": 20201001, // smiling face with smiling eyes - "😆": 20201001, // grinning squinting face - "😃": 20201001, // grinning face with big eyes - "😁": 20201001, // beaming face with smiling eyes - "🤣": 20201001, // rolling on the floor laughing - "😅": 20201001, // grinning face with sweat - "😂": 20201001, // face with tears of joy - "😇": 20201001, // smiling face with halo - "🥰": 20201001, // smiling face with hearts - "😍": 20201001, // smiling face with heart-eyes - "😘": 20201001, // face blowing a kiss - "🤩": 20201001, // star-struck - "😗": 20201001, // kissing face - "😚": 20201001, // kissing face with closed eyes - "😙": 20201001, // kissing face with smiling eyes - "😛": 20201001, // face with tongue - "😝": 20201001, // squinting face with tongue - "😋": 20201001, // face savoring food - "🥲": 20201001, // smiling face with tear - "🤑": 20201001, // money-mouth face - "😜": 20201001, // winking face with tongue - "🤗": 20201001, // smiling face with open hands hugs - "🤫": 20201001, // shushing face quiet whisper - "🤔": 20201001, // thinking face question hmmm - "🤭": 20201001, // face with hand over mouth embarrassed - "🤨": 20201001, // face with raised eyebrow question - "🤐": 20201001, // zipper-mouth face - "😐": 20201001, // neutral face - "😑": 20201001, // expressionless face - "😶": 20201001, // face without mouth - "🤪": 20201001, // zany face - "😶‍🌫️": 20210218, // face in clouds - "😏": 20201001, // smirking face suspicious - "😒": 20201001, // unamused face - "🙄": 20201001, // face with rolling eyes - "😬": 20201001, // grimacing face - "😮‍💨": 20210218, // face exhaling - "🤥": 20201001, // lying face - "😌": 20201001, // relieved face - "😔": 20201001, // pensive face - "😪": 20201001, // sleepy face - "🤤": 20201001, // drooling face - "😴": 20201001, // sleeping face - "😷": 20201001, // face with medical mask - "🤒": 20201001, // face with thermometer - "🤕": 20201001, // face with head-bandage - "🤢": 20201001, // nauseated face - "🤮": 20201001, // face vomiting throw - "🤧": 20201001, // sneezing face - "🥵": 20201001, // hot face warm - "🥶": 20201001, // cold face freezing ice - "😵": 20201001, // face with crossed-out eyes - "🥴": 20201001, // woozy face drunk tipsy drug high - "🤯": 20201001, // exploding head mindblow - "🤠": 20201001, // cowboy hat face - "🥳": 20201001, // partying face - "🥸": 20201001, // disguised face - "🧐": 20201001, // face with monocle glasses - "😎": 20201001, // smiling face with sunglasses - "😕": 20201001, // confused face - "😟": 20201001, // worried face - "🙁": 20201001, // slightly frowning face - "😮": 20201001, // face with open mouth - "😯": 20201001, // hushed face - "😲": 20201001, // astonished face - "🤓": 20201001, // nerd face glasses - "😳": 20201001, // flushed face - "🥺": 20201001, // pleading face - "😧": 20201001, // anguished face - "😨": 20201001, // fearful face - "😦": 20201001, // frowning face with open mouth - "😰": 20201001, // anxious face with sweat - "😥": 20201001, // sad but relieved face - "😭": 20201001, // loudly crying face - "😩": 20201001, // weary face - "😢": 20201001, // crying face - "😣": 20201001, // persevering face - "😠": 20201001, // angry face - "😓": 20201001, // downcast face with sweat - "😖": 20201001, // confounded face - "🤬": 20201001, // face with symbols on mouth - "😞": 20201001, // disappointed face - "😫": 20201001, // tired face - "😤": 20201001, // face with steam from nose - "🥱": 20201001, // yawning face - "💩": 20201001, // pile of poo - "😡": 20201001, // pouting face - "😱": 20201001, // face screaming in fear - "👿": 20201001, // angry face with horns - "💀": 20201001, // skull - "👽": 20201001, // alien - "😈": 20201001, // smiling face with horns devil - "🤡": 20201001, // clown face - "👻": 20201001, // ghost - "🤖": 20201001, // robot - "💯": 20201001, // hundred points percent - "👀": 20201001, // eyes - "🌹": 20201001, // rose flower - "🌼": 20201001, // blossom flower - "🌷": 20201001, // tulip flower - "🌵": 20201001, // cactus - "🍍": 20201001, // pineapple - "🎂": 20201001, // birthday cake - "🌇": 20210831, // sunset - "🧁": 20201001, // cupcake muffin - "🎧": 20210521, // headphone earphone - "🌸": 20210218, // cherry blossom flower - "🦠": 20201001, // microbe germ bacteria virus covid corona - "💐": 20201001, // bouquet flowers - "🌭": 20201001, // hot dog food - "💋": 20201001, // kiss mark lips - "🎃": 20201001, // jack-o-lantern pumpkin - "🧀": 20201001, // cheese wedge - "☕": 20201001, // hot beverage coffee cup tea - "🎊": 20201001, // confetti ball - "🎈": 20201001, // balloon - "⛄": 20201001, // snowman without snow - "💎": 20201001, // gem stone crystal diamond - "🌲": 20201001, // evergreen tree - "🦂": 20210218, // scorpion - "🙈": 20201001, // see-no-evil monkey - "💔": 20201001, // broken heart - "💌": 20201001, // love letter heart - "💘": 20201001, // heart with arrow - "💟": 20201001, // heart decoration - "💞": 20201001, // revolving hearts - "💓": 20201001, // beating heart - "💕": 20201001, // two hearts - "💗": 20201001, // growing heart - "🧡": 20201001, // orange heart - "💛": 20201001, // yellow heart - "❤️‍🩹": 20210218, // mending heart - "💜": 20201001, // purple heart - "💚": 20201001, // green heart - "💙": 20201001, // blue heart - "🤎": 20201001, // brown heart - "🤍": 20201001, // white heart - "🖤": 20201001, // black heart - "💖": 20201001, // sparkling heart - "💝": 20201001, // heart with ribbon - "🎁": 20211115, // wrapped-gift - "🪵": 20211115, // wood - "🏆": 20211115, // trophy - "🍞": 20210831, // bread - "📰": 20201001, // newspaper - "🔮": 20201001, // crystal ball - "👑": 20201001, // crown - "🐷": 20201001, // pig face - "🦄": 20210831, // unicorn - "🌛": 20201001, // first quarter moon face - "🦌": 20201001, // deer - "🪄": 20210521, // magic wand - "💫": 20201001, // dizzy - "🐱": 20201001, // meow cat face - "🦁": 20201001, // lion - "🔥": 20201001, // fire - "🐦": 20210831, // bird - "🦇": 20201001, // bat - "🦉": 20210831, // owl - "🌈": 20201001, // rainbow - "🐵": 20201001, // monkey face - "🐝": 20201001, // honeybee bumblebee wasp - "🐢": 20201001, // turtle - "🐙": 20201001, // octopus - "🦙": 20201001, // llama alpaca - "🐐": 20210831, // goat - "🐼": 20201001, // panda - "🐨": 20201001, // koala - "🦥": 20201001, // sloth - "🐻": 20210831, // bear - "🐰": 20201001, // rabbit face - "🦔": 20201001, // hedgehog - "🐶": 20211115, // dog puppy - "🐩": 20211115, // poodle dog - "🦝": 20211115, // raccoon - "🐧": 20211115, // penguin - "🐌": 20210218, // snail - "🐭": 20201001, // mouse face rat - "🐟": 20210831, // fish - "🌍": 20201001, // globe showing Europe-Africa - "🌞": 20201001, // sun with face - "🌟": 20201001, // glowing star - "⭐": 20201001, // star - "🌜": 20201001, // last quarter moon face - "🥑": 20201001, // avocado - "🍌": 20211115, // banana - "🍓": 20210831, // strawberry - "🍋": 20210521, // lemon - "🍊": 20211115, // tangerine orange + "😄": 20201001, // grinning face with smiling eyes + "😀": 20201001, // grinning face + "🙂": 20201001, // slightly smiling face + "🙃": 20201001, // upside-down face + "😉": 20201001, // winking face + "😊": 20201001, // smiling face with smiling eyes + "😆": 20201001, // grinning squinting face + "😃": 20201001, // grinning face with big eyes + "😁": 20201001, // beaming face with smiling eyes + "🤣": 20201001, // rolling on the floor laughing + "😅": 20201001, // grinning face with sweat + "😂": 20201001, // face with tears of joy + "😇": 20201001, // smiling face with halo + "🥰": 20201001, // smiling face with hearts + "😍": 20201001, // smiling face with heart-eyes + "😘": 20201001, // face blowing a kiss + "🤩": 20201001, // star-struck + "😗": 20201001, // kissing face + "😚": 20201001, // kissing face with closed eyes + "😙": 20201001, // kissing face with smiling eyes + "😛": 20201001, // face with tongue + "😝": 20201001, // squinting face with tongue + "😋": 20201001, // face savoring food + "🥲": 20201001, // smiling face with tear + "🤑": 20201001, // money-mouth face + "😜": 20201001, // winking face with tongue + "🤗": 20201001, // smiling face with open hands hugs + "🤫": 20201001, // shushing face quiet whisper + "🤔": 20201001, // thinking face question hmmm + "🤭": 20201001, // face with hand over mouth embarrassed + "🤨": 20201001, // face with raised eyebrow question + "🤐": 20201001, // zipper-mouth face + "😐": 20201001, // neutral face + "😑": 20201001, // expressionless face + "😶": 20201001, // face without mouth + "🤪": 20201001, // zany face + "😏": 20201001, // smirking face suspicious + "😒": 20201001, // unamused face + "🙄": 20201001, // face with rolling eyes + "😬": 20201001, // grimacing face + "🤥": 20201001, // lying face + "😌": 20201001, // relieved face + "😔": 20201001, // pensive face + "😪": 20201001, // sleepy face + "🤤": 20201001, // drooling face + "😴": 20201001, // sleeping face + "😷": 20201001, // face with medical mask + "🤒": 20201001, // face with thermometer + "🤕": 20201001, // face with head-bandage + "🤢": 20201001, // nauseated face + "🤮": 20201001, // face vomiting throw + "🤧": 20201001, // sneezing face + "🥵": 20201001, // hot face warm + "🥶": 20201001, // cold face freezing ice + "😵": 20201001, // face with crossed-out eyes + "🥴": 20201001, // woozy face drunk tipsy drug high + "🤯": 20201001, // exploding head mindblow + "🤠": 20201001, // cowboy hat face + "🥳": 20201001, // partying face + "🥸": 20201001, // disguised face + "🧐": 20201001, // face with monocle glasses + "😎": 20201001, // smiling face with sunglasses + "😕": 20201001, // confused face + "😟": 20201001, // worried face + "🙁": 20201001, // slightly frowning face + "😮": 20201001, // face with open mouth + "😯": 20201001, // hushed face + "😲": 20201001, // astonished face + "🤓": 20201001, // nerd face glasses + "😳": 20201001, // flushed face + "🥺": 20201001, // pleading face + "😧": 20201001, // anguished face + "😨": 20201001, // fearful face + "😦": 20201001, // frowning face with open mouth + "😰": 20201001, // anxious face with sweat + "😥": 20201001, // sad but relieved face + "😭": 20201001, // loudly crying face + "😩": 20201001, // weary face + "😢": 20201001, // crying face + "😣": 20201001, // persevering face + "😠": 20201001, // angry face + "😓": 20201001, // downcast face with sweat + "😖": 20201001, // confounded face + "🤬": 20201001, // face with symbols on mouth + "😞": 20201001, // disappointed face + "😫": 20201001, // tired face + "😤": 20201001, // face with steam from nose + "🥱": 20201001, // yawning face + "💩": 20201001, // pile of poo + "😡": 20201001, // pouting face + "😱": 20201001, // face screaming in fear + "👿": 20201001, // angry face with horns + "💀": 20201001, // skull + "👽": 20201001, // alien + "😈": 20201001, // smiling face with horns devil + "🤡": 20201001, // clown face + "👻": 20201001, // ghost + "🤖": 20201001, // robot + "💯": 20201001, // hundred points percent + "👀": 20201001, // eyes + "🌹": 20201001, // rose flower + "🌼": 20201001, // blossom flower + "🌷": 20201001, // tulip flower + "🌵": 20201001, // cactus + "🍍": 20201001, // pineapple + "🎂": 20201001, // birthday cake + "🌇": 20210831, // sunset + "🧁": 20201001, // cupcake muffin + "🎧": 20210521, // headphone earphone + "🌸": 20210218, // cherry blossom flower + "🦠": 20201001, // microbe germ bacteria virus covid corona + "💐": 20201001, // bouquet flowers + "🌭": 20201001, // hot dog food + "💋": 20201001, // kiss mark lips + "🎃": 20201001, // jack-o-lantern pumpkin + "🧀": 20201001, // cheese wedge + "☕": 20201001, // hot beverage coffee cup tea + "🎊": 20201001, // confetti ball + "🎈": 20201001, // balloon + "⛄": 20201001, // snowman without snow + "💎": 20201001, // gem stone crystal diamond + "🌲": 20201001, // evergreen tree + "🦂": 20210218, // scorpion + "🙈": 20201001, // see-no-evil monkey + "💔": 20201001, // broken heart + "💌": 20201001, // love letter heart + "💘": 20201001, // heart with arrow + "💟": 20201001, // heart decoration + "💞": 20201001, // revolving hearts + "💓": 20201001, // beating heart + "💕": 20201001, // two hearts + "💗": 20201001, // growing heart + "🧡": 20201001, // orange heart + "💛": 20201001, // yellow heart + "💜": 20201001, // purple heart + "💚": 20201001, // green heart + "💙": 20201001, // blue heart + "🤎": 20201001, // brown heart + "🤍": 20201001, // white heart + "🖤": 20201001, // black heart + "💖": 20201001, // sparkling heart + "💝": 20201001, // heart with ribbon + "🎁": 20211115, // wrapped-gift + "🪵": 20211115, // wood + "🏆": 20211115, // trophy + "🍞": 20210831, // bread + "📰": 20201001, // newspaper + "🔮": 20201001, // crystal ball + "👑": 20201001, // crown + "🐷": 20201001, // pig face + "🦄": 20210831, // unicorn + "🌛": 20201001, // first quarter moon face + "🦌": 20201001, // deer + "🪄": 20210521, // magic wand + "💫": 20201001, // dizzy + "🐱": 20201001, // meow cat face + "🦁": 20201001, // lion + "🔥": 20201001, // fire + "🐦": 20210831, // bird + "🦇": 20201001, // bat + "🦉": 20210831, // owl + "🌈": 20201001, // rainbow + "🐵": 20201001, // monkey face + "🐝": 20201001, // honeybee bumblebee wasp + "🐢": 20201001, // turtle + "🐙": 20201001, // octopus + "🦙": 20201001, // llama alpaca + "🐐": 20210831, // goat + "🐼": 20201001, // panda + "🐨": 20201001, // koala + "🦥": 20201001, // sloth + "🐻": 20210831, // bear + "🐰": 20201001, // rabbit face + "🦔": 20201001, // hedgehog + "🐶": 20211115, // dog puppy + "🐩": 20211115, // poodle dog + "🦝": 20211115, // raccoon + "🐧": 20211115, // penguin + "🐌": 20210218, // snail + "🐭": 20201001, // mouse face rat + "🐟": 20210831, // fish + "🌍": 20201001, // globe showing Europe-Africa + "🌞": 20201001, // sun with face + "🌟": 20201001, // glowing star + "⭐": 20201001, // star + "🌜": 20201001, // last quarter moon face + "🥑": 20201001, // avocado + "🍌": 20211115, // banana + "🍓": 20210831, // strawberry + "🍋": 20210521, // lemon + "🍊": 20211115, // tangerine orange } diff --git a/plugin_emojimix/mix.go b/plugin_emojimix/mix.go index cf6bc84acc..0783ed4fbf 100644 --- a/plugin_emojimix/mix.go +++ b/plugin_emojimix/mix.go @@ -1,3 +1,4 @@ +// Package emojimix 合成emoji package emojimix import ( @@ -33,7 +34,7 @@ func init() { resp2, err := client.Head(u2) if err == nil && resp2.StatusCode == http.StatusOK { ctx.SendChain(message.Image(u2)) - resp1.Body.Close() + resp2.Body.Close() return } ctx.SendChain(message.Text("404 Not found")) From bb5d354629a087c74f553f1864a360c0a7ecf306 Mon Sep 17 00:00:00 2001 From: Kanri Date: Sat, 12 Feb 2022 13:59:20 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=20qqface=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_emojimix/emoji.go | 437 ++++++++++++++++++++++----------------- plugin_emojimix/mix.go | 61 ++++-- 2 files changed, 291 insertions(+), 207 deletions(-) diff --git a/plugin_emojimix/emoji.go b/plugin_emojimix/emoji.go index 15df03723d..487ff3ba6f 100644 --- a/plugin_emojimix/emoji.go +++ b/plugin_emojimix/emoji.go @@ -1,196 +1,249 @@ // Package emojimix 合成emoji package emojimix -var emojis = map[string]int64{ - "😄": 20201001, // grinning face with smiling eyes - "😀": 20201001, // grinning face - "🙂": 20201001, // slightly smiling face - "🙃": 20201001, // upside-down face - "😉": 20201001, // winking face - "😊": 20201001, // smiling face with smiling eyes - "😆": 20201001, // grinning squinting face - "😃": 20201001, // grinning face with big eyes - "😁": 20201001, // beaming face with smiling eyes - "🤣": 20201001, // rolling on the floor laughing - "😅": 20201001, // grinning face with sweat - "😂": 20201001, // face with tears of joy - "😇": 20201001, // smiling face with halo - "🥰": 20201001, // smiling face with hearts - "😍": 20201001, // smiling face with heart-eyes - "😘": 20201001, // face blowing a kiss - "🤩": 20201001, // star-struck - "😗": 20201001, // kissing face - "😚": 20201001, // kissing face with closed eyes - "😙": 20201001, // kissing face with smiling eyes - "😛": 20201001, // face with tongue - "😝": 20201001, // squinting face with tongue - "😋": 20201001, // face savoring food - "🥲": 20201001, // smiling face with tear - "🤑": 20201001, // money-mouth face - "😜": 20201001, // winking face with tongue - "🤗": 20201001, // smiling face with open hands hugs - "🤫": 20201001, // shushing face quiet whisper - "🤔": 20201001, // thinking face question hmmm - "🤭": 20201001, // face with hand over mouth embarrassed - "🤨": 20201001, // face with raised eyebrow question - "🤐": 20201001, // zipper-mouth face - "😐": 20201001, // neutral face - "😑": 20201001, // expressionless face - "😶": 20201001, // face without mouth - "🤪": 20201001, // zany face - "😏": 20201001, // smirking face suspicious - "😒": 20201001, // unamused face - "🙄": 20201001, // face with rolling eyes - "😬": 20201001, // grimacing face - "🤥": 20201001, // lying face - "😌": 20201001, // relieved face - "😔": 20201001, // pensive face - "😪": 20201001, // sleepy face - "🤤": 20201001, // drooling face - "😴": 20201001, // sleeping face - "😷": 20201001, // face with medical mask - "🤒": 20201001, // face with thermometer - "🤕": 20201001, // face with head-bandage - "🤢": 20201001, // nauseated face - "🤮": 20201001, // face vomiting throw - "🤧": 20201001, // sneezing face - "🥵": 20201001, // hot face warm - "🥶": 20201001, // cold face freezing ice - "😵": 20201001, // face with crossed-out eyes - "🥴": 20201001, // woozy face drunk tipsy drug high - "🤯": 20201001, // exploding head mindblow - "🤠": 20201001, // cowboy hat face - "🥳": 20201001, // partying face - "🥸": 20201001, // disguised face - "🧐": 20201001, // face with monocle glasses - "😎": 20201001, // smiling face with sunglasses - "😕": 20201001, // confused face - "😟": 20201001, // worried face - "🙁": 20201001, // slightly frowning face - "😮": 20201001, // face with open mouth - "😯": 20201001, // hushed face - "😲": 20201001, // astonished face - "🤓": 20201001, // nerd face glasses - "😳": 20201001, // flushed face - "🥺": 20201001, // pleading face - "😧": 20201001, // anguished face - "😨": 20201001, // fearful face - "😦": 20201001, // frowning face with open mouth - "😰": 20201001, // anxious face with sweat - "😥": 20201001, // sad but relieved face - "😭": 20201001, // loudly crying face - "😩": 20201001, // weary face - "😢": 20201001, // crying face - "😣": 20201001, // persevering face - "😠": 20201001, // angry face - "😓": 20201001, // downcast face with sweat - "😖": 20201001, // confounded face - "🤬": 20201001, // face with symbols on mouth - "😞": 20201001, // disappointed face - "😫": 20201001, // tired face - "😤": 20201001, // face with steam from nose - "🥱": 20201001, // yawning face - "💩": 20201001, // pile of poo - "😡": 20201001, // pouting face - "😱": 20201001, // face screaming in fear - "👿": 20201001, // angry face with horns - "💀": 20201001, // skull - "👽": 20201001, // alien - "😈": 20201001, // smiling face with horns devil - "🤡": 20201001, // clown face - "👻": 20201001, // ghost - "🤖": 20201001, // robot - "💯": 20201001, // hundred points percent - "👀": 20201001, // eyes - "🌹": 20201001, // rose flower - "🌼": 20201001, // blossom flower - "🌷": 20201001, // tulip flower - "🌵": 20201001, // cactus - "🍍": 20201001, // pineapple - "🎂": 20201001, // birthday cake - "🌇": 20210831, // sunset - "🧁": 20201001, // cupcake muffin - "🎧": 20210521, // headphone earphone - "🌸": 20210218, // cherry blossom flower - "🦠": 20201001, // microbe germ bacteria virus covid corona - "💐": 20201001, // bouquet flowers - "🌭": 20201001, // hot dog food - "💋": 20201001, // kiss mark lips - "🎃": 20201001, // jack-o-lantern pumpkin - "🧀": 20201001, // cheese wedge - "☕": 20201001, // hot beverage coffee cup tea - "🎊": 20201001, // confetti ball - "🎈": 20201001, // balloon - "⛄": 20201001, // snowman without snow - "💎": 20201001, // gem stone crystal diamond - "🌲": 20201001, // evergreen tree - "🦂": 20210218, // scorpion - "🙈": 20201001, // see-no-evil monkey - "💔": 20201001, // broken heart - "💌": 20201001, // love letter heart - "💘": 20201001, // heart with arrow - "💟": 20201001, // heart decoration - "💞": 20201001, // revolving hearts - "💓": 20201001, // beating heart - "💕": 20201001, // two hearts - "💗": 20201001, // growing heart - "🧡": 20201001, // orange heart - "💛": 20201001, // yellow heart - "💜": 20201001, // purple heart - "💚": 20201001, // green heart - "💙": 20201001, // blue heart - "🤎": 20201001, // brown heart - "🤍": 20201001, // white heart - "🖤": 20201001, // black heart - "💖": 20201001, // sparkling heart - "💝": 20201001, // heart with ribbon - "🎁": 20211115, // wrapped-gift - "🪵": 20211115, // wood - "🏆": 20211115, // trophy - "🍞": 20210831, // bread - "📰": 20201001, // newspaper - "🔮": 20201001, // crystal ball - "👑": 20201001, // crown - "🐷": 20201001, // pig face - "🦄": 20210831, // unicorn - "🌛": 20201001, // first quarter moon face - "🦌": 20201001, // deer - "🪄": 20210521, // magic wand - "💫": 20201001, // dizzy - "🐱": 20201001, // meow cat face - "🦁": 20201001, // lion - "🔥": 20201001, // fire - "🐦": 20210831, // bird - "🦇": 20201001, // bat - "🦉": 20210831, // owl - "🌈": 20201001, // rainbow - "🐵": 20201001, // monkey face - "🐝": 20201001, // honeybee bumblebee wasp - "🐢": 20201001, // turtle - "🐙": 20201001, // octopus - "🦙": 20201001, // llama alpaca - "🐐": 20210831, // goat - "🐼": 20201001, // panda - "🐨": 20201001, // koala - "🦥": 20201001, // sloth - "🐻": 20210831, // bear - "🐰": 20201001, // rabbit face - "🦔": 20201001, // hedgehog - "🐶": 20211115, // dog puppy - "🐩": 20211115, // poodle dog - "🦝": 20211115, // raccoon - "🐧": 20211115, // penguin - "🐌": 20210218, // snail - "🐭": 20201001, // mouse face rat - "🐟": 20210831, // fish - "🌍": 20201001, // globe showing Europe-Africa - "🌞": 20201001, // sun with face - "🌟": 20201001, // glowing star - "⭐": 20201001, // star - "🌜": 20201001, // last quarter moon face - "🥑": 20201001, // avocado - "🍌": 20211115, // banana - "🍓": 20210831, // strawberry - "🍋": 20210521, // lemon - "🍊": 20211115, // tangerine orange +var emojis = map[rune]int64{ + 128516: 20201001, // 😄 grinning face with smiling eyes + 128512: 20201001, // 😀 grinning face + 128578: 20201001, // 🙂 slightly smiling face + 128579: 20201001, // 🙃 upside-down face + 128521: 20201001, // 😉 winking face + 128522: 20201001, // 😊 smiling face with smiling eyes + 128518: 20201001, // 😆 grinning squinting face + 128515: 20201001, // 😃 grinning face with big eyes + 128513: 20201001, // 😁 beaming face with smiling eyes + 129315: 20201001, // 🤣 rolling on the floor laughing + 128517: 20201001, // 😅 grinning face with sweat + 128514: 20201001, // 😂 face with tears of joy + 128519: 20201001, // 😇 smiling face with halo + 129392: 20201001, // 🥰 smiling face with hearts + 128525: 20201001, // 😍 smiling face with heart-eyes + 128536: 20201001, // 😘 face blowing a kiss + 129321: 20201001, // 🤩 star-struck + 128535: 20201001, // 😗 kissing face + 128538: 20201001, // 😚 kissing face with closed eyes + 128537: 20201001, // 😙 kissing face with smiling eyes + 128539: 20201001, // 😛 face with tongue + 128541: 20201001, // 😝 squinting face with tongue + 128523: 20201001, // 😋 face savoring food + 129394: 20201001, // 🥲 smiling face with tear + 129297: 20201001, // 🤑 money-mouth face + 128540: 20201001, // 😜 winking face with tongue + 129303: 20201001, // 🤗 smiling face with open hands hugs + 129323: 20201001, // 🤫 shushing face quiet whisper + 129300: 20201001, // 🤔 thinking face question hmmm + 129325: 20201001, // 🤭 face with hand over mouth embarrassed + 129320: 20201001, // 🤨 face with raised eyebrow question + 129296: 20201001, // 🤐 zipper-mouth face + 128528: 20201001, // 😐 neutral face + 128529: 20201001, // 😑 expressionless face + 128566: 20201001, // 😶 face without mouth + 129322: 20201001, // 🤪 zany face + 128527: 20201001, // 😏 smirking face suspicious + 128530: 20201001, // 😒 unamused face + 128580: 20201001, // 🙄 face with rolling eyes + 128556: 20201001, // 😬 grimacing face + 128558: 20210218, // 😮 face exhaling + 129317: 20201001, // 🤥 lying face + 128524: 20201001, // 😌 relieved face + 128532: 20201001, // 😔 pensive face + 128554: 20201001, // 😪 sleepy face + 129316: 20201001, // 🤤 drooling face + 128564: 20201001, // 😴 sleeping face + 128567: 20201001, // 😷 face with medical mask + 129298: 20201001, // 🤒 face with thermometer + 129301: 20201001, // 🤕 face with head-bandage + 129314: 20201001, // 🤢 nauseated face + 129326: 20201001, // 🤮 face vomiting throw + 129319: 20201001, // 🤧 sneezing face + 129397: 20201001, // 🥵 hot face warm + 129398: 20201001, // 🥶 cold face freezing ice + 128565: 20201001, // 😵 face with crossed-out eyes + 129396: 20201001, // 🥴 woozy face drunk tipsy drug high + 129327: 20201001, // 🤯 exploding head mindblow + 129312: 20201001, // 🤠 cowboy hat face + 129395: 20201001, // 🥳 partying face + 129400: 20201001, // 🥸 disguised face + 129488: 20201001, // 🧐 face with monocle glasses + 128526: 20201001, // 😎 smiling face with sunglasses + 128533: 20201001, // 😕 confused face + 128543: 20201001, // 😟 worried face + 128577: 20201001, // 🙁 slightly frowning face + 128559: 20201001, // 😯 hushed face + 128562: 20201001, // 😲 astonished face + 129299: 20201001, // 🤓 nerd face glasses + 128563: 20201001, // 😳 flushed face + 129402: 20201001, // 🥺 pleading face + 128551: 20201001, // 😧 anguished face + 128552: 20201001, // 😨 fearful face + 128550: 20201001, // 😦 frowning face with open mouth + 128560: 20201001, // 😰 anxious face with sweat + 128549: 20201001, // 😥 sad but relieved face + 128557: 20201001, // 😭 loudly crying face + 128553: 20201001, // 😩 weary face + 128546: 20201001, // 😢 crying face + 128547: 20201001, // 😣 persevering face + 128544: 20201001, // 😠 angry face + 128531: 20201001, // 😓 downcast face with sweat + 128534: 20201001, // 😖 confounded face + 129324: 20201001, // 🤬 face with symbols on mouth + 128542: 20201001, // 😞 disappointed face + 128555: 20201001, // 😫 tired face + 128548: 20201001, // 😤 face with steam from nose + 129393: 20201001, // 🥱 yawning face + 128169: 20201001, // 💩 pile of poo + 128545: 20201001, // 😡 pouting face + 128561: 20201001, // 😱 face screaming in fear + 128127: 20201001, // 👿 angry face with horns + 128128: 20201001, // 💀 skull + 128125: 20201001, // 👽 alien + 128520: 20201001, // 😈 smiling face with horns devil + 129313: 20201001, // 🤡 clown face + 128123: 20201001, // 👻 ghost + 129302: 20201001, // 🤖 robot + 128175: 20201001, // 💯 hundred points percent + 128064: 20201001, // 👀 eyes + 127801: 20201001, // 🌹 rose flower + 127804: 20201001, // 🌼 blossom flower + 127799: 20201001, // 🌷 tulip flower + 127797: 20201001, // 🌵 cactus + 127821: 20201001, // 🍍 pineapple + 127874: 20201001, // 🎂 birthday cake + 127751: 20210831, // 🌇 sunset + 129473: 20201001, // 🧁 cupcake muffin + 127911: 20210521, // 🎧 headphone earphone + 127800: 20210218, // 🌸 cherry blossom flower + 129440: 20201001, // 🦠 microbe germ bacteria virus covid corona + 128144: 20201001, // 💐 bouquet flowers + 127789: 20201001, // 🌭 hot dog food + 128139: 20201001, // 💋 kiss mark lips + 127875: 20201001, // 🎃 jack-o-lantern pumpkin + 129472: 20201001, // 🧀 cheese wedge + 9749: 20201001, // ☕ hot beverage coffee cup tea + 127882: 20201001, // 🎊 confetti ball + 127880: 20201001, // 🎈 balloon + 9924: 20201001, // ⛄ snowman without snow + 128142: 20201001, // 💎 gem stone crystal diamond + 127794: 20201001, // 🌲 evergreen tree + 129410: 20210218, // 🦂 scorpion + 128584: 20201001, // 🙈 see-no-evil monkey + 128148: 20201001, // 💔 broken heart + 128140: 20201001, // 💌 love letter heart + 128152: 20201001, // 💘 heart with arrow + 128159: 20201001, // 💟 heart decoration + 128158: 20201001, // 💞 revolving hearts + 128147: 20201001, // 💓 beating heart + 128149: 20201001, // 💕 two hearts + 128151: 20201001, // 💗 growing heart + 129505: 20201001, // 🧡 orange heart + 128155: 20201001, // 💛 yellow heart + 10084: 20210218, // ❤ mending heart + 128156: 20201001, // 💜 purple heart + 128154: 20201001, // 💚 green heart + 128153: 20201001, // 💙 blue heart + 129294: 20201001, // 🤎 brown heart + 129293: 20201001, // 🤍 white heart + 128420: 20201001, // 🖤 black heart + 128150: 20201001, // 💖 sparkling heart + 128157: 20201001, // 💝 heart with ribbon + 127873: 20211115, // 🎁 wrapped-gift + 129717: 20211115, // 🪵 wood + 127942: 20211115, // 🏆 trophy + 127838: 20210831, // 🍞 bread + 128240: 20201001, // 📰 newspaper + 128302: 20201001, // 🔮 crystal ball + 128081: 20201001, // 👑 crown + 128055: 20201001, // 🐷 pig face + 129412: 20210831, // 🦄 unicorn + 127771: 20201001, // 🌛 first quarter moon face + 129420: 20201001, // 🦌 deer + 129668: 20210521, // 🪄 magic wand + 128171: 20201001, // 💫 dizzy + 128049: 20201001, // 🐱 meow cat face + 129409: 20201001, // 🦁 lion + 128293: 20201001, // 🔥 fire + 128038: 20210831, // 🐦 bird + 129415: 20201001, // 🦇 bat + 129417: 20210831, // 🦉 owl + 127752: 20201001, // 🌈 rainbow + 128053: 20201001, // 🐵 monkey face + 128029: 20201001, // 🐝 honeybee bumblebee wasp + 128034: 20201001, // 🐢 turtle + 128025: 20201001, // 🐙 octopus + 129433: 20201001, // 🦙 llama alpaca + 128016: 20210831, // 🐐 goat + 128060: 20201001, // 🐼 panda + 128040: 20201001, // 🐨 koala + 129445: 20201001, // 🦥 sloth + 128059: 20210831, // 🐻 bear + 128048: 20201001, // 🐰 rabbit face + 129428: 20201001, // 🦔 hedgehog + 128054: 20211115, // 🐶 dog puppy + 128041: 20211115, // 🐩 poodle dog + 129437: 20211115, // 🦝 raccoon + 128039: 20211115, // 🐧 penguin + 128012: 20210218, // 🐌 snail + 128045: 20201001, // 🐭 mouse face rat + 128031: 20210831, // 🐟 fish + 127757: 20201001, // 🌍 globe showing Europe-Africa + 127774: 20201001, // 🌞 sun with face + 127775: 20201001, // 🌟 glowing star + 11088: 20201001, // ⭐ star + 127772: 20201001, // 🌜 last quarter moon face + 129361: 20201001, // 🥑 avocado + 127820: 20211115, // 🍌 banana + 127827: 20210831, // 🍓 strawberry + 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 } diff --git a/plugin_emojimix/mix.go b/plugin_emojimix/mix.go index 0783ed4fbf..dbcc904f8e 100644 --- a/plugin_emojimix/mix.go +++ b/plugin_emojimix/mix.go @@ -4,6 +4,7 @@ package emojimix import ( "fmt" "net/http" + "strconv" "github.com/FloatTech/zbputils/control" "github.com/FloatTech/zbputils/control/order" @@ -17,13 +18,12 @@ func init() { DisableOnDefault: false, Help: "合成emoji\n" + "- [emoji][emoji]", - }).OnMessage(match(emojis)).SetBlock(true).Limit(ctxext.LimitByUser). + }).OnMessage(match).SetBlock(true).Limit(ctxext.LimitByUser). Handle(func(ctx *zero.Ctx) { - r := []rune(ctx.Event.RawMessage) - e1 := string(r[0]) - e2 := string(r[1]) - u1 := fmt.Sprintf("https://www.gstatic.com/android/keyboard/emojikitchen/%d/u%x/u%x_u%x.png", emojis[e1], []rune(e1)[0], []rune(e1)[0], []rune(e2)[0]) - u2 := fmt.Sprintf("https://www.gstatic.com/android/keyboard/emojikitchen/%d/u%x/u%x_u%x.png", emojis[e2], []rune(e2)[0], []rune(e2)[0], []rune(e1)[0]) + r1 := ctx.State["emojimix_e1"].(rune) + r2 := ctx.State["emojimix_e2"].(rune) + u1 := fmt.Sprintf("https://www.gstatic.com/android/keyboard/emojikitchen/%d/u%x/u%x_u%x.png", emojis[r1], r1, r1, r2) + u2 := fmt.Sprintf("https://www.gstatic.com/android/keyboard/emojikitchen/%d/u%x/u%x_u%x.png", emojis[r2], r2, r2, r1) client := &http.Client{} resp1, err := client.Head(u1) if err == nil && resp1.StatusCode == http.StatusOK { @@ -37,24 +37,55 @@ func init() { resp2.Body.Close() return } - ctx.SendChain(message.Text("404 Not found")) }) } -func match(emojis map[string]int64) func(ctx *zero.Ctx) bool { - return func(ctx *zero.Ctx) bool { - r := []rune(ctx.Event.RawMessage) - if len(r) != 2 { +func match(ctx *zero.Ctx) bool { + r := []rune(ctx.Event.RawMessage) + if len(r) == 2 { + if _, ok := emojis[r[0]]; !ok { return false } - e1 := string(r[0]) - e2 := string(r[1]) - if _, ok := emojis[e1]; !ok { + if _, ok := emojis[r[1]]; !ok { return false } - if _, ok := emojis[e2]; !ok { + ctx.State["emojimix_e1"] = r[0] + ctx.State["emojimix_e2"] = r[1] + return true + } + if len(ctx.Event.Message) == 2 { + r1 := face2emoji(ctx.Event.Message[0]) + if _, ok := emojis[r1]; !ok { + return false + } + r2 := face2emoji(ctx.Event.Message[1]) + if _, ok := emojis[r2]; !ok { return false } + ctx.State["emojimix_e1"] = r1 + ctx.State["emojimix_e2"] = r2 return true } + return false +} + +func face2emoji(face message.MessageSegment) rune { + if face.Type == "text" { + r := []rune(face.Data["text"]) + if len(r) != 1 { + return 0 + } + return r[0] + } + if face.Type != "face" { + return 0 + } + id, err := strconv.Atoi(face.Data["id"]) + if err != nil { + return 0 + } + if r, ok := qqface[id]; ok { + return r + } + return 0 } From 403683d4bdb0df66aa29bc8234174b228012c405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 12 Feb 2022 14:16:59 +0800 Subject: [PATCH 4/4] Update main.go --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 90e9b4fe52..233eb68ca8 100644 --- a/main.go +++ b/main.go @@ -62,6 +62,7 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin_cpstory" // cp短打 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_danbooru" // DeepDanbooru二次元图标签识别 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana" // 嘉心糖发病 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_emojimix" // 合成emoji _ "github.com/FloatTech/ZeroBot-Plugin/plugin_fortune" // 运势 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_funny" // 笑话 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_gif" // 制图 @@ -118,7 +119,6 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_reply" // 人工智能回复 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin_emojimix" // 合成emoji // ^^^^ // // ^^^^^^^^^^^^^^ //