Ejemplo n.º 1
0
        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);
                }
            }
Ejemplo n.º 2
0
 static ReactionButtonsBot()
 {
     string[] defaultReactions = { "like", "ok", "dislike" };
     defaultReactionsKeyboard = InlineKeyboardFactory.ReactionsKeyboard(defaultReactions);
 }
Ejemplo n.º 3
0
        private void SetReactionsKeyboard(Chat chat, string reactionsString)
        {
            int keyboard = dbManager.SaveKeyboard(InlineKeyboardFactory.ReactionsKeyboard(reactionsString));

            dbManager.SaveChat(chat, keyboard);
        }