Compare commits
No commits in common. "72f9bb4eb5787974f295c5c9cce18db47213d1c1" and "9278b485d99c474da3e103a9827adc26edf44bcf" have entirely different histories.
72f9bb4eb5
...
9278b485d9
@ -131,7 +131,6 @@ public class HidekoBot
|
|||||||
// register message commands
|
// register message commands
|
||||||
MessageCommandListener messageCommandListener = new MessageCommandListener();
|
MessageCommandListener messageCommandListener = new MessageCommandListener();
|
||||||
messageCommandListener.registerCommand(new HelloCommand());
|
messageCommandListener.registerCommand(new HelloCommand());
|
||||||
messageCommandListener.registerCommand(new wtf.beatrice.hidekobot.commands.message.AliasCommand());
|
|
||||||
messageCommandListener.registerCommand(new wtf.beatrice.hidekobot.commands.message.AvatarCommand());
|
messageCommandListener.registerCommand(new wtf.beatrice.hidekobot.commands.message.AvatarCommand());
|
||||||
messageCommandListener.registerCommand(new wtf.beatrice.hidekobot.commands.message.BotInfoCommand());
|
messageCommandListener.registerCommand(new wtf.beatrice.hidekobot.commands.message.BotInfoCommand());
|
||||||
messageCommandListener.registerCommand(new wtf.beatrice.hidekobot.commands.message.CoinFlipCommand());
|
messageCommandListener.registerCommand(new wtf.beatrice.hidekobot.commands.message.CoinFlipCommand());
|
||||||
|
@ -16,7 +16,7 @@ public class MagicBall
|
|||||||
|
|
||||||
public static LinkedList<String> getLabels()
|
public static LinkedList<String> getLabels()
|
||||||
{
|
{
|
||||||
return new LinkedList<>(Arrays.asList("8ball", "8b", "eightball", "magicball"));
|
return new LinkedList<>(Arrays.asList("8ball", "eightball", "magicball", "8b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static List<String> answers = new ArrayList<>(
|
private final static List<String> answers = new ArrayList<>(
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
package wtf.beatrice.hidekobot.commands.message;
|
|
||||||
|
|
||||||
import net.dv8tion.jda.api.Permission;
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
|
||||||
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AliasCommand implements MessageCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LinkedList<String> getCommandLabels() {
|
|
||||||
return new LinkedList<>(Arrays.asList("alias", "aliases"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public List<Permission> getPermissions() {
|
|
||||||
return null; // anyone can use it
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean passRawArgs() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public CommandCategory getCategory() {
|
|
||||||
return CommandCategory.TOOLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void runCommand(MessageReceivedEvent event, String label, String[] args)
|
|
||||||
{
|
|
||||||
if(args.length == 0)
|
|
||||||
{
|
|
||||||
event.getMessage().reply("\uD83D\uDE20 Hey, you have to specify a command!").queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String commandLabel = args[0].toLowerCase();
|
|
||||||
MessageCommand command = Cache.getMessageCommandListener().getRegisteredCommand(commandLabel);
|
|
||||||
if(command == null)
|
|
||||||
{
|
|
||||||
event.getMessage().reply("Unrecognized command: `" + commandLabel + "`!").queue(); // todo prettier
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkedList<String> aliases = command.getCommandLabels();
|
|
||||||
StringBuilder aliasesStringBuilder = new StringBuilder();
|
|
||||||
aliasesStringBuilder.append("Aliases for **").append(aliases.get(0)).append("**: ");
|
|
||||||
for(int i = 0; i < aliases.size(); i++)
|
|
||||||
{
|
|
||||||
aliasesStringBuilder.append("`").append(aliases.get(i)).append("`");
|
|
||||||
|
|
||||||
if(i + 1 != aliases.size())
|
|
||||||
aliasesStringBuilder.append(", "); // separate with comma except on last iteration
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getMessage()
|
|
||||||
.reply(aliasesStringBuilder.toString())
|
|
||||||
.queue();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ import net.dv8tion.jda.api.entities.Mentions;
|
|||||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.HidekoBot;
|
import wtf.beatrice.hidekobot.HidekoBot;
|
||||||
@ -36,7 +35,6 @@ public class AvatarCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.TOOLS;
|
return CommandCategory.TOOLS;
|
||||||
|
@ -3,7 +3,6 @@ package wtf.beatrice.hidekobot.commands.message;
|
|||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.commands.base.BotInfo;
|
import wtf.beatrice.hidekobot.commands.base.BotInfo;
|
||||||
@ -33,7 +32,6 @@ public class BotInfoCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.TOOLS;
|
return CommandCategory.TOOLS;
|
||||||
|
@ -4,7 +4,6 @@ import net.dv8tion.jda.api.Permission;
|
|||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.commands.base.ClearChat;
|
import wtf.beatrice.hidekobot.commands.base.ClearChat;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
@ -29,7 +28,6 @@ public class ClearCommand implements MessageCommand
|
|||||||
public boolean passRawArgs() {
|
public boolean passRawArgs() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.MODERATION;
|
return CommandCategory.MODERATION;
|
||||||
|
@ -2,7 +2,6 @@ package wtf.beatrice.hidekobot.commands.message;
|
|||||||
|
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.commands.base.CoinFlip;
|
import wtf.beatrice.hidekobot.commands.base.CoinFlip;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
@ -31,7 +30,6 @@ public class CoinFlipCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.FUN;
|
return CommandCategory.FUN;
|
||||||
|
@ -3,7 +3,6 @@ package wtf.beatrice.hidekobot.commands.message;
|
|||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.objects.Dice;
|
import wtf.beatrice.hidekobot.objects.Dice;
|
||||||
@ -30,7 +29,6 @@ public class DiceRollCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.FUN;
|
return CommandCategory.FUN;
|
||||||
|
@ -2,7 +2,6 @@ package wtf.beatrice.hidekobot.commands.message;
|
|||||||
|
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
|
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
|
||||||
|
|
||||||
@ -26,7 +25,6 @@ public class HelloCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.FUN;
|
return CommandCategory.FUN;
|
||||||
|
@ -4,7 +4,6 @@ import net.dv8tion.jda.api.EmbedBuilder;
|
|||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.apache.commons.text.WordUtils;
|
import org.apache.commons.text.WordUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.commands.base.Say;
|
import wtf.beatrice.hidekobot.commands.base.Say;
|
||||||
@ -34,7 +33,6 @@ public class HelpCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.TOOLS;
|
return CommandCategory.TOOLS;
|
||||||
|
@ -5,7 +5,6 @@ import net.dv8tion.jda.api.entities.MessageEmbed;
|
|||||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.commands.base.Invite;
|
import wtf.beatrice.hidekobot.commands.base.Invite;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
@ -34,7 +33,6 @@ public class InviteCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.FUN;
|
return CommandCategory.FUN;
|
||||||
|
@ -6,7 +6,6 @@ import net.dv8tion.jda.api.entities.IMentionable;
|
|||||||
import net.dv8tion.jda.api.entities.Mentions;
|
import net.dv8tion.jda.api.entities.Mentions;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.HidekoBot;
|
import wtf.beatrice.hidekobot.HidekoBot;
|
||||||
@ -39,7 +38,6 @@ public class LoveCalculatorCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.FUN;
|
return CommandCategory.FUN;
|
||||||
|
@ -2,7 +2,6 @@ package wtf.beatrice.hidekobot.commands.message;
|
|||||||
|
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.commands.base.MagicBall;
|
import wtf.beatrice.hidekobot.commands.base.MagicBall;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
@ -30,7 +29,6 @@ public class MagicBallCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.FUN;
|
return CommandCategory.FUN;
|
||||||
|
@ -2,7 +2,6 @@ package wtf.beatrice.hidekobot.commands.message;
|
|||||||
|
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.commands.base.Say;
|
import wtf.beatrice.hidekobot.commands.base.Say;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
@ -30,7 +29,6 @@ public class SayCommand implements MessageCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.TOOLS;
|
return CommandCategory.TOOLS;
|
||||||
|
@ -4,7 +4,6 @@ import net.dv8tion.jda.api.Permission;
|
|||||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
@ -36,7 +35,6 @@ public class UrbanDictionaryCommand implements MessageCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
return CommandCategory.FUN;
|
return CommandCategory.FUN;
|
||||||
|
@ -2,7 +2,6 @@ package wtf.beatrice.hidekobot.objects.commands;
|
|||||||
|
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -45,7 +44,6 @@ public interface MessageCommand
|
|||||||
*
|
*
|
||||||
* @return the command category.
|
* @return the command category.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
|
||||||
CommandCategory getCategory();
|
CommandCategory getCategory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user