All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.annimon.tgbotsmodule.api.methods.interfaces.ReplyMarkupSupportedMessageMethod Maven / Gradle / Ivy

The newest version!
package com.annimon.tgbotsmodule.api.methods.interfaces;

import java.io.Serializable;
import java.util.List;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKeyboardButton;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKeyboardRow;

public interface ReplyMarkupSupportedMessageMethod
        extends SendableMessageMethod {

    ReplyKeyboard getReplyMarkup();

    M setReplyMarkup(ReplyKeyboard replyMarkup);

    default M setInlineKeyboard(List keyboard) {
        return setReplyMarkup(new InlineKeyboardMarkup(keyboard));
    }

    default M setInlineKeyboard(InlineKeyboardButton button) {
        return setSingleRowInlineKeyboard(button);
    }

    default M setSingleRowInlineKeyboard(List row) {
        return setInlineKeyboard(List.of(new InlineKeyboardRow(row)));
    }

    default M setSingleRowInlineKeyboard(InlineKeyboardButton... buttons) {
        return setSingleRowInlineKeyboard(List.of(buttons));
    }

    default M setSingleColumnInlineKeyboard(List column) {
        return setInlineKeyboard(column.stream().map(InlineKeyboardRow::new).toList());
    }

    default M setSingleColumnInlineKeyboard(InlineKeyboardButton... buttons) {
        return setSingleColumnInlineKeyboard(List.of(buttons));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy