package org.telegram.telegrambots.bots;

/**
 * @author Ruben Bermudez
 * @version 1.0
 * @brief TODO
 * @date 14 of January of 2016
 */
public abstract class TelegramLongPollingBot extends AbsSender implements ITelegramLongPollingBot {

}

@@ -38,203 +38,2545 @@
 s;%0A%0A
-/**%0A * @author Ruben Bermudez%0A * @version 1.0%0A * @brief TODO%0A * @date 14 of January of 2016%0A */%0Apublic abstract class TelegramLongPollingBot extends AbsSender implements ITelegramLongPollingBot %7B%0A%0A%7D%0A
+import org.telegram.telegrambots.BotLogger;%0Aimport org.telegram.telegrambots.TelegramApiException;%0Aimport org.telegram.telegrambots.api.commands.Command;%0Aimport org.telegram.telegrambots.api.commands.CommandRegistry;%0Aimport org.telegram.telegrambots.api.commands.ICommandRegistery;%0Aimport org.telegram.telegrambots.api.methods.send.SendMessage;%0Aimport org.telegram.telegrambots.api.objects.Message;%0Aimport org.telegram.telegrambots.api.objects.Update;%0A%0Aimport java.util.Collection;%0Aimport java.util.Map;%0A%0A/**%0A * @author Ruben Bermudez%0A * @version 1.0%0A * @brief TODO%0A * @date 14 of January of 2016%0A */%0Apublic abstract class TelegramLongPollingBot extends AbsSender implements ITelegramLongPollingBot, ICommandRegistery %7B%0A%0A    public static final String LOGTAG = %22TelegramLongPollingBot%22;%0A    private final CommandRegistry commandRegistry;%0A%0A    public TelegramLongPollingBot() %7B%0A        this.commandRegistry = new CommandRegistry(getBotToken());%0A    %7D%0A%0A    @Override%0A    public final void onUpdateReceived(Update update) %7B%0A        if (update.hasMessage()) %7B%0A            Message message = update.getMessage();%0A            if (message.isCommand()) %7B%0A                if (!commandRegistry.executeCommand(message)) %7B%0A                    SendMessage sendMessage = new SendMessage();%0A                    sendMessage.setChatId(message.getChatId());%0A                    sendMessage.setText(%22The command you provided is not registered for this bot%22);%0A                    try %7B%0A                        sendMessage(sendMessage);%0A                    %7D catch (TelegramApiException e) %7B%0A                        BotLogger.error(%22Cannot send message%22, LOGTAG, e);%0A                    %7D%0A                %7D%0A                return;%0A            %7D%0A        %7D%0A        processNonCommandUpdate(update);%0A    %7D%0A%0A    @Override%0A    public final boolean register(Command command) %7B%0A        return commandRegistry.register(command);%0A    %7D%0A%0A    @Override%0A    public final Map%3CCommand, Boolean%3E registerAll(Command... commands) %7B%0A        return commandRegistry.registerAll(commands);%0A    %7D%0A%0A    @Override%0A    public final boolean deregister(Command command) %7B%0A        return commandRegistry.deregister(command);%0A    %7D%0A%0A    @Override%0A    public final Map%3CCommand, Boolean%3E deregisterAll(Command... commands) %7B%0A        return commandRegistry.deregisterAll(commands);%0A    %7D%0A%0A    @Override%0A    public final Collection%3CCommand%3E getRegisteredCommands() %7B%0A        return commandRegistry.getRegisteredCommands();%0A    %7D%0A%0A    public abstract void processNonCommandUpdate(Update update);%0A%7D

Modify TelegramLongPollingBot to support commands