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


Java SendMessage.setReplyToMessageId方法代码示例

本文整理汇总了Java中org.telegram.telegrambots.api.methods.send.SendMessage.setReplyToMessageId方法的典型用法代码示例。如果您正苦于以下问题:Java SendMessage.setReplyToMessageId方法的具体用法?Java SendMessage.setReplyToMessageId怎么用?Java SendMessage.setReplyToMessageId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.telegrambots.api.methods.send.SendMessage的用法示例。


在下文中一共展示了SendMessage.setReplyToMessageId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendHelpMessage

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private void sendHelpMessage(Long chatId, Integer messageId, ReplyKeyboardMarkup replyKeyboardMarkup) {
    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);
    sendMessage.setChatId(chatId);
    sendMessage.setReplyToMessageId(messageId);
    if (replyKeyboardMarkup != null) {
        sendMessage.setReplyMarkup(replyKeyboardMarkup);
    }

    sendMessage.setText(HELP_TEXT);
    try {
        sendMessage(sendMessage);
    } catch (TelegramApiException e) {
        BotLogger.error(LOGTAG, e);
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:17,代码来源:ChannelHandlers.java

示例2: sendMovedToMessage

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private void sendMovedToMessage(Message message) throws InvalidObjectException, TelegramApiException {
    String language = DatabaseManager.getInstance().getUserLanguage(message.getFrom().getId());
    SendMessage answer = new SendMessage();
    answer.setChatId(message.getChatId());
    answer.setReplyToMessageId(message.getMessageId());
    answer.setText(LocalisationService.getString("movedToLangBot", language));
    InlineKeyboardMarkup inlineKeyboardMarkup = new InlineKeyboardMarkup();
    List<List<InlineKeyboardButton>> rows = new ArrayList<>();
    List<InlineKeyboardButton> row = new ArrayList<>();
    InlineKeyboardButton button = new InlineKeyboardButton();
    button.setText(LocalisationService.getString("checkLangBot", language));
    button.setUrl("https://telegram.me/langbot");
    row.add(button);
    rows.add(row);
    inlineKeyboardMarkup.setKeyboard(rows);
    answer.setReplyMarkup(inlineKeyboardMarkup);
    sendMessage(answer);
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:19,代码来源:TransifexHandlers.java

示例3: onForecastWeatherCityReceived

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onForecastWeatherCityReceived(Long chatId, Integer userId, Integer messageId, String text, String language) {
    Integer cityId = DatabaseManager.getInstance().getRecentWeatherIdByCity(userId, text);
    if (cityId != null) {
        String unitsSystem = DatabaseManager.getInstance().getUserWeatherOptions(userId)[1];
        String weather = WeatherService.getInstance().fetchWeatherForecast(cityId.toString(), userId, language, unitsSystem);
        SendMessage sendMessageRequest = new SendMessage();
        sendMessageRequest.enableMarkdown(true);
        sendMessageRequest.setReplyMarkup(getMainMenuKeyboard(language));
        sendMessageRequest.setReplyToMessageId(messageId);
        sendMessageRequest.setText(weather);
        sendMessageRequest.setChatId(chatId.toString());

        DatabaseManager.getInstance().insertWeatherState(userId, chatId, MAINMENU);
        return sendMessageRequest;
    } else {
        return sendChooseOptionMessage(chatId, messageId, getRecentsKeyboard(userId, language), language);
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:19,代码来源:WeatherHandlers.java

示例4: onForecastChoosen

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onForecastChoosen(Message message, String language) {
    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);

    ReplyKeyboardMarkup replyKeyboardMarkup = getRecentsKeyboard(message.getFrom().getId(), language);
    sendMessage.setReplyMarkup(replyKeyboardMarkup);
    sendMessage.setReplyToMessageId(message.getMessageId());
    sendMessage.setChatId(message.getChatId());
    if (replyKeyboardMarkup.getKeyboard().size() > 3) {
        sendMessage.setText(LocalisationService.getString("onForecastCommandFromHistory", language));
    } else {
        sendMessage.setText(LocalisationService.getString("onForecastCommandWithoutHistory", language));
    }

    DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), FORECASTWEATHER);
    return sendMessage;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:18,代码来源:WeatherHandlers.java

示例5: onLanguageReceived

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private void onLanguageReceived(Message message) throws InvalidObjectException, TelegramApiException {
    String[] parts = message.getText().split(Emoji.LEFT_RIGHT_ARROW.toString(), 2);
    SendMessage sendMessageRequest = new SendMessage();
    sendMessageRequest.setChatId(message.getChatId());
    if (LocalisationService.getLanguageByCode(parts[0].trim()) != null) {
        DatabaseManager.getInstance().putUserLanguage(message.getFrom().getId(), parts[0].trim());
        sendMessageRequest.setText(LocalisationService.getString("languageModified", parts[0].trim()));
    } else {
        sendMessageRequest.setText(LocalisationService.getString("errorLanguage"));
    }
    sendMessageRequest.setReplyToMessageId(message.getMessageId());
    ReplyKeyboardRemove replyKeyboardRemove = new ReplyKeyboardRemove();
    replyKeyboardRemove.setSelective(true);
    sendMessageRequest.setReplyMarkup(replyKeyboardRemove);
    sendMessage(sendMessageRequest);
    languageMessages.remove(message.getFrom().getId());
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:18,代码来源:FilesHandlers.java

示例6: onDeleteAlertCommand

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onDeleteAlertCommand(Message message, String language) {
    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);

    sendMessage.setChatId(message.getChatId());

    ReplyKeyboardMarkup replyKeyboardMarkup = getAlertsListKeyboard(message.getFrom().getId(), language);
    if (replyKeyboardMarkup != null) {
        sendMessage.setReplyMarkup(replyKeyboardMarkup);
        sendMessage.setText(LocalisationService.getString("chooseNewAlertCity", language));
        DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), ALERTDELETE);
    } else {
        sendMessage.setReplyMarkup(getAlertsKeyboard(language));
        sendMessage.setText(LocalisationService.getString("noAlertList", language));
    }

    sendMessage.setReplyToMessageId(message.getMessageId());
    return sendMessage;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:20,代码来源:WeatherHandlers.java

示例7: createMessageWithKeyboard

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
/**
 * Отправка сообщения с клавиатурой и текстом
 * сообщение отправляется с прикреплённым запросом пользователя
 *
 * @param chatId
 * @param messageId
 * @param text
 * @param replyKeyboardMarkup
 * @return
 */
SendMessage createMessageWithKeyboard(final String chatId,
                                      final Integer messageId,
                                      final String text,
                                      final ReplyKeyboardMarkup replyKeyboardMarkup) {
    final SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);
    sendMessage.setChatId(chatId);
    sendMessage.setReplyToMessageId(messageId);
    sendMessage.setText(text);
    if (replyKeyboardMarkup != null) {
        sendMessage.setReplyMarkup(replyKeyboardMarkup);
    }
    return sendMessage;
}
 
开发者ID:SammyVimes,项目名称:gopstopbot,代码行数:25,代码来源:Controller.java

示例8: createMessageWithKeyboard

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private SendMessage createMessageWithKeyboard(final String chatId, final Integer messageId, final ReplyKeyboardMarkup replyKeyboardMarkup) {

        final SendMessage sendMessage = new SendMessage();
        sendMessage.enableMarkdown(true);
        sendMessage.setChatId(chatId);
        sendMessage.setReplyToMessageId(messageId);

        if (replyKeyboardMarkup != null) {
            sendMessage.setReplyMarkup(replyKeyboardMarkup);
        }

        return sendMessage;
    }
 
开发者ID:SammyVimes,项目名称:gopstopbot,代码行数:14,代码来源:TGBot.java

示例9: sendErrorMessage

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private void sendErrorMessage(Message message, String errorText) {
    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);
    sendMessage.setChatId(message.getChatId());
    sendMessage.setReplyToMessageId(message.getMessageId());

    sendMessage.setText(String.format(ERROR_MESSAGE_TEXT, message.getText().trim(), errorText.replace("\"", "\\\"")));
    sendMessage.enableMarkdown(true);

    try {
        sendMessage(sendMessage);
    } catch (TelegramApiException e) {
        BotLogger.error(LOGTAG, e);
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:16,代码来源:ChannelHandlers.java

示例10: onLanguageChosen

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onLanguageChosen(Integer userId, Long chatId, Integer messageId, String language) {
    String languageCode = LocalisationService.getLanguageCodeByName(language);
    DatabaseManager.getInstance().putUserWeatherLanguageOption(userId, languageCode);

    SendMessage sendMessageRequest = new SendMessage();
    sendMessageRequest.enableMarkdown(true);
    sendMessageRequest.setChatId(chatId.toString());
    sendMessageRequest.setText(LocalisationService.getString("languageUpdated", languageCode));
    sendMessageRequest.setReplyToMessageId(messageId);
    sendMessageRequest.setReplyMarkup(getMainMenuKeyboard(languageCode));

    DatabaseManager.getInstance().insertWeatherState(userId, chatId, MAINMENU);
    return sendMessageRequest;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:15,代码来源:WeatherHandlers.java

示例11: onLocationCurrentWeatherCommand

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onLocationCurrentWeatherCommand(Long chatId, Integer userId, Integer messageId, String language) {
    ForceReplyKeyboard forceReplyKeyboard = getForceReply();

    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);
    sendMessage.setChatId(chatId.toString());
    sendMessage.setReplyToMessageId(messageId);
    sendMessage.setReplyMarkup(forceReplyKeyboard);
    sendMessage.setText(LocalisationService.getString("onWeatherLocationCommand", language));

    DatabaseManager.getInstance().insertWeatherState(userId, chatId, CURRENTLOCATIONWEATHER);
    return sendMessage;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:14,代码来源:WeatherHandlers.java

示例12: onAlertDeleteCityOptionSelected

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onAlertDeleteCityOptionSelected(Message message, String language) {
    DatabaseManager.getInstance().deleteAlertCity(message.getFrom().getId(), message.getText());
    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);
    sendMessage.setReplyToMessageId(message.getMessageId());
    sendMessage.setChatId(message.getChatId());
    sendMessage.setReplyMarkup(getAlertsKeyboard(language));
    sendMessage.setText(LocalisationService.getString("alertDeleted", language));

    DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), ALERT);
    return sendMessage;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:13,代码来源:WeatherHandlers.java

示例13: onLocationForecastWeatherCommand

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onLocationForecastWeatherCommand(Long chatId, Integer userId, Integer messageId, String language) {
    ForceReplyKeyboard forceReplyKeyboard = getForceReply();

    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);
    sendMessage.setChatId(chatId.toString());
    sendMessage.setReplyToMessageId(messageId);
    sendMessage.setReplyMarkup(forceReplyKeyboard);
    sendMessage.setText(LocalisationService.getString("onWeatherLocationCommand", language));

    DatabaseManager.getInstance().insertWeatherState(userId, chatId, FORECASTLOCATIONWEATHER);
    return sendMessage;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:14,代码来源:WeatherHandlers.java

示例14: onLanguageError

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onLanguageError(Long chatId, Integer messageId, String language) {
    SendMessage sendMessageRequest = new SendMessage();
    sendMessageRequest.enableMarkdown(true);
    sendMessageRequest.setChatId(chatId.toString());
    sendMessageRequest.setReplyMarkup(getLanguagesKeyboard(language));
    sendMessageRequest.setText(LocalisationService.getString("errorLanguageNotFound", language));
    sendMessageRequest.setReplyToMessageId(messageId);

    return sendMessageRequest;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:11,代码来源:WeatherHandlers.java

示例15: onNewForecastWeatherCommand

import org.telegram.telegrambots.api.methods.send.SendMessage; //导入方法依赖的package包/类
private static SendMessage onNewForecastWeatherCommand(Long chatId, Integer userId, Integer messageId, String language) {
    ForceReplyKeyboard forceReplyKeyboard = getForceReply();

    SendMessage sendMessage = new SendMessage();
    sendMessage.enableMarkdown(true);
    sendMessage.setChatId(chatId.toString());
    sendMessage.setReplyToMessageId(messageId);
    sendMessage.setReplyMarkup(forceReplyKeyboard);
    sendMessage.setText(LocalisationService.getString("onWeatherNewCommand", language));

    DatabaseManager.getInstance().insertWeatherState(userId, chatId, FORECASTNEWWEATHER);
    return sendMessage;
}
 
开发者ID:rubenlagus,项目名称:TelegramBotsExample,代码行数:14,代码来源:WeatherHandlers.java


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