|
@@ -56,11 +56,17 @@ func onUpdate(e event2.Event[tgbotapi.Update]) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+ if update.InlineQuery != nil || update.ChosenInlineResult != nil {
|
|
|
+ handleInlineQuery(update)
|
|
|
+ }
|
|
|
+
|
|
|
if update.CallbackQuery == nil {
|
|
|
logrus.Info("CallbackQuery is null")
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+ fmt.Println("InlineMessageID", update.CallbackQuery.InlineMessageID)
|
|
|
+
|
|
|
tgID := update.CallbackQuery.From.ID
|
|
|
gameUserMapModel := model.GameUserMap{}
|
|
|
err = db.GetDB().Table("game_user_map").
|
|
@@ -97,6 +103,33 @@ func onUpdate(e event2.Event[tgbotapi.Update]) error {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
+func handleInlineQuery(update tgbotapi.Update) error {
|
|
|
+ if update.ChosenInlineResult != nil {
|
|
|
+ fmt.Println("InlineMessageID:", update.ChosenInlineResult.InlineMessageID)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ btnList := GetGameReplyMarkupSimple()
|
|
|
+
|
|
|
+ queryStr := update.InlineQuery.Query
|
|
|
+
|
|
|
+ gameMsg := &tgbotapi.InlineConfig{
|
|
|
+ InlineQueryID: update.InlineQuery.ID,
|
|
|
+ Results: []interface{}{
|
|
|
+ tgbotapi.InlineQueryResultGame{
|
|
|
+ Type: "game",
|
|
|
+ ID: "id_" + queryStr,
|
|
|
+ GameShortName: "qznn",
|
|
|
+ ReplyMarkup: &btnList,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ CacheTime: 0,
|
|
|
+ }
|
|
|
+
|
|
|
+ go event2.MustFire(EventSendMsgFix, tgbotapi.Chattable(gameMsg))
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
func handlerMsg(update tgbotapi.Update) error {
|
|
|
var err error
|
|
|
|
|
@@ -507,39 +540,6 @@ func GetYeInfo(tgID int64) (*YERespData, error) {
|
|
|
}
|
|
|
|
|
|
return &respData, nil
|
|
|
- // if update.FromChat().IsPrivate() {
|
|
|
- // textMsg.Text =
|
|
|
- // `ID: ` + userModel.Mobile + `
|
|
|
- // 用户名: ` + userModel.Nickname + `
|
|
|
- // 余额: ` + fmt.Sprintf("%.2f", respData.Data.Balance) + `
|
|
|
- // 今日流水: ` + fmt.Sprintf("%.2f", respData.Data.Amount) + `
|
|
|
- // 今日输赢: ` + fmt.Sprintf("%.2f", respData.Data.LoseWin) + `
|
|
|
-
|
|
|
- // 联系<a href='https://t.me/+7nmC1CbItdozZmM1'>上下分客服</a>取款
|
|
|
- // `
|
|
|
- // SendMsg(textMsg, update, botApi)
|
|
|
- // } else {
|
|
|
- // textMsg.Text =
|
|
|
- // `ID: ` + userModel.Mobile + `
|
|
|
- // 用户名: ` + userModel.Nickname + `
|
|
|
- // 余额: ` + fmt.Sprintf("%.2f", respData.Data.Balance) + `
|
|
|
- // 今日流水: ` + fmt.Sprintf("%.2f", respData.Data.Amount) + `
|
|
|
- // 今日输赢: ` + fmt.Sprintf("%.2f", respData.Data.LoseWin) + `
|
|
|
- // `
|
|
|
-
|
|
|
- // shareInfo, err := getShare(tgID)
|
|
|
- // if err != nil {
|
|
|
- // logrus.Error(err)
|
|
|
- // textMsg.Text = "操作失败,内部错误,请稍后重新操作。(531)"
|
|
|
- // botApi.Send(textMsg)
|
|
|
- // return false
|
|
|
- // }
|
|
|
-
|
|
|
- // btnList := GetBtnList(shareInfo)
|
|
|
-
|
|
|
- // textMsg.ReplyMarkup = btnList
|
|
|
- // SendAndDeleteMsg(textMsg, update, botApi, time.Second*60)
|
|
|
- // }
|
|
|
|
|
|
}
|
|
|
|