本文整理汇总了Java中com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup类的典型用法代码示例。如果您正苦于以下问题:Java ReplyKeyboardMarkup类的具体用法?Java ReplyKeyboardMarkup怎么用?Java ReplyKeyboardMarkup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReplyKeyboardMarkup类属于com.pengrad.telegrambot.model.request包,在下文中一共展示了ReplyKeyboardMarkup类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup; //导入依赖的package包/类
@Override
public boolean execute(Message message, Prefs prefs) {
final long chatId = message.chat().id();
try {
int minutes = Integer.valueOf(message.text());
prefs.minutesPeriod = minutes;
PrefsController.instance.setPrefs(prefs);
botService.getObserver().start(minutes);
String result = String.format(botService.getString(R.string.time_period_changed), minutes);
telegramService.sendMessage(chatId, result);
// TODO: 09.04.2017 mainK
// telegramService.sendMessage(chatId, result, mainKeyBoard);
telegramService.notifyToOthers(message.from().id(), String.format(botService.getString(R.string.user_change_time_period), minutes));
return false;
} catch (NumberFormatException ex) {
// result = "Wrong number format: " + phrase[1];
String[][] keyboardStr = {
new String[]{"0", "60", "120"},
new String[]{"240", "480", "720"}
};
Keyboard keyboard = new ReplyKeyboardMarkup(keyboardStr, true, true, false);
telegramService.sendMessage(chatId, botService.getString(R.string.select_minutes), keyboard);
return true;
}
}
示例2: run
import com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup; //导入依赖的package包/类
@Override
public void run() {
/*
* Example of UserTask implementation
*/
while (isRunning()) {
sleep(chatTaskDelay);
if (isMessageUpdated()) {
if (person == null || currentMessage.text().startsWith("/settings")) {
Keyboard keyboard = new ReplyKeyboardMarkup(persons, true, false, false);
person = personsMap.get(currentMessage.text());
if (person == null) {
bot.sendMessage(currentMessage.chat().id(), "Выберите сторону", ParseMode.Markdown, null, null,
keyboard);
}
}
if (person != null) {
if (person.isConfig()) {
int day = 0;
if (currentMessage.text().startsWith("/tomorrow")) {
day = 1;
}
if (currentMessage.text().startsWith("/yesterday")) {
day = -1;
}
person.sendSchedule(bot, currentMessage, day);
} else {
person.config(bot, currentMessage);
}
}
System.out.printf("From %s(%s) task(%s): %s\n", chat.title(), currentMessage.from().username(), this.hashCode(),
currentMessage.text());
}
}
}
示例3: getKeyboard
import com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup; //导入依赖的package包/类
public static ReplyKeyboardMarkup getKeyboard(Collection<ICommand> values) {
return getKeyboard(values.toArray(new ICommand[values.size()]));
}
示例4: getKeyboardIgnoreHide
import com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup; //导入依赖的package包/类
public static ReplyKeyboardMarkup getKeyboardIgnoreHide(ICommand[] values) {
String[][] keyboard = getStrings(values, true);
return new ReplyKeyboardMarkup(keyboard, true, false, false);
}
示例5: simpleKeyboard
import com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup; //导入依赖的package包/类
private Keyboard simpleKeyboard() {
return new ReplyKeyboardMarkup(new String[]{"Get!"});
}