Archived
1

Reminders message update with less waiting

It will update in one step, not in two
This commit is contained in:
Vladimir Hodakov 2017-12-23 01:56:18 +04:00
parent 706dc3e944
commit 2bcb89f74a

View File

@ -31,9 +31,12 @@ func (r *Reminder) CreateAlarmSetting(update *tgbotapi.Update, playerRaw *dbmapp
return "fail" return "fail"
} }
message := r.formatRemindersMessageText(playerRaw)
keyboard := r.formatRemindersButtons(playerRaw) keyboard := r.formatRemindersButtons(playerRaw)
buttonsUpdate := tgbotapi.NewEditMessageReplyMarkup(update.CallbackQuery.Message.Chat.ID, update.CallbackQuery.Message.MessageID, keyboard) messageUpdate := tgbotapi.NewEditMessageText(update.CallbackQuery.Message.Chat.ID, update.CallbackQuery.Message.MessageID, message)
c.Bot.Send(buttonsUpdate) messageUpdate.ParseMode = "Markdown"
messageUpdate.ReplyMarkup = &keyboard
c.Bot.Send(messageUpdate)
return "ok" return "ok"
} }
@ -52,9 +55,12 @@ func (r *Reminder) DestroyAlarmSetting(update *tgbotapi.Update, playerRaw *dbmap
c.Log.Error(err.Error()) c.Log.Error(err.Error())
} }
message := r.formatRemindersMessageText(playerRaw)
keyboard := r.formatRemindersButtons(playerRaw) keyboard := r.formatRemindersButtons(playerRaw)
buttonsUpdate := tgbotapi.NewEditMessageReplyMarkup(update.CallbackQuery.Message.Chat.ID, update.CallbackQuery.Message.MessageID, keyboard) messageUpdate := tgbotapi.NewEditMessageText(update.CallbackQuery.Message.Chat.ID, update.CallbackQuery.Message.MessageID, message)
c.Bot.Send(buttonsUpdate) messageUpdate.ParseMode = "Markdown"
messageUpdate.ReplyMarkup = &keyboard
c.Bot.Send(messageUpdate)
return "ok" return "ok"
} }