-
Notifications
You must be signed in to change notification settings - Fork 1
/
processor.go
80 lines (77 loc) · 2.12 KB
/
processor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package main
import (
"regexp"
"strings"
"time"
"gopkg.in/telegram-bot-api.v4"
)
// made for @SusuwANjr with <3
func processor(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
if update.Message == nil {
return
}
if update.Message.From != nil {
idLogger(update.Message, bot)
}
if update.Message.Command() == "welcome" &&
fromGroup(update.Message) && isMaster(update.Message) {
welcome(update.Message, bot)
}
if update.Message.Command() == "start" {
msg, _ := buildMessage(update.Message.From.ID, conf.StartText)
msg.ParseMode = tgbotapi.ModeMarkdown
bot.Send(msg)
}
if update.Message.Command() == "help" {
sendMsg(bot, update.Message.From.ID, conf.HelpText)
}
if update.Message.Command() == "time" {
sendMsg(bot, update.Message.From.ID,
time.Now().Format("2006.01.02 15:04:05"))
}
if update.Message.Text == "haochide" {
msg, _ := buildMessage(update.Message.From.ID, conf.Haochide)
msg.DisableWebPagePreview = true
bot.Send(msg)
}
if update.Message.NewChatMember != nil {
newMember(update.Message, bot)
}
if update.Message.NewChatTitle != "" && fromGroup(update.Message) {
titleLogger(update.Message, bot)
}
if update.Message.Command() == "titles" && fromGroup(update.Message) {
titleCommand(update.Message, bot)
}
if update.Message.Command() == "settitle" &&
update.Message.CommandArguments() != "" {
setTitle(update.Message, bot)
}
if regexp.MustCompile("^(嘀|滴|打卡|签到|di)(.*)$").
MatchString(update.Message.Text) {
check(update.Message, bot)
}
if strings.HasPrefix(update.Message.Text, "🐥") {
morningCount(update.Message, bot)
}
if strings.HasPrefix(update.Message.Text, "🐣") {
nightCount(update.Message, bot)
}
if strings.HasPrefix(update.Message.Text, "🐤") {
totalCount(update.Message, bot)
}
if update.Message.Command() == "mm" {
morningRank(update.Message, bot)
}
if update.Message.Command() == "kk" {
KRank(update.Message, bot)
}
if update.Message.Command() == "kick" &&
update.Message.ReplyToMessage != nil &&
isMaster(update.Message) {
kick(update.Message, bot)
}
if update.Message.Command() == "transfer" {
transfer(update.Message, bot)
}
}