
me.niccolomattei.api.telegram.keyboard.KeyboardRow Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of telegram Show documentation
Show all versions of telegram Show documentation
Simple yet powerful telegram bot api.
package me.niccolomattei.api.telegram.keyboard;
import java.util.Arrays;
import java.util.List;
import org.json.JSONObject;
import me.niccolomattei.api.telegram.serialization.Ignorable;
import me.niccolomattei.api.telegram.serialization.IgnoreClassName;
import me.niccolomattei.api.telegram.serialization.JSONSerializator;
@IgnoreClassName
public class KeyboardRow implements ReplyMarkup {
@Ignorable
private List list;
public KeyboardButton[] buttons;
public KeyboardRow(KeyboardButton... buttons) {
list = Arrays.asList(buttons);
}
public void addButton(KeyboardButton button) {
list.add(button);
}
public KeyboardButton[] getButtonsArray() {
return (KeyboardButton[]) list.toArray();
}
@Override
public String serialize() {
buttons = getButtonsArray();
return JSONSerializator.serialize(this);
}
@Override
public JSONObject serializeJson() {
buttons = getButtonsArray();
return JSONSerializator.serializeJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy