Add more commands
This commit is contained in:
parent
99ab35ee9f
commit
20b920fd23
@ -1,9 +1,6 @@
|
||||
package eu.mikroskeem.bot.maerahn;
|
||||
|
||||
import eu.mikroskeem.bot.maerahn.commands.AlwaysCommand;
|
||||
import eu.mikroskeem.bot.maerahn.commands.InsultCommand;
|
||||
import eu.mikroskeem.bot.maerahn.commands.LennyCommand;
|
||||
import eu.mikroskeem.bot.maerahn.commands.ShrugCommand;
|
||||
import eu.mikroskeem.bot.maerahn.commands.*;
|
||||
import lombok.Getter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -23,6 +20,8 @@ public class Bot extends TelegramLongPollingCommandBot {
|
||||
register(new LennyCommand(this));
|
||||
register(new AlwaysCommand(this));
|
||||
register(new InsultCommand(this));
|
||||
register(new KysCommand(this));
|
||||
register(new PartyHardCommand(this));
|
||||
|
||||
registerDefaultAction((sender, message)->{
|
||||
logger.info(Utils.logMessage(message));
|
||||
|
@ -20,7 +20,11 @@ public class InsultCommand extends BotCommand {
|
||||
"https://i.imgur.com/Tg7Ayp6.png",
|
||||
"https://i.imgur.com/wovZxfq.png",
|
||||
"https://i.imgur.com/7h4CQoH.png",
|
||||
"https://i.imgur.com/4aRm55r.png"
|
||||
"https://i.imgur.com/4aRm55r.png",
|
||||
"https://i.imgur.com/c5eqY9V.png",
|
||||
"https://i.imgur.com/EbD6yFQ.png",
|
||||
"https://i.imgur.com/fuVqnV1.png",
|
||||
"https://i.imgur.com/9VneOvN.png"
|
||||
);
|
||||
public InsultCommand(Bot bot){
|
||||
super("insult", "Send random insult");
|
||||
|
@ -0,0 +1,46 @@
|
||||
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;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
//
|
||||
public class KysCommand extends BotCommand {
|
||||
private Random randomGenerator = new Random();
|
||||
Logger logger;
|
||||
private final List<String> kysPics = Arrays.asList(
|
||||
"https://i.imgur.com/uHxOz9A.png",
|
||||
"https://i.imgur.com/CujbZbz.png",
|
||||
"https://i.imgur.com/H1cJtPq.png",
|
||||
"https://i.imgur.com/jANZZUW.gif",
|
||||
"https://i.imgur.com/QmuAfnf.png",
|
||||
"https://i.imgur.com/A6ZRQ0f.png",
|
||||
"https://i.imgur.com/riZvq9M.png",
|
||||
"https://i.imgur.com/ZZOYNNC.png",
|
||||
"https://i.imgur.com/FACFvJE.gif"
|
||||
);
|
||||
public KysCommand(Bot bot){
|
||||
super("kys", "Send pic with tells you to kill yourself");
|
||||
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(kysPics.get(randomGenerator.nextInt(kysPics.size())));
|
||||
try {
|
||||
absSender.sendMessage(message);
|
||||
} catch (TelegramApiException e){
|
||||
logger.error("Failed to send reply for /kys command!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
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;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
//
|
||||
public class PartyHardCommand extends BotCommand {
|
||||
private Random randomGenerator = new Random();
|
||||
Logger logger;
|
||||
private final List<String> partyhards = Arrays.asList(
|
||||
"https://media.giphy.com/media/vg5ttW2Fx35zq/giphy.gif",
|
||||
"http://www.gifbin.com/bin/012012/1338313384_russian_guy_dances_with_beer.gif",
|
||||
"https://i.imgur.com/Wg5XVyK.gif",
|
||||
"https://i.imgur.com/5jvCR2r.gif",
|
||||
"https://i.imgur.com/zJklMAq.gif",
|
||||
"https://i.imgur.com/qu2ksL6.gif",
|
||||
"https://i.imgur.com/dO07YsQ.gif",
|
||||
"https://i.imgur.com/huTAYeZ.gif",
|
||||
"https://i.imgur.com/Jb4AABj.gif",
|
||||
"https://i.imgur.com/htDE2vu.gif",
|
||||
"https://i.imgur.com/ZpgiPx1.gif",
|
||||
"https://i.imgur.com/giaQAlI.gif"
|
||||
);
|
||||
public PartyHardCommand(Bot bot){
|
||||
super("partyhard", "Send random party hard gif");
|
||||
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(partyhards.get(randomGenerator.nextInt(partyhards.size())));
|
||||
try {
|
||||
absSender.sendMessage(message);
|
||||
} catch (TelegramApiException e){
|
||||
logger.error("Failed to send reply for /partyhard command!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user