From 01f321d917729f86b5953d7cbfbe83552cb0f3dd Mon Sep 17 00:00:00 2001 From: Timo Schulz Date: Tue, 31 May 2016 19:53:06 +0200 Subject: [PATCH] remove commandbot example from readme --- README.md | 57 ------------------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/README.md b/README.md index be734913..e339dcb9 100644 --- a/README.md +++ b/README.md @@ -44,64 +44,7 @@ Once done, you just need to create a `org.telegram.telegrambots.TelegramBotsApi` } ``` -## Command Bot -In order to make commands work for your bot by using the `org.telegram.telegrambots.bots.TelegramLongPollingCommandBot` you can -just make your Bot extend this class instead of the `org.telegram.telegrambots.bots.TelegramLongPollingBot`. - -Since this bot inherits from `org.telegram.telegrambots.bots.commands.ICommandRegistry` it is capable of register- and -deregistering commands to your bot. - -Here is an example: - -```java - - public class Main { - - private static final String LOGTAG = "MAIN"; - - public static void main(String[] args) { - TelegramBotsApi telegramBotsApi = new TelegramBotsApi(); - try { - telegramBotsApi.registerBot(new MySuperSpecialBotHandler()); - } catch (TelegramApiException e) { - BotLogger.error(LOGTAG, e); - } - } - } -``` -```java - - public class MySuperSpecialBotHandler extends TelegramLongPollingCommandBot { - - private static final String LOGTAG = "MY_SUPER_SPECIAL_BOT_HANDLER"; - - public MySuperSpecialBotHandler() { - register(new BotCommand("mycommand", "This command just demonstrates the use of commands") { - @Override - public void execute(AbsSender absSender, Chat chat, String[] arguments) { - SendMessage sendMessage = new SendMessage(); - sendMessage.setText("Wow you finally used that command " + chat.getUserName()); - sendMessage.setChatId(chat.getId().toString()); - try { - absSender.sendMessage(sendMessage); - } catch (TelegramApiException e) { - BotLogger.error(LOGTAG, e); - } - } - }); - } - - @Override - public void processNonCommandUpdate(Update update) { - //All non command updates are passed to this method - } - - . - . - . - } -``` ## Example bots Open them and send them */help* command to get some information about their capabilities: