From d92b4a53a0f921787f55d5507d3adbf86501bcd5 Mon Sep 17 00:00:00 2001 From: johlanse Date: Mon, 15 Aug 2022 09:14:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtg=E5=AD=A6=E4=B9=A0=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tg.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/tg.go b/lib/tg.go index ab9a4c9..427bfe5 100644 --- a/lib/tg.go +++ b/lib/tg.go @@ -102,13 +102,12 @@ func (t *Telegram) Init() { update := <-channel if update.Message == nil { if update.CallbackQuery != nil { - update.Message = &tgbotapi.Message{Text: update.CallbackQuery.Data} - t.bot.Send(tgbotapi.NewDeleteMessage(conf.GetConfig().TG.ChatID, update.CallbackQuery.Message.MessageID)) - log.Infoln(update.CallbackQuery.Data) + update.Message = update.CallbackQuery.Message + update.Message.Text = update.CallbackQuery.Data + t.bot.Send(tgbotapi.NewDeleteMessage(update.Message.Chat.ID, update.CallbackQuery.Message.MessageID)) } else { data, _ := json.Marshal(update) log.Infoln(string(data)) - return } } @@ -344,7 +343,7 @@ func study(bot *Telegram, from int64, args []string) { markup.InlineKeyboard = append(markup.InlineKeyboard, append([]tgbotapi.InlineKeyboardButton{}, tgbotapi.NewInlineKeyboardButtonData(user.Nick, "/study "+strconv.Itoa(i)))) } - replyMarkup := tgbotapi.NewEditMessageReplyMarkup(config.TG.ChatID, msgID, markup) + replyMarkup := tgbotapi.NewEditMessageReplyMarkup(from, msgID, markup) _, err := bot.bot.Send(replyMarkup) if err != nil { return