fix: support kick cron
This commit is contained in:
@@ -59,11 +59,16 @@ func Run(sendFunc func(string)) {
|
||||
}
|
||||
if m.Command() == "bind" {
|
||||
logrus.Infof("id is %d", m.Chat.ID)
|
||||
models.CreateUserIfNotExist(m.From.ID, &models.User{
|
||||
err := models.CreateUser(&models.User{
|
||||
TGID: m.From.ID,
|
||||
MCName: m.CommandArguments(),
|
||||
Status: 1,
|
||||
})
|
||||
if err != nil {
|
||||
m := tgbotapi.NewMessage(m.Chat.ID, "绑定失败, err: "+err.Error())
|
||||
conf.Bot.Send(m)
|
||||
return
|
||||
}
|
||||
m := tgbotapi.NewMessage(m.Chat.ID,
|
||||
fmt.Sprintf("绑定成功,你的MCID是%v", m.CommandArguments()))
|
||||
conf.Bot.Send(m)
|
||||
@@ -87,6 +92,18 @@ func Run(sendFunc func(string)) {
|
||||
conf.Bot.Send(m)
|
||||
return
|
||||
}
|
||||
if m.Command() == "get" {
|
||||
logrus.Infof("id is %d", m.Chat.ID)
|
||||
u, err := models.GetUserByTGID(m.From.ID)
|
||||
if err != nil {
|
||||
m := tgbotapi.NewMessage(m.Chat.ID, "你还没有绑定")
|
||||
conf.Bot.Send(m)
|
||||
return
|
||||
}
|
||||
m := tgbotapi.NewMessage(m.Chat.ID, fmt.Sprintf("你的MCID是%v", u.MCName))
|
||||
conf.Bot.Send(m)
|
||||
return
|
||||
}
|
||||
}(update.Message)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user