当前位置: 首页>>代码示例>>Java>>正文


Java ReplyKeyboardMarkup类代码示例

本文整理汇总了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;
        }
    }
 
开发者ID:Rai220,项目名称:Telephoto,代码行数:27,代码来源:MinutesCommand.java

示例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());
		}
	}
}
 
开发者ID:MickevichYura,项目名称:grsu-schedule,代码行数:39,代码来源:GrsuScheduleChatTask.java

示例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()]));
}
 
开发者ID:Rai220,项目名称:Telephoto,代码行数:4,代码来源:KeyboardUtils.java

示例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);
}
 
开发者ID:Rai220,项目名称:Telephoto,代码行数:5,代码来源:KeyboardUtils.java

示例5: simpleKeyboard

import com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup; //导入依赖的package包/类
private Keyboard simpleKeyboard() {
    return new ReplyKeyboardMarkup(new String[]{"Get!"});
}
 
开发者ID:pengrad,项目名称:java-telegram-bot-api,代码行数:4,代码来源:AqivnBot.java


注:本文中的com.pengrad.telegrambot.model.request.ReplyKeyboardMarkup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。