This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func ApproveHandler(update tgbotapi.Update, cmd defs.Command) {
|
||||
u, err := models.GetUserByTGID(update.CallbackQuery.From.ID)
|
||||
u, err := models.GetUserByMCName(cmd.Argstr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@@ -3,12 +3,14 @@ package tgbot
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"tg-mc/conf"
|
||||
"tg-mc/models"
|
||||
"tg-mc/services/utils"
|
||||
commonUtils "tg-mc/utils"
|
||||
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"github.com/samber/lo"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -33,7 +35,7 @@ func GetHandler(msg *tgbotapi.Message, i interface{}) {
|
||||
conf.Bot.Send(tgbotapi.NewMessage(msg.Chat.ID, "ID错误,应该为int64"))
|
||||
return
|
||||
}
|
||||
u, err := models.GetUserByTGID(tgid)
|
||||
u, err := models.GetUsersByTGID(tgid)
|
||||
if err != nil {
|
||||
tm := tgbotapi.NewMessage(msg.Chat.ID, fmt.Sprintf("查询出错,err:\n```\n%+v\n```", err))
|
||||
tm.ParseMode = "Markdown"
|
||||
@@ -59,13 +61,14 @@ func GetHandler(msg *tgbotapi.Message, i interface{}) {
|
||||
return
|
||||
}
|
||||
logrus.Infof("id is %d", msg.Chat.ID)
|
||||
u, err := models.GetUserByTGID(msg.From.ID)
|
||||
u, err := models.GetUsersByTGID(msg.From.ID)
|
||||
if err != nil {
|
||||
m := tgbotapi.NewMessage(msg.Chat.ID, "你还没有绑定")
|
||||
conf.Bot.Send(m)
|
||||
return
|
||||
}
|
||||
m := tgbotapi.NewMessage(msg.Chat.ID, fmt.Sprintf("你的MCID是%v", u.MCName))
|
||||
ans := strings.Join(lo.Map(u, func(u models.User, _ int) string { return u.MCName }), "\n")
|
||||
m := tgbotapi.NewMessage(msg.Chat.ID, fmt.Sprintf("你的MCID绑定有\n%v", ans))
|
||||
conf.Bot.Send(m)
|
||||
return
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func RejectHandler(update tgbotapi.Update, cmd defs.Command) {
|
||||
u, err := models.GetUserByTGID(update.CallbackQuery.From.ID)
|
||||
u, err := models.GetUserByMCName(cmd.Argstr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user