cleanup
This commit is contained in:
parent
25dd6cb0dc
commit
2a7e2acc88
@ -43,12 +43,7 @@ public class AddSubCommand extends BatCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OptionMapping option = event.getOption("role");
|
OptionMapping option = event.getOption("role");
|
||||||
if (option == null) {
|
assert option != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("Please provide a role to add")
|
|
||||||
.build()).queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Role role = option.getAsRole();
|
Role role = option.getAsRole();
|
||||||
|
|
||||||
// Check if the role is already in the auto roles list
|
// Check if the role is already in the auto roles list
|
||||||
|
@ -32,12 +32,7 @@ public class RemoveSubCommand extends BatCommand {
|
|||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
|
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
|
||||||
OptionMapping option = event.getOption("role");
|
OptionMapping option = event.getOption("role");
|
||||||
if (option == null) {
|
assert option != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("Please provide a role to remove")
|
|
||||||
.build()).queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Role role = option.getAsRole();
|
Role role = option.getAsRole();
|
||||||
if (!profile.hasRole(role.getId())) {
|
if (!profile.hasRole(role.getId())) {
|
||||||
|
@ -9,13 +9,12 @@ import cc.fascinated.bat.features.base.commands.fun.image.ImageCommand;
|
|||||||
import cc.fascinated.bat.features.base.commands.general.*;
|
import cc.fascinated.bat.features.base.commands.general.*;
|
||||||
import cc.fascinated.bat.features.base.commands.general.avatar.AvatarCommand;
|
import cc.fascinated.bat.features.base.commands.general.avatar.AvatarCommand;
|
||||||
import cc.fascinated.bat.features.base.commands.general.banner.BannerCommand;
|
import cc.fascinated.bat.features.base.commands.general.banner.BannerCommand;
|
||||||
import cc.fascinated.bat.features.base.commands.utility.lookup.LookupCommand;
|
|
||||||
import cc.fascinated.bat.features.base.commands.utility.lookup.UserSubCommand;
|
|
||||||
import cc.fascinated.bat.features.base.commands.server.MemberCountCommand;
|
import cc.fascinated.bat.features.base.commands.server.MemberCountCommand;
|
||||||
import cc.fascinated.bat.features.base.commands.server.PremiumCommand;
|
import cc.fascinated.bat.features.base.commands.server.PremiumCommand;
|
||||||
import cc.fascinated.bat.features.base.commands.server.channel.ChannelCommand;
|
import cc.fascinated.bat.features.base.commands.server.channel.ChannelCommand;
|
||||||
import cc.fascinated.bat.features.base.commands.server.feature.FeatureCommand;
|
import cc.fascinated.bat.features.base.commands.server.feature.FeatureCommand;
|
||||||
import cc.fascinated.bat.features.base.commands.utility.PastebinCommand;
|
import cc.fascinated.bat.features.base.commands.utility.PastebinCommand;
|
||||||
|
import cc.fascinated.bat.features.base.commands.utility.lookup.LookupCommand;
|
||||||
import cc.fascinated.bat.service.CommandService;
|
import cc.fascinated.bat.service.CommandService;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -51,11 +51,10 @@ public class EightBallCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping questionOption = event.getOption("question");
|
OptionMapping questionOption = event.getOption("question");
|
||||||
if (questionOption == null) {
|
assert questionOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String question = questionOption.getAsString();
|
String question = questionOption.getAsString();
|
||||||
String response = responses[(int) (Math.random() * responses.length)];
|
String response = responses[(int) (Math.random() * responses.length)];
|
||||||
|
|
||||||
event.replyEmbeds(EmbedUtils.successEmbed()
|
event.replyEmbeds(EmbedUtils.successEmbed()
|
||||||
.setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
|
.setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
|
||||||
.build())
|
.build())
|
||||||
|
@ -22,7 +22,6 @@ public class GuildSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
ImageProxy icon = guild.getDiscordGuild().getIcon();
|
ImageProxy icon = guild.getDiscordGuild().getIcon();
|
||||||
|
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
.setDescription("**%s** does not have an avatar!".formatted(guild.getName()))
|
.setDescription("**%s** does not have an avatar!".formatted(guild.getName()))
|
||||||
|
@ -29,15 +29,9 @@ public class UserSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping userOption = event.getOption("user");
|
OptionMapping userOption = event.getOption("user");
|
||||||
if (userOption == null) {
|
assert userOption != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("You must provide a user to view the avatar of!")
|
|
||||||
.build())
|
|
||||||
.queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
User target = userOption.getAsUser();
|
User target = userOption.getAsUser();
|
||||||
|
|
||||||
event.replyEmbeds(EmbedUtils.genericEmbed()
|
event.replyEmbeds(EmbedUtils.genericEmbed()
|
||||||
.setAuthor("%s's Avatar".formatted(target.getName()), null, target.getEffectiveAvatarUrl())
|
.setAuthor("%s's Avatar".formatted(target.getName()), null, target.getEffectiveAvatarUrl())
|
||||||
.setImage(target.getEffectiveAvatarUrl())
|
.setImage(target.getEffectiveAvatarUrl())
|
||||||
|
@ -30,14 +30,7 @@ public class UserSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping userOption = event.getOption("user");
|
OptionMapping userOption = event.getOption("user");
|
||||||
if (userOption == null) {
|
assert userOption != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("You must provide a user to view the banner of!")
|
|
||||||
.build())
|
|
||||||
.queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
User target = userOption.getAsUser();
|
User target = userOption.getAsUser();
|
||||||
ImageProxy banner = target.retrieveProfile().complete().getBanner();
|
ImageProxy banner = target.retrieveProfile().complete().getBanner();
|
||||||
if (banner == null) {
|
if (banner == null) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package cc.fascinated.bat.features.base.commands.utility.lookup;
|
package cc.fascinated.bat.features.base.commands.utility.lookup;
|
||||||
|
|
||||||
import cc.fascinated.bat.command.BatCommand;
|
import cc.fascinated.bat.command.BatCommand;
|
||||||
import cc.fascinated.bat.command.Category;
|
|
||||||
import cc.fascinated.bat.command.CommandInfo;
|
import cc.fascinated.bat.command.CommandInfo;
|
||||||
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
|
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
|
||||||
import cc.fascinated.bat.common.EmbedUtils;
|
import cc.fascinated.bat.common.EmbedUtils;
|
||||||
|
@ -33,14 +33,9 @@ public class MessageSubCommand extends BatCommand {
|
|||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||||
OptionMapping messageOption = event.getOption("message");
|
OptionMapping messageOption = event.getOption("message");
|
||||||
if (messageOption == null) {
|
assert messageOption != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("You must provide a message")
|
|
||||||
.build()).queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String message = messageOption.getAsString();
|
String message = messageOption.getAsString();
|
||||||
|
|
||||||
if (message.length() > 2000) {
|
if (message.length() > 2000) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
.setDescription("The message must be less than 2000 characters")
|
.setDescription("The message must be less than 2000 characters")
|
||||||
|
@ -33,14 +33,9 @@ public class PrivateSubCommand extends BatCommand {
|
|||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||||
OptionMapping enabledOption = event.getOption("enabled");
|
OptionMapping enabledOption = event.getOption("enabled");
|
||||||
if (enabledOption == null) {
|
assert enabledOption != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("You must provide whether your birthday is private or not")
|
|
||||||
.build()).queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean enabled = enabledOption.getAsBoolean();
|
boolean enabled = enabledOption.getAsBoolean();
|
||||||
|
|
||||||
UserBirthday birthday = profile.getBirthday(user.getId());
|
UserBirthday birthday = profile.getBirthday(user.getId());
|
||||||
if (birthday == null) {
|
if (birthday == null) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
|
@ -46,13 +46,9 @@ public class SetSubCommand extends BatCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OptionMapping birthdayOption = event.getOption("birthday");
|
OptionMapping birthdayOption = event.getOption("birthday");
|
||||||
if (birthdayOption == null) {
|
assert birthdayOption != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("You must provide a birthday")
|
|
||||||
.build()).queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String birthdayString = birthdayOption.getAsString();
|
String birthdayString = birthdayOption.getAsString();
|
||||||
|
|
||||||
Date birthday = parseBirthday(birthdayString);
|
Date birthday = parseBirthday(birthdayString);
|
||||||
if (birthday == null) {
|
if (birthday == null) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
|
@ -34,9 +34,7 @@ public class RemoveSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping channelOption = event.getOption("channel");
|
OptionMapping channelOption = event.getOption("channel");
|
||||||
if (channelOption == null) {
|
assert channelOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
||||||
if (targetChannel.getType() != ChannelType.TEXT) {
|
if (targetChannel.getType() != ChannelType.TEXT) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
|
@ -34,10 +34,10 @@ public class SetBreakingSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping channelOption = event.getOption("channel");
|
OptionMapping channelOption = event.getOption("channel");
|
||||||
|
assert channelOption != null;
|
||||||
OptionMapping breakableOption = event.getOption("breakable");
|
OptionMapping breakableOption = event.getOption("breakable");
|
||||||
if (channelOption == null || breakableOption == null) {
|
assert breakableOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
||||||
if (targetChannel.getType() != ChannelType.TEXT) {
|
if (targetChannel.getType() != ChannelType.TEXT) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
|
@ -34,10 +34,10 @@ public class SetSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping channelOption = event.getOption("channel");
|
OptionMapping channelOption = event.getOption("channel");
|
||||||
|
assert channelOption != null;
|
||||||
OptionMapping countOption = event.getOption("count");
|
OptionMapping countOption = event.getOption("count");
|
||||||
if (channelOption == null || countOption == null) {
|
assert countOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
||||||
if (targetChannel.getType() != ChannelType.TEXT) {
|
if (targetChannel.getType() != ChannelType.TEXT) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
|
@ -33,10 +33,9 @@ public class SetupSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping channelOption = event.getOption("channel");
|
OptionMapping channelOption = event.getOption("channel");
|
||||||
|
assert channelOption != null;
|
||||||
OptionMapping breakableOption = event.getOption("breakable");
|
OptionMapping breakableOption = event.getOption("breakable");
|
||||||
if (channelOption == null || breakableOption == null) {
|
assert breakableOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
||||||
if (targetChannel.getType() != ChannelType.TEXT) {
|
if (targetChannel.getType() != ChannelType.TEXT) {
|
||||||
|
@ -77,7 +77,7 @@ public class RequestSubCommand extends BatCommand implements EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OptionMapping userOption = event.getOption("user");
|
OptionMapping userOption = event.getOption("user");
|
||||||
if (userOption == null) return;
|
assert userOption != null;
|
||||||
|
|
||||||
// Check if the user is in a voice channel
|
// Check if the user is in a voice channel
|
||||||
Member target = userOption.getAsMember();
|
Member target = userOption.getAsMember();
|
||||||
|
@ -37,9 +37,8 @@ public class ChannelSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping channelOption = event.getOption("channel");
|
OptionMapping channelOption = event.getOption("channel");
|
||||||
if (channelOption == null) {
|
assert channelOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
GuildChannelUnion channelUnion = channelOption.getAsChannel();
|
GuildChannelUnion channelUnion = channelOption.getAsChannel();
|
||||||
TextChannel textChannel = channelUnion.asTextChannel();
|
TextChannel textChannel = channelUnion.asTextChannel();
|
||||||
LevelingProfile profile = guild.getLevelingProfile();
|
LevelingProfile profile = guild.getLevelingProfile();
|
||||||
|
@ -37,9 +37,8 @@ public class ResetSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping userOption = event.getOption("user");
|
OptionMapping userOption = event.getOption("user");
|
||||||
if (userOption == null) {
|
assert userOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
User target = userOption.getAsUser();
|
User target = userOption.getAsUser();
|
||||||
LevelingProfile profile = guild.getLevelingProfile();
|
LevelingProfile profile = guild.getLevelingProfile();
|
||||||
UserLevel level = profile.getUserLevel(target.getId());
|
UserLevel level = profile.getUserLevel(target.getId());
|
||||||
|
@ -34,9 +34,8 @@ public class RemoveSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping typeOption = event.getOption("type");
|
OptionMapping typeOption = event.getOption("type");
|
||||||
if (typeOption == null) {
|
assert typeOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String type = typeOption.getAsString();
|
String type = typeOption.getAsString();
|
||||||
LogProfile profile = guild.getLogProfile();
|
LogProfile profile = guild.getLogProfile();
|
||||||
|
|
||||||
|
@ -38,13 +38,10 @@ public class SetSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping typeOption = event.getOption("type");
|
OptionMapping typeOption = event.getOption("type");
|
||||||
if (typeOption == null) {
|
assert typeOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
OptionMapping channelOption = event.getOption("channel");
|
OptionMapping channelOption = event.getOption("channel");
|
||||||
if (channelOption == null) {
|
assert channelOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String type = typeOption.getAsString();
|
String type = typeOption.getAsString();
|
||||||
TextChannel targetChannel = channelOption.getAsChannel().asTextChannel();
|
TextChannel targetChannel = channelOption.getAsChannel().asTextChannel();
|
||||||
LogProfile profile = guild.getLogProfile();
|
LogProfile profile = guild.getLogProfile();
|
||||||
|
@ -36,11 +36,9 @@ public class LookupPlayerSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping playerOption = event.getOption("player");
|
OptionMapping playerOption = event.getOption("player");
|
||||||
if (playerOption == null) {
|
assert playerOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String player = playerOption.getAsString();
|
|
||||||
|
|
||||||
|
String player = playerOption.getAsString();
|
||||||
CachedPlayer cachedPlayer = McUtilsAPI.getPlayer(player);
|
CachedPlayer cachedPlayer = McUtilsAPI.getPlayer(player);
|
||||||
if (cachedPlayer == null) {
|
if (cachedPlayer == null) {
|
||||||
event.reply("The player `%s` could not be found".formatted(player)).queue();
|
event.reply("The player `%s` could not be found".formatted(player)).queue();
|
||||||
|
@ -40,13 +40,12 @@ public class LookupServerSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping platformOption = event.getOption("platform");
|
OptionMapping platformOption = event.getOption("platform");
|
||||||
|
assert platformOption != null;
|
||||||
OptionMapping hostOption = event.getOption("host");
|
OptionMapping hostOption = event.getOption("host");
|
||||||
if (platformOption == null || hostOption == null) {
|
assert hostOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String platform = platformOption.getAsString();
|
String platform = platformOption.getAsString();
|
||||||
String host = hostOption.getAsString();
|
String host = hostOption.getAsString();
|
||||||
|
|
||||||
MinecraftServer server;
|
MinecraftServer server;
|
||||||
try {
|
try {
|
||||||
if (platform.equalsIgnoreCase("java")) {
|
if (platform.equalsIgnoreCase("java")) {
|
||||||
|
@ -43,16 +43,16 @@ public class AddSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping platformOption = event.getOption("platform");
|
OptionMapping platformOption = event.getOption("platform");
|
||||||
|
assert platformOption != null;
|
||||||
OptionMapping hostOption = event.getOption("host");
|
OptionMapping hostOption = event.getOption("host");
|
||||||
|
assert hostOption != null;
|
||||||
OptionMapping channelOption = event.getOption("channel");
|
OptionMapping channelOption = event.getOption("channel");
|
||||||
if (platformOption == null || hostOption == null || channelOption == null) {
|
assert channelOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String platform = platformOption.getAsString();
|
String platform = platformOption.getAsString();
|
||||||
String host = hostOption.getAsString();
|
String host = hostOption.getAsString();
|
||||||
GuildChannelUnion channelUnion = channelOption.getAsChannel();
|
GuildChannelUnion channelUnion = channelOption.getAsChannel();
|
||||||
TextChannel textChannel = channelUnion.asTextChannel();
|
TextChannel textChannel = channelUnion.asTextChannel();
|
||||||
|
|
||||||
MinecraftServer server;
|
MinecraftServer server;
|
||||||
try {
|
try {
|
||||||
if (platform.equalsIgnoreCase("java")) {
|
if (platform.equalsIgnoreCase("java")) {
|
||||||
|
@ -38,10 +38,10 @@ public class RemoveSubCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping platformOption = event.getOption("platform");
|
OptionMapping platformOption = event.getOption("platform");
|
||||||
|
assert platformOption != null;
|
||||||
OptionMapping hostOption = event.getOption("host");
|
OptionMapping hostOption = event.getOption("host");
|
||||||
if (platformOption == null || hostOption == null) {
|
assert hostOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String platform = platformOption.getAsString();
|
String platform = platformOption.getAsString();
|
||||||
String host = hostOption.getAsString();
|
String host = hostOption.getAsString();
|
||||||
|
|
||||||
|
@ -36,9 +36,8 @@ public class PurgeCommand extends BatCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping amountOption = event.getOption("amount");
|
OptionMapping amountOption = event.getOption("amount");
|
||||||
if (amountOption == null) {
|
assert amountOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
int amount = amountOption.getAsInt();
|
int amount = amountOption.getAsInt();
|
||||||
if (amount < 2 || amount > 100) {
|
if (amount < 2 || amount > 100) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
|
@ -45,13 +45,9 @@ public class SetSubCommand extends BatCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OptionMapping reminderOption = event.getOption("reminder");
|
OptionMapping reminderOption = event.getOption("reminder");
|
||||||
if (reminderOption == null) {
|
assert reminderOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
OptionMapping timeOption = event.getOption("time");
|
OptionMapping timeOption = event.getOption("time");
|
||||||
if (timeOption == null) {
|
assert timeOption != null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String reminderText = reminderOption.getAsString();
|
String reminderText = reminderOption.getAsString();
|
||||||
long time = TimeUtils.fromString(timeOption.getAsString());
|
long time = TimeUtils.fromString(timeOption.getAsString());
|
||||||
|
@ -33,17 +33,10 @@ public class LinkSubCommand extends BatCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping option = event.getOption("link");
|
OptionMapping linkOption = event.getOption("link");
|
||||||
if (option == null) {
|
assert linkOption != null;
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
|
||||||
.setDescription("Please provide a ScoreSaber profile link")
|
|
||||||
.build())
|
|
||||||
.setEphemeral(true)
|
|
||||||
.queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String link = option.getAsString();
|
String link = linkOption.getAsString();
|
||||||
if (!link.contains("scoresaber.com/u/")) {
|
if (!link.contains("scoresaber.com/u/")) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
.setDescription("Invalid ScoreSaber profile link")
|
.setDescription("Invalid ScoreSaber profile link")
|
||||||
|
@ -35,11 +35,10 @@ public class UserSubCommand extends BatCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||||
OptionMapping option = event.getOption("user");
|
OptionMapping userOption = event.getOption("user");
|
||||||
if (option == null) {
|
assert userOption != null;
|
||||||
return;
|
|
||||||
}
|
BatUser target = userService.getUser(userOption.getAsUser().getId());
|
||||||
BatUser target = userService.getUser(option.getAsUser().getId());
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||||
.setDescription("Unknown user")
|
.setDescription("Unknown user")
|
||||||
|
Loading…
Reference in New Issue
Block a user