async Task AddReactionsToMessage(Message message) { int keyboard; try { object chatKeyboard = dbManager.GetKeyboard(message.Chat); if (chatKeyboard is null || chatKeyboard is DBNull) /*Chat not in DB or without a keyboard*/ { throw new KeyboardNotSetException(); } else { var replacementMessage = await ReplaceMessage(message); keyboard = (int)chatKeyboard; dbManager.SaveMessage(replacementMessage, keyboard); var markup = InlineKeyboardFactory.ReactionsKeyboard(dbManager.GetKeyboardButtons(keyboard)); await EditMessageReplyMarkupAsync(replacementMessage.Chat.Id, replacementMessage.MessageId, markup); } }
static ReactionButtonsBot() { string[] defaultReactions = { "like", "ok", "dislike" }; defaultReactionsKeyboard = InlineKeyboardFactory.ReactionsKeyboard(defaultReactions); }
private void SetReactionsKeyboard(Chat chat, string reactionsString) { int keyboard = dbManager.SaveKeyboard(InlineKeyboardFactory.ReactionsKeyboard(reactionsString)); dbManager.SaveChat(chat, keyboard); }