feat: upgrade mod
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
vaalacat
2024-04-23 11:30:28 +00:00
parent 75944abbc2
commit e39db56969
7 changed files with 34 additions and 12 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}