Add /always command

"helps with whiny ass bitches"
This commit is contained in:
Mark Vainomaa 2016-10-04 21:02:19 +03:00
parent f685e40c1e
commit a8562a288f
3 changed files with 31 additions and 1 deletions

View File

@ -102,5 +102,4 @@
<version>v2.3.5</version>
</dependency>
</dependencies>
</project>

View File

@ -1,5 +1,6 @@
package eu.mikroskeem.bot.maerahn;
import eu.mikroskeem.bot.maerahn.commands.AlwaysCommand;
import eu.mikroskeem.bot.maerahn.commands.LennyCommand;
import eu.mikroskeem.bot.maerahn.commands.ShrugCommand;
import lombok.Getter;
@ -19,6 +20,7 @@ public class Bot extends TelegramLongPollingCommandBot {
//register(new FacepalmCommand(this));
register(new ShrugCommand(this));
register(new LennyCommand(this));
register(new AlwaysCommand(this));
registerDefaultAction((sender, 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 AlwaysCommand extends BotCommand {
Logger logger;
public AlwaysCommand(Bot bot){
super("always", "Send pic of always");
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/BoVfl7R.png");
try {
absSender.sendMessage(message);
} catch (TelegramApiException e){
logger.error("Failed to send reply for /always command!");
e.printStackTrace();
}
}
}