Merge pull request #113 from rubenlagus/revert-112-patch-1

Revert "Message filter for TelegramLongPollingCommandBot"
This commit is contained in:
Ruben Bermudez 2016-07-13 20:18:21 +02:00 committed by GitHub
commit 2d9ddb0a40

View File

@ -32,7 +32,7 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
public final void onUpdateReceived(Update update) {
if (update.hasMessage()) {
Message message = update.getMessage();
if ((message.isCommand()) && (filter(message))) {
if (message.isCommand()) {
if (commandRegistry.executeCommand(this, message)) {
return;
}
@ -41,19 +41,6 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
processNonCommandUpdate(update);
}
/**
* function message filter.
* Override this function in your bot implementation to filter messages with commands
*
* For example, if you want to prevent commands execution incoming from group chat:
* #
* # return !message.getChat().isGroupChat();
* #
*/
protected boolean filter(Message message) {
return true;
}
@Override
public final boolean register(BotCommand botCommand) {
return commandRegistry.register(botCommand);