Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from opq-osc/beta
Browse files Browse the repository at this point in the history
合并Beta分支
  • Loading branch information
mcoo authored Jul 28, 2021
2 parents 45a3bce + a49791e commit 4463071
Show file tree
Hide file tree
Showing 4 changed files with 413 additions and 42 deletions.
362 changes: 362 additions & 0 deletions countenance.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,362 @@
package OPQBot

import (
"errors"
"fmt"
"regexp"
)

const (
Face_惊讶 = "[表情0]"
Face_撇嘴 = "[表情1]"
Face_色 = "[表情2]"
Face_发呆 = "[表情3]"
Face_得意 = "[表情4]"
Face_流泪 = "[表情5]"
Face_害羞 = "[表情6]"
Face_闭嘴 = "[表情7]"
Face_睡 = "[表情8]"
Face_大哭 = "[表情9]"
Face_尴尬 = "[表情10]"
Face_发怒 = "[表情11]"
Face_调皮 = "[表情12]"
Face_呲牙 = "[表情13]"
Face_微笑 = "[表情14]"
Face_难过 = "[表情15]"
Face_酷 = "[表情16]"
Face_抓狂 = "[表情18]"
Face_吐 = "[表情19]"
Face_偷笑 = "[表情20]"
Face_可爱 = "[表情21]"
Face_白眼 = "[表情22]"
Face_傲慢 = "[表情23]"
Face_饥饿 = "[表情24]"
Face_困 = "[表情25]"
Face_惊恐 = "[表情26]"
Face_流汗 = "[表情27]"
Face_憨笑 = "[表情28]"
Face_悠闲 = "[表情29]"
Face_奋斗 = "[表情30]"
Face_咒骂 = "[表情31]"
Face_疑问 = "[表情32]"
Face_嘘 = "[表情33]"
Face_晕 = "[表情34]"
Face_折磨 = "[表情35]"
Face_衰 = "[表情36]"
Face_骷髅 = "[表情37]"
Face_敲打 = "[表情38]"
Face_再见 = "[表情39]"
Face_发抖 = "[表情41]"
Face_爱情 = "[表情42]"
Face_跳跳 = "[表情43]"
Face_猪头 = "[表情46]"
Face_拥抱 = "[表情49]"
Face_蛋糕 = "[表情53]"
Face_闪电 = "[表情54]"
Face_炸弹 = "[表情55]"
Face_刀 = "[表情56]"
Face_足球 = "[表情57]"
Face_便便 = "[表情59]"
Face_咖啡 = "[表情60]"
Face_饭 = "[表情61]"
Face_玫瑰 = "[表情63]"
Face_凋谢 = "[表情64]"
Face_爱心 = "[表情66]"
Face_心碎 = "[表情67]"
Face_礼物 = "[表情69]"
Face_太阳 = "[表情74]"
Face_月亮 = "[表情75]"
Face_赞 = "[表情76]"
Face_踩 = "[表情77]"
Face_握手 = "[表情78]"
Face_胜利 = "[表情79]"
Face_飞吻 = "[表情82]"
Face_怄火 = "[表情86]"
Face_西瓜 = "[表情89]"
Face_冷汗 = "[表情96]"
Face_擦汗 = "[表情97]"
Face_抠鼻 = "[表情98]"
Face_鼓掌 = "[表情99]"
Face_糗大了 = "[表情100]"
Face_坏笑 = "[表情101]"
Face_左哼哼 = "[表情102]"
Face_右哼哼 = "[表情103]"
Face_哈欠 = "[表情104]"
Face_鄙视 = "[表情105]"
Face_委屈 = "[表情106]"
Face_快哭了 = "[表情107]"
Face_阴险 = "[表情108]"
Face_左亲亲 = "[表情109]"
Face_吓 = "[表情110]"
Face_可怜 = "[表情111]"
Face_菜刀 = "[表情112]"
Face_啤酒 = "[表情113]"
Face_篮球 = "[表情114]"
Face_乒乓 = "[表情115]"
Face_示爱 = "[表情116]"
Face_瓢虫 = "[表情117]"
Face_抱拳 = "[表情118]"
Face_勾引 = "[表情119]"
Face_拳头 = "[表情120]"
Face_差劲 = "[表情121]"
Face_爱你 = "[表情122]"
Face_NO = "[表情123]"
Face_OK = "[表情124]"
Face_转圈 = "[表情125]"
Face_磕头 = "[表情126]"
Face_回头 = "[表情127]"
Face_跳绳 = "[表情128]"
Face_挥手 = "[表情129]"
Face_激动 = "[表情130]"
Face_街舞 = "[表情131]"
Face_献吻 = "[表情132]"
Face_左太极 = "[表情133]"
Face_右太极 = "[表情134]"
Face_双喜 = "[表情136]"
Face_嗨皮牛耶 = "[表情137]"
Face_灯笼 = "[表情138]"
Face_K歌 = "[表情140]"
Face_喝彩 = "[表情144]"
Face_祈祷 = "[表情145]"
Face_爆筋 = "[表情146]"
Face_棒棒糖 = "[表情147]"
Face_喝奶 = "[表情148]"
Face_飞机 = "[表情151]"
Face_钞票 = "[表情158]"
Face_药 = "[表情168]"
Face_手枪 = "[表情169]"
Face_茶 = "[表情171]"
Face_眨眼睛 = "[表情172]"
Face_泪奔 = "[表情173]"
Face_无奈 = "[表情174]"
Face_卖萌 = "[表情175]"
Face_小纠结 = "[表情176]"
Face_喷血 = "[表情177]"
Face_斜眼笑 = "[表情178]"
Face_doge = "[表情179]"
Face_惊喜 = "[表情180]"
Face_骚扰 = "[表情181]"
Face_笑哭 = "[表情182]"
Face_我最美 = "[表情183]"
Face_河蟹 = "[表情184]"
Face_羊驼 = "[表情185]"
Face_幽灵 = "[表情187]"
Face_蛋 = "[表情188]"
Face_菊花 = "[表情190]"
Face_红包 = "[表情192]"
Face_大笑 = "[表情193]"
Face_不开心 = "[表情194]"
Face_冷漠 = "[表情197]"
Face_呃 = "[表情198]"
Face_好棒 = "[表情199]"
Face_拜托 = "[表情200]"
Face_点赞 = "[表情201]"
Face_无聊 = "[表情202]"
Face_托脸 = "[表情203]"
Face_吃 = "[表情204]"
Face_送花 = "[表情205]"
Face_害怕 = "[表情206]"
Face_花痴 = "[表情207]"
Face_小样儿 = "[表情208]"
Face_飙泪 = "[表情210]"
Face_我不看 = "[表情211]"
Face_托腮 = "[表情212]"
Face_啵啵 = "[表情214]"
Face_糊脸 = "[表情215]"
Face_拍头 = "[表情216]"
Face_扯一扯 = "[表情217]"
Face_舔一舔 = "[表情218]"
Face_蹭一蹭 = "[表情219]"
Face_佛系 = "[表情220]"
Face_顶呱呱 = "[表情221]"
Face_加油必胜 = "[表情245]"
Face_加油抱抱 = "[表情246]"
Face_口罩护体 = "[表情247]"
)

var FaceMap = map[string]string{
"[表情0]": "惊讶",
"[表情1]": "撇嘴",
"[表情2]": "色",
"[表情3]": "发呆",
"[表情4]": "得意",
"[表情5]": "流泪",
"[表情6]": "害羞",
"[表情7]": "闭嘴",
"[表情8]": "睡",
"[表情9]": "大哭",
"[表情10]": "尴尬",
"[表情11]": "发怒",
"[表情12]": "调皮",
"[表情13]": "呲牙",
"[表情14]": "微笑",
"[表情15]": "难过",
"[表情16]": "酷",
"[表情18]": "抓狂",
"[表情19]": "吐",
"[表情20]": "偷笑",
"[表情21]": "可爱",
"[表情22]": "白眼",
"[表情23]": "傲慢",
"[表情24]": "饥饿",
"[表情25]": "困",
"[表情26]": "惊恐",
"[表情27]": "流汗",
"[表情28]": "憨笑",
"[表情29]": "悠闲",
"[表情30]": "奋斗",
"[表情31]": "咒骂",
"[表情32]": "疑问",
"[表情33]": "嘘",
"[表情34]": "晕",
"[表情35]": "折磨",
"[表情36]": "衰",
"[表情37]": "骷髅",
"[表情38]": "敲打",
"[表情39]": "再见",
"[表情41]": "发抖",
"[表情42]": "爱情",
"[表情43]": "跳跳",
"[表情46]": "猪头",
"[表情49]": "拥抱",
"[表情53]": "蛋糕",
"[表情54]": "闪电",
"[表情55]": "炸弹",
"[表情56]": "刀",
"[表情57]": "足球",
"[表情59]": "便便",
"[表情60]": "咖啡",
"[表情61]": "饭",
"[表情63]": "玫瑰",
"[表情64]": "凋谢",
"[表情66]": "爱心",
"[表情67]": "心碎",
"[表情69]": "礼物",
"[表情74]": "太阳",
"[表情75]": "月亮",
"[表情76]": "赞",
"[表情77]": "踩",
"[表情78]": "握手",
"[表情79]": "胜利",
"[表情82]": "飞吻",
"[表情86]": "怄火",
"[表情89]": "西瓜",
"[表情96]": "冷汗",
"[表情97]": "擦汗",
"[表情98]": "抠鼻",
"[表情99]": "鼓掌",
"[表情100]": "糗大了",
"[表情101]": "坏笑",
"[表情102]": "左哼哼",
"[表情103]": "右哼哼",
"[表情104]": "哈欠",
"[表情105]": "鄙视",
"[表情106]": "委屈",
"[表情107]": "快哭了",
"[表情108]": "阴险",
"[表情109]": "左亲亲",
"[表情110]": "吓",
"[表情111]": "可怜",
"[表情112]": "菜刀",
"[表情113]": "啤酒",
"[表情114]": "篮球",
"[表情115]": "乒乓",
"[表情116]": "示爱",
"[表情117]": "瓢虫",
"[表情118]": "抱拳",
"[表情119]": "勾引",
"[表情120]": "拳头",
"[表情121]": "差劲",
"[表情122]": "爱你",
"[表情123]": "NO",
"[表情124]": "OK",
"[表情125]": "转圈",
"[表情126]": "磕头",
"[表情127]": "回头",
"[表情128]": "跳绳",
"[表情129]": "挥手",
"[表情130]": "激动",
"[表情131]": "街舞",
"[表情132]": "献吻",
"[表情133]": "左太极",
"[表情134]": "右太极",
"[表情136]": "双喜",
"[表情137]": "嗨皮牛耶",
"[表情138]": "灯笼",
"[表情140]": "K歌",
"[表情144]": "喝彩",
"[表情145]": "祈祷",
"[表情146]": "爆筋",
"[表情147]": "棒棒糖",
"[表情148]": "喝奶",
"[表情151]": "飞机",
"[表情158]": "钞票",
"[表情168]": "药",
"[表情169]": "手枪",
"[表情171]": "茶",
"[表情172]": "眨眼睛",
"[表情173]": "泪奔",
"[表情174]": "无奈",
"[表情175]": "卖萌",
"[表情176]": "小纠结",
"[表情177]": "喷血",
"[表情178]": "斜眼笑",
"[表情179]": "doge",
"[表情180]": "惊喜",
"[表情181]": "骚扰",
"[表情182]": "笑哭",
"[表情183]": "我最美",
"[表情184]": "河蟹",
"[表情185]": "羊驼",
"[表情187]": "幽灵",
"[表情188]": "蛋",
"[表情190]": "菊花",
"[表情192]": "红包",
"[表情193]": "大笑",
"[表情194]": "不开心",
"[表情197]": "冷漠",
"[表情198]": "呃",
"[表情199]": "好棒",
"[表情200]": "拜托",
"[表情201]": "点赞",
"[表情202]": "无聊",
"[表情203]": "托脸",
"[表情204]": "吃",
"[表情205]": "送花",
"[表情206]": "害怕",
"[表情207]": "花痴",
"[表情208]": "小样儿",
"[表情210]": "飙泪",
"[表情211]": "我不看",
"[表情212]": "托腮",
"[表情214]": "啵啵",
"[表情215]": "糊脸",
"[表情216]": "拍头",
"[表情217]": "扯一扯",
"[表情218]": "舔一舔",
"[表情219]": "蹭一蹭",
"[表情220]": "佛系",
"[表情221]": "顶呱呱",
"[表情245]": "加油必胜",
"[表情246]": "加油抱抱",
"[表情247]": "口罩护体",
}

func DecodeFace(encodeFace string) (string, error) {
if v, ok := FaceMap[encodeFace]; ok {
return v, nil
} else {
return "", errors.New("表情未收录")
}
}

func DecodeFaceFromSentences(encode string, format string) string {
r, _ := regexp.Compile(`\[表情[0-9]+?\]`)
return r.ReplaceAllStringFunc(encode, func(s string) string {
tmp, err := DecodeFace(s)
if err != nil {
return fmt.Sprintf(format, "表情未收录")
}
return fmt.Sprintf(format, tmp)
})
}
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import (
var ZanNote = map[int64]int{}

func main() {
// log.Println(OPQBot.DecodeFaceFromSentences("[表情123]啦啦啦[表情0]","[表情:%s]"))
if len(os.Args) != 2 {
return
}
opqBot := OPQBot.NewBotManager(2629326992, os.Args[1])
// 设置发送队列每次发送的间隔时间 默认1000ms
opqBot.SetSendDelayed(1000)
// 设置最大重试次数
opqBot.SetMaxRetryCount(5)
err := opqBot.Start()
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ module github.com/mcoo/OPQBot
go 1.16

require (
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/dop251/goja v0.0.0-20210427212725-462d53687b0d
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/goinggo/mapstructure v0.0.0-20140717182941-194205d9b4a9
github.com/gorilla/websocket v1.4.2
github.com/mcoo/requests v0.0.2
golang.org/x/text v0.3.6 // indirect
github.com/sirupsen/logrus v1.8.1
)
Loading

0 comments on commit 4463071

Please sign in to comment.