Add ultrashrug command

This commit is contained in:
Mark Vainomaa 2016-11-29 00:20:34 +02:00
parent 20b920fd23
commit f1ccadec08
2 changed files with 30 additions and 0 deletions

View File

@ -22,6 +22,7 @@ public class Bot extends TelegramLongPollingCommandBot {
register(new InsultCommand(this)); register(new InsultCommand(this));
register(new KysCommand(this)); register(new KysCommand(this));
register(new PartyHardCommand(this)); register(new PartyHardCommand(this));
register(new UltrashrugCommand(this));
registerDefaultAction((sender, message)->{ registerDefaultAction((sender, message)->{
logger.info(Utils.logMessage(message)); logger.info(Utils.logMessage(message));

View File

@ -0,0 +1,29 @@
package eu.mikroskeem.bot.maerahn.commands;
import eu.mikroskeem.bot.maerahn.Bot;
import org.slf4j.Logger;
import org.telegram.telegrambots.TelegramApiException;
import org.telegram.telegrambots.api.methods.send.SendMessage;
import org.telegram.telegrambots.api.objects.Chat;
import org.telegram.telegrambots.api.objects.User;
import org.telegram.telegrambots.bots.AbsSender;
import org.telegram.telegrambots.bots.commands.BotCommand;
public class UltrashrugCommand extends BotCommand {
Logger logger;
public UltrashrugCommand(Bot bot){
super("ultrashrug", "Send ultrashrug");
logger = bot.logger;
}
@Override public void execute(AbsSender absSender, User user, Chat chat, String[] strings) {
SendMessage message = new SendMessage();
message.setChatId(chat.getId().toString());
message.setText("https://i.imgur.com/MyIOFpy.png");
try {
absSender.sendMessage(message);
} catch (TelegramApiException e){
logger.error("Failed to send reply for /ultrashrug command!");
e.printStackTrace();
}
}
}