rename interaction to event

This commit is contained in:
Lee 2024-07-01 15:27:39 +01:00
parent 8361f3c784
commit f2b2dbc794
53 changed files with 199 additions and 199 deletions

@ -12,20 +12,20 @@ import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
*/ */
public interface BatCommandExecutor { public interface BatCommandExecutor {
/** /**
* Executes the command using a slash command interaction. * Executes the command using a slash command event.
* *
* @param guild the bat guild the command was executed in (null if the command was executed in a DM) * @param guild the bat guild the command was executed in (null if the command was executed in a DM)
* @param user the bat user that executed the command * @param user the bat user that executed the command
* @param channel the channel the command was executed in * @param channel the channel the command was executed in
* @param member the member that executed the command * @param member the member that executed the command
* @param interaction the slash command interaction * @param event the slash command event
*/ */
default void execute( default void execute(
BatGuild guild, BatGuild guild,
@NonNull BatUser user, @NonNull BatUser user,
@NonNull MessageChannel channel, @NonNull MessageChannel channel,
Member member, Member member,
@NonNull SlashCommandInteraction interaction @NonNull SlashCommandInteraction event
) { ) {
} }
} }

@ -25,16 +25,16 @@ public class AfkCommand extends BatCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
AfkProfile profile = guild.getProfile(AfkProfile.class); AfkProfile profile = guild.getProfile(AfkProfile.class);
String reason = null; String reason = null;
OptionMapping reasonOption = interaction.getOption("reason"); OptionMapping reasonOption = event.getOption("reason");
if (reasonOption != null) { if (reasonOption != null) {
reason = reasonOption.getAsString(); reason = reasonOption.getAsString();
} }
profile.addAfkUser(guild, member.getId(), reason); profile.addAfkUser(guild, member.getId(), reason);
interaction.reply("You are now AFK: %s%s".formatted( event.reply("You are now AFK: %s%s".formatted(
profile.getAfkReason(member.getId()), profile.getAfkReason(member.getId()),
MemberUtils.hasPermissionToEdit(guild, user) ? "" : MemberUtils.hasPermissionToEdit(guild, user) ? "" :
"\n\n*I do not have enough permissions to edit your user, and therefore cannot update your nickname*" "\n\n*I do not have enough permissions to edit your user, and therefore cannot update your nickname*"

@ -29,21 +29,21 @@ public class AddSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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);
// Check if the guild has reached the maximum auto roles count // Check if the guild has reached the maximum auto roles count
int maxRoleSlots = AutoRoleProfile.getMaxRoleSlots(guild); int maxRoleSlots = AutoRoleProfile.getMaxRoleSlots(guild);
if (profile.getRoleSlotsInUse() >= maxRoleSlots) { if (profile.getRoleSlotsInUse() >= maxRoleSlots) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The guild can only have a maximum of %d auto roles" .setDescription("The guild can only have a maximum of %d auto roles"
.formatted(maxRoleSlots)) .formatted(maxRoleSlots))
.build()).queue(); .build()).queue();
return; return;
} }
OptionMapping option = interaction.getOption("role"); OptionMapping option = event.getOption("role");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a role to add") .setDescription("Please provide a role to add")
.build()).queue(); .build()).queue();
return; return;
@ -52,7 +52,7 @@ public class AddSubCommand extends BatSubCommand {
// Check if the role is already in the auto roles list // Check if the role is already in the auto roles list
if (profile.hasRole(role.getId())) { if (profile.hasRole(role.getId())) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The role %s is already in the auto roles list".formatted(role.getAsMention())) .setDescription("The role %s is already in the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
return; return;
@ -60,7 +60,7 @@ public class AddSubCommand extends BatSubCommand {
// Check if the bot has permission to give the role // Check if the bot has permission to give the role
if (!RoleUtils.hasPermissionToGiveRole(guild, guild.getDiscordGuild().getSelfMember(), role)) { if (!RoleUtils.hasPermissionToGiveRole(guild, guild.getDiscordGuild().getSelfMember(), role)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("I do not have permission to give the role %s".formatted(role.getAsMention())) .setDescription("I do not have permission to give the role %s".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
return; return;
@ -68,7 +68,7 @@ public class AddSubCommand extends BatSubCommand {
// Check if the role is higher than the user adding the role // Check if the role is higher than the user adding the role
if (!RoleUtils.hasPermissionToGiveRole(guild, member, role)) { if (!RoleUtils.hasPermissionToGiveRole(guild, member, role)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You cannot add a role that is higher than you") .setDescription("You cannot add a role that is higher than you")
.build()).queue(); .build()).queue();
return; return;
@ -76,7 +76,7 @@ public class AddSubCommand extends BatSubCommand {
// Add the role to the auto roles list // Add the role to the auto roles list
profile.addRole(role.getId()); profile.addRole(role.getId());
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("You have added %s to the auto roles list".formatted(role.getAsMention())) .setDescription("You have added %s to the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -19,11 +19,11 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "clear", description = "Clears all auto roles") @CommandInfo(name = "clear", description = "Clears all auto roles")
public class ClearSubCommand extends BatSubCommand { public class ClearSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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);
profile.reset(); profile.reset();
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully cleared all auto roles") .setDescription("Successfully cleared all auto roles")
.build()).queue(); .build()).queue();
} }

@ -20,10 +20,10 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "list", description = "Lists all auto roles") @CommandInfo(name = "list", description = "Lists all auto roles")
public class ListSubCommand extends BatSubCommand { public class ListSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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);
if (profile.getRoles().isEmpty()) { if (profile.getRoles().isEmpty()) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("There are no auto roles set") .setDescription("There are no auto roles set")
.build()).queue(); .build()).queue();
return; return;
@ -41,6 +41,6 @@ public class ListSubCommand extends BatSubCommand {
EmbedBuilder embed = EmbedUtils.genericEmbed(); EmbedBuilder embed = EmbedUtils.genericEmbed();
embed.setAuthor("Auto Role List"); embed.setAuthor("Auto Role List");
embed.setDescription(roles.toString()); embed.setDescription(roles.toString());
interaction.replyEmbeds(embed.build()).queue(); event.replyEmbeds(embed.build()).queue();
} }
} }

@ -28,11 +28,11 @@ public class RemoveSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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 = interaction.getOption("role"); OptionMapping option = event.getOption("role");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a role to remove") .setDescription("Please provide a role to remove")
.build()).queue(); .build()).queue();
return; return;
@ -40,14 +40,14 @@ public class RemoveSubCommand extends BatSubCommand {
Role role = option.getAsRole(); Role role = option.getAsRole();
if (!profile.hasRole(role.getId())) { if (!profile.hasRole(role.getId())) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The role %s is not in the auto roles list".formatted(role.getAsMention())) .setDescription("The role %s is not in the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
return; return;
} }
profile.removeRole(role.getId()); profile.removeRole(role.getId());
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully removed the role %s from the auto roles list".formatted(role.getAsMention())) .setDescription("Successfully removed the role %s from the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -30,25 +30,25 @@ public class RemoveSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping guildOption = interaction.getOption("guild"); OptionMapping guildOption = event.getOption("guild");
if (guildOption == null) { if (guildOption == null) {
interaction.reply("Please provide a guild id").queue(); event.reply("Please provide a guild id").queue();
return; return;
} }
String guildId = guildOption.getAsString(); String guildId = guildOption.getAsString();
BatGuild targetGuild = guildService.getGuild(guildId); BatGuild targetGuild = guildService.getGuild(guildId);
if (targetGuild == null) { if (targetGuild == null) {
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue(); event.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
return; return;
} }
PremiumProfile premium = targetGuild.getPremiumProfile(); PremiumProfile premium = targetGuild.getPremiumProfile();
if (!premium.hasPremium()) { if (!premium.hasPremium()) {
interaction.reply("The guild does not have premium").queue(); event.reply("The guild does not have premium").queue();
return; return;
} }
premium.removePremium(); premium.removePremium();
interaction.reply("The guild **%s** has had its premium removed".formatted(targetGuild.getName())).queue(); event.reply("The guild **%s** has had its premium removed".formatted(targetGuild.getName())).queue();
} }
} }

@ -31,23 +31,23 @@ public class SetSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping guildOption = interaction.getOption("guild"); OptionMapping guildOption = event.getOption("guild");
if (guildOption == null) { if (guildOption == null) {
interaction.reply("Please provide a guild id").queue(); event.reply("Please provide a guild id").queue();
return; return;
} }
String guildId = guildOption.getAsString(); String guildId = guildOption.getAsString();
OptionMapping infiniteOption = interaction.getOption("infinite"); OptionMapping infiniteOption = event.getOption("infinite");
if (infiniteOption == null) { if (infiniteOption == null) {
interaction.reply("Please provide whether the premium length should be infinite").queue(); event.reply("Please provide whether the premium length should be infinite").queue();
return; return;
} }
boolean infinite = infiniteOption.getAsBoolean(); boolean infinite = infiniteOption.getAsBoolean();
BatGuild targetGuild = guildService.getGuild(guildId); BatGuild targetGuild = guildService.getGuild(guildId);
if (targetGuild == null) { if (targetGuild == null) {
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue(); event.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
return; return;
} }
PremiumProfile premium = targetGuild.getPremiumProfile(); PremiumProfile premium = targetGuild.getPremiumProfile();
@ -57,9 +57,9 @@ public class SetSubCommand extends BatSubCommand {
premium.addInfiniteTime(); premium.addInfiniteTime();
} }
if (!infinite) { if (!infinite) {
interaction.reply("The guild **%s** has been set as premium until <t:%s>".formatted(targetGuild.getName(), premium.getExpiresAt().toInstant().toEpochMilli() / 1000)).queue(); event.reply("The guild **%s** has been set as premium until <t:%s>".formatted(targetGuild.getName(), premium.getExpiresAt().toInstant().toEpochMilli() / 1000)).queue();
} else { } else {
interaction.reply("The guild **%s** has been set as premium indefinitely".formatted(targetGuild.getName())).queue(); event.reply("The guild **%s** has been set as premium indefinitely".formatted(targetGuild.getName())).queue();
} }
} }
} }

@ -20,14 +20,14 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "cat", description = "Get a random cat image") @CommandInfo(name = "cat", description = "Get a random cat image")
public class CatSubCommand extends BatSubCommand { public class CatSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
CatImageToken[] responseEntity = WebRequest.getAsEntity("https://api.thecatapi.com/v1/images/search", CatImageToken[].class); CatImageToken[] responseEntity = WebRequest.getAsEntity("https://api.thecatapi.com/v1/images/search", CatImageToken[].class);
if (responseEntity == null || responseEntity.length == 0) { if (responseEntity == null || responseEntity.length == 0) {
interaction.reply("Failed to get a cat image!").queue(); event.reply("Failed to get a cat image!").queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("Here's a random cat image!") .setAuthor("Here's a random cat image!")
.setImage(responseEntity[0].getUrl()) .setImage(responseEntity[0].getUrl())
.build()).queue(); .build()).queue();

@ -20,14 +20,14 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "dog", description = "Get a random dog image") @CommandInfo(name = "dog", description = "Get a random dog image")
public class DogSubCommand extends BatSubCommand { public class DogSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
RandomImage responseEntity = WebRequest.getAsEntity("https://dog.ceo/api/breeds/image/random", RandomImage.class); RandomImage responseEntity = WebRequest.getAsEntity("https://dog.ceo/api/breeds/image/random", RandomImage.class);
if (responseEntity == null) { if (responseEntity == null) {
interaction.reply("Failed to get a dog image!").queue(); event.reply("Failed to get a dog image!").queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("Here's a random dog image!") .setAuthor("Here's a random dog image!")
.setImage(responseEntity.getMessage()) .setImage(responseEntity.getMessage())
.build()).queue(); .build()).queue();

@ -20,14 +20,14 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "duck", description = "Get a random duck image") @CommandInfo(name = "duck", description = "Get a random duck image")
public class DuckSubCommand extends BatSubCommand { public class DuckSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
RandomDuck responseEntity = WebRequest.getAsEntity("https://random-d.uk/api/v2/random", RandomDuck.class); RandomDuck responseEntity = WebRequest.getAsEntity("https://random-d.uk/api/v2/random", RandomDuck.class);
if (responseEntity == null) { if (responseEntity == null) {
interaction.reply("Failed to get a duck image!").queue(); event.reply("Failed to get a duck image!").queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("Here's a random duck image!") .setAuthor("Here's a random duck image!")
.setImage(responseEntity.getUrl()) .setImage(responseEntity.getUrl())
.build()).queue(); .build()).queue();

@ -20,14 +20,14 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "fox", description = "Get a random fox image") @CommandInfo(name = "fox", description = "Get a random fox image")
public class FoxSubCommand extends BatSubCommand { public class FoxSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
RandomFoxToken responseEntity = WebRequest.getAsEntity("https://randomfox.ca/floof/", RandomFoxToken.class); RandomFoxToken responseEntity = WebRequest.getAsEntity("https://randomfox.ca/floof/", RandomFoxToken.class);
if (responseEntity == null) { if (responseEntity == null) {
interaction.reply("Failed to get a fox image!").queue(); event.reply("Failed to get a fox image!").queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("Here's a random fox image!") .setAuthor("Here's a random fox image!")
.setImage(responseEntity.getImage()) .setImage(responseEntity.getImage())
.build()).queue(); .build()).queue();

@ -38,10 +38,10 @@ public class BotStatsCommand extends BatCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
JDA jda = DiscordService.JDA; JDA jda = DiscordService.JDA;
interaction.replyEmbeds(EmbedUtils.genericEmbed().setDescription( event.replyEmbeds(EmbedUtils.genericEmbed().setDescription(
"**Bot Statistics**\n" + "**Bot Statistics**\n" +
"➜ Guilds: **%s**\n".formatted(NumberFormatter.format(jda.getGuilds().size())) + "➜ Guilds: **%s**\n".formatted(NumberFormatter.format(jda.getGuilds().size())) +
"➜ Users: **%s**\n".formatted(NumberFormatter.format(jda.getUsers().size())) + "➜ Users: **%s**\n".formatted(NumberFormatter.format(jda.getUsers().size())) +

@ -45,8 +45,8 @@ public class HelpCommand extends BatCommand implements EventListener {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
interaction.replyEmbeds(createHomeEmbed()).addComponents(createHomeActions()).queue(); event.replyEmbeds(createHomeEmbed()).addComponents(createHomeActions()).queue();
} }
@Override @Override

@ -19,8 +19,8 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "invite", description = "Invite the bot to your server!", guildOnly = false) @CommandInfo(name = "invite", description = "Invite the bot to your server!", guildOnly = false)
public class InviteCommand extends BatCommand { public class InviteCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("You can invite the bot to your server by clicking [here](%s)".formatted(Consts.INVITE_URL)) .setDescription("You can invite the bot to your server by clicking [here](%s)".formatted(Consts.INVITE_URL))
.build()) .build())
.setEphemeral(true) .setEphemeral(true)

@ -18,9 +18,9 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false) @CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false)
public class PingCommand extends BatCommand { public class PingCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
interaction.reply("Pinging...").queue(response -> { event.reply("Pinging...").queue(response -> {
response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted( response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted(
DiscordService.JDA.getGatewayPing(), DiscordService.JDA.getGatewayPing(),
System.currentTimeMillis() - time System.currentTimeMillis() - time

@ -22,13 +22,13 @@ public class VoteCommand extends BatCommand {
}; };
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("You can vote for the bot by clicking the following links:\n\n"); builder.append("You can vote for the bot by clicking the following links:\n\n");
for (String link : VOTE_LINKS) { for (String link : VOTE_LINKS) {
builder.append("%s\n".formatted(link)); builder.append("%s\n".formatted(link));
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription(builder.toString()) .setDescription(builder.toString())
.build() .build()
).queue(); ).queue();

@ -19,18 +19,18 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "guild", description = "View the avatar of the guild") @CommandInfo(name = "guild", description = "View the avatar of the guild")
public class GuildSubCommand extends BatSubCommand { public class GuildSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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) {
interaction.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()))
.build()) .build())
.queue(); .queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("%s's Avatar".formatted(guild.getName()), null, guild.getDiscordGuild().getIconUrl()) .setAuthor("%s's Avatar".formatted(guild.getName()), null, guild.getDiscordGuild().getIconUrl())
.setImage(icon.getUrl(4096)) .setImage(icon.getUrl(4096))
.build() .build()

@ -25,10 +25,10 @@ public class UserSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping userOption = interaction.getOption("user"); OptionMapping userOption = event.getOption("user");
if (userOption == null) { if (userOption == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide a user to view the avatar of!") .setDescription("You must provide a user to view the avatar of!")
.build()) .build())
.queue(); .queue();
@ -36,7 +36,7 @@ public class UserSubCommand extends BatSubCommand {
} }
User target = userOption.getAsUser(); User target = userOption.getAsUser();
interaction.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())
.build() .build()

@ -19,17 +19,17 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "guild", description = "View the banner of the guild") @CommandInfo(name = "guild", description = "View the banner of the guild")
public class GuildSubCommand extends BatSubCommand { public class GuildSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
ImageProxy banner = guild.getDiscordGuild().getBanner(); ImageProxy banner = guild.getDiscordGuild().getBanner();
if (banner == null) { if (banner == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("**%s** does not have a banner!".formatted(guild.getName())) .setDescription("**%s** does not have a banner!".formatted(guild.getName()))
.build()) .build())
.queue(); .queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("%s's Banner".formatted(guild.getName())) .setAuthor("%s's Banner".formatted(guild.getName()))
.setImage(banner.getUrl(512)) .setImage(banner.getUrl(512))
.build() .build()

@ -26,10 +26,10 @@ public class UserSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping userOption = interaction.getOption("user"); OptionMapping userOption = event.getOption("user");
if (userOption == null) { if (userOption == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide a user to view the banner of!") .setDescription("You must provide a user to view the banner of!")
.build()) .build())
.queue(); .queue();
@ -39,14 +39,14 @@ public class UserSubCommand extends BatSubCommand {
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) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("**%s** does not have a banner!".formatted(target.getName())) .setDescription("**%s** does not have a banner!".formatted(target.getName()))
.build()) .build())
.queue(); .queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("%s's Banner".formatted(target.getName())) .setAuthor("%s's Banner".formatted(target.getName()))
.setImage(banner.getUrl(512)) .setImage(banner.getUrl(512))
.build() .build()

@ -26,7 +26,7 @@ import java.util.Map;
@CommandInfo(name = "membercount", description = "View the member count of the server!") @CommandInfo(name = "membercount", description = "View the member count of the server!")
public class MemberCountCommand extends BatCommand { public class MemberCountCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
Guild discordGuild = guild.getDiscordGuild(); Guild discordGuild = guild.getDiscordGuild();
int totalMembers = 0, totalUsers = 0, totalBots = 0; int totalMembers = 0, totalUsers = 0, totalBots = 0;
Map<OnlineStatus, Integer> memberCounts = new HashMap<>(); Map<OnlineStatus, Integer> memberCounts = new HashMap<>();
@ -41,7 +41,7 @@ public class MemberCountCommand extends BatCommand {
} }
totalMembers++; totalMembers++;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription(""" .setDescription("""
**Member Count** **Member Count**
Total Members: `%s` Total Members: `%s`

@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "premium", description = "View the premium information for the guild", requiredPermissions = Permission.ADMINISTRATOR) @CommandInfo(name = "premium", description = "View the premium information for the guild", requiredPermissions = Permission.ADMINISTRATOR)
public class PremiumCommand extends BatCommand { public class PremiumCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
PremiumProfile premium = guild.getPremiumProfile(); PremiumProfile premium = guild.getPremiumProfile();
EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Premium Information"); EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Premium Information");
if (premium.hasPremium()) { if (premium.hasPremium()) {
@ -32,6 +32,6 @@ public class PremiumCommand extends BatCommand {
} else { } else {
embed.setDescription("The guild does not have premium"); embed.setDescription("The guild does not have premium");
} }
interaction.replyEmbeds(embed.build()).queue(); event.replyEmbeds(embed.build()).queue();
} }
} }

@ -26,10 +26,10 @@ public class RemoveTopicSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
Channel target = interaction.getOption("channel") == null ? channel : interaction.getOption("channel").getAsChannel(); Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel();
if (!(target instanceof TextChannel textChannel)) { if (!(target instanceof TextChannel textChannel)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("<#%s> is not a text channel!".formatted(target.getId())) .setDescription("<#%s> is not a text channel!".formatted(target.getId()))
.build()) .build())
.queue(); .queue();
@ -37,7 +37,7 @@ public class RemoveTopicSubCommand extends BatSubCommand {
} }
if (textChannel.getTopic() == null) { if (textChannel.getTopic() == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("<#%s> does not have a topic!".formatted(textChannel.getId())) .setDescription("<#%s> does not have a topic!".formatted(textChannel.getId()))
.build()) .build())
.queue(); .queue();
@ -45,7 +45,7 @@ public class RemoveTopicSubCommand extends BatSubCommand {
} }
textChannel.getManager().setTopic(null).queue(); textChannel.getManager().setTopic(null).queue();
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully removed the topic of <#%s>".formatted(textChannel.getId())) .setDescription("Successfully removed the topic of <#%s>".formatted(textChannel.getId()))
.build() .build()
).queue(); ).queue();

@ -27,19 +27,19 @@ public class SetTopicSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
Channel target = interaction.getOption("channel") == null ? channel : interaction.getOption("channel").getAsChannel(); Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel();
if (!(target instanceof TextChannel textChannel)) { if (!(target instanceof TextChannel textChannel)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("<#%s> is not a text channel!".formatted(target.getId())) .setDescription("<#%s> is not a text channel!".formatted(target.getId()))
.build()) .build())
.queue(); .queue();
return; return;
} }
String topic = interaction.getOption("topic").getAsString(); String topic = event.getOption("topic").getAsString();
if (topic.length() > 1024) { if (topic.length() > 1024) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The topic must be 1024 characters or less!") .setDescription("The topic must be 1024 characters or less!")
.build()) .build())
.queue(); .queue();
@ -47,7 +47,7 @@ public class SetTopicSubCommand extends BatSubCommand {
} }
textChannel.getManager().setTopic(topic).queue(); textChannel.getManager().setTopic(topic).queue();
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully set the topic of <#%s> to: \"%s\"".formatted(textChannel.getId(), topic)) .setDescription("Successfully set the topic of <#%s> to: \"%s\"".formatted(textChannel.getId(), topic))
.build() .build()
).queue(); ).queue();

@ -25,10 +25,10 @@ public class ViewTopicSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
Channel target = interaction.getOption("channel") == null ? channel : interaction.getOption("channel").getAsChannel(); Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel();
if (!(target instanceof TextChannel textChannel)) { if (!(target instanceof TextChannel textChannel)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("<#%s> is not a text channel!".formatted(target.getId())) .setDescription("<#%s> is not a text channel!".formatted(target.getId()))
.build()) .build())
.queue(); .queue();
@ -37,14 +37,14 @@ public class ViewTopicSubCommand extends BatSubCommand {
String topic = textChannel.getTopic(); String topic = textChannel.getTopic();
if (topic == null) { if (topic == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("<#%s> does not have a topic!".formatted(textChannel.getId())) .setDescription("<#%s> does not have a topic!".formatted(textChannel.getId()))
.build()) .build())
.queue(); .queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("The topic of <#%s> is: \"%s\"".formatted(textChannel.getId(), topic)) .setDescription("The topic of <#%s> is: \"%s\"".formatted(textChannel.getId(), topic))
.build() .build()
).queue(); ).queue();

@ -29,32 +29,32 @@ public class DisableSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
FeatureProfile featureProfile = guild.getFeatureProfile(); FeatureProfile featureProfile = guild.getFeatureProfile();
OptionMapping featureOption = interaction.getOption("feature"); OptionMapping featureOption = event.getOption("feature");
if (featureOption == null) { if (featureOption == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide a feature to enabled") .setDescription("You must provide a feature to enabled")
.build()).queue(); .build()).queue();
return; return;
} }
String featureName = featureOption.getAsString(); String featureName = featureOption.getAsString();
if (!FeatureService.INSTANCE.isFeature(featureName)) { if (!FeatureService.INSTANCE.isFeature(featureName)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("That feature does not exist") .setDescription("That feature does not exist")
.build()).queue(); .build()).queue();
return; return;
} }
Feature feature = FeatureService.INSTANCE.getFeature(featureName); Feature feature = FeatureService.INSTANCE.getFeature(featureName);
if (featureProfile.isFeatureDisabled(feature)) { if (featureProfile.isFeatureDisabled(feature)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The feature `%s` is already disabled".formatted(feature.getName())) .setDescription("The feature `%s` is already disabled".formatted(feature.getName()))
.build()).queue(); .build()).queue();
return; return;
} }
featureProfile.disableFeature(feature); featureProfile.disableFeature(feature);
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Successfully disabled the `%s` feature".formatted(feature.getName())) .setDescription("Successfully disabled the `%s` feature".formatted(feature.getName()))
.build()).queue(); .build()).queue();
} }

@ -29,32 +29,32 @@ public class EnableSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
FeatureProfile featureProfile = guild.getFeatureProfile(); FeatureProfile featureProfile = guild.getFeatureProfile();
OptionMapping featureOption = interaction.getOption("feature"); OptionMapping featureOption = event.getOption("feature");
if (featureOption == null) { if (featureOption == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide a feature to enabled") .setDescription("You must provide a feature to enabled")
.build()).queue(); .build()).queue();
return; return;
} }
String featureName = featureOption.getAsString(); String featureName = featureOption.getAsString();
if (!FeatureService.INSTANCE.isFeature(featureName)) { if (!FeatureService.INSTANCE.isFeature(featureName)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("That feature does not exist") .setDescription("That feature does not exist")
.build()).queue(); .build()).queue();
return; return;
} }
Feature feature = FeatureService.INSTANCE.getFeature(featureName); Feature feature = FeatureService.INSTANCE.getFeature(featureName);
if (featureProfile.isFeatureEnabled(feature)) { if (featureProfile.isFeatureEnabled(feature)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The feature `%s` is already enabled".formatted(feature.getName())) .setDescription("The feature `%s` is already enabled".formatted(feature.getName()))
.build()).queue(); .build()).queue();
return; return;
} }
featureProfile.enableFeature(feature); featureProfile.enableFeature(feature);
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully enabled the `%s` feature".formatted(feature.getName())) .setDescription("Successfully enabled the `%s` feature".formatted(feature.getName()))
.build()).queue(); .build()).queue();
} }

@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "list", description = "Lists the features and their states") @CommandInfo(name = "list", description = "Lists the features and their states")
public class ListSubCommand extends BatSubCommand { public class ListSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
StringBuilder featureStates = new StringBuilder(); StringBuilder featureStates = new StringBuilder();
for (Feature feature : FeatureService.INSTANCE.getFeaturesSorted()) { for (Feature feature : FeatureService.INSTANCE.getFeaturesSorted()) {
FeatureProfile featureProfile = guild.getFeatureProfile(); FeatureProfile featureProfile = guild.getFeatureProfile();
@ -30,7 +30,7 @@ public class ListSubCommand extends BatSubCommand {
feature.getName() feature.getName()
)); ));
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setTitle("Feature List") .setTitle("Feature List")
.setDescription(featureStates.toString()) .setDescription(featureStates.toString())
.build() .build()

@ -31,17 +31,17 @@ public class ChannelSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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 option = interaction.getOption("channel"); OptionMapping option = event.getOption("channel");
if (option == null) { if (option == null) {
if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("There is no channel set for birthday notifications. Please provide a channel to set the birthday channel to") .setDescription("There is no channel set for birthday notifications. Please provide a channel to set the birthday channel to")
.build()).queue(); .build()).queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("The current birthday channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .setDescription("The current birthday channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId())))
.build()).queue(); .build()).queue();
return; return;
@ -49,14 +49,14 @@ public class ChannelSubCommand extends BatSubCommand {
GuildChannelUnion targetChannel = option.getAsChannel(); GuildChannelUnion targetChannel = option.getAsChannel();
if (targetChannel.getType() != ChannelType.TEXT) { if (targetChannel.getType() != ChannelType.TEXT) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid channel type, please provide a text channel") .setDescription("Invalid channel type, please provide a text channel")
.build()).queue(); .build()).queue();
return; return;
} }
profile.setChannelId(targetChannel.getId()); profile.setChannelId(targetChannel.getId());
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully set the birthday channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .setDescription("Successfully set the birthday channel to %s".formatted(targetChannel.asTextChannel().getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -29,11 +29,11 @@ public class MessageSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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 = interaction.getOption("message"); OptionMapping messageOption = event.getOption("message");
if (messageOption == null) { if (messageOption == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide a message") .setDescription("You must provide a message")
.build()).queue(); .build()).queue();
return; return;
@ -41,20 +41,20 @@ public class MessageSubCommand extends BatSubCommand {
String message = messageOption.getAsString(); String message = messageOption.getAsString();
if (message.length() > 2000) { if (message.length() > 2000) {
interaction.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")
.build()).queue(); .build()).queue();
return; return;
} }
if (!message.contains("{user}") || !message.contains("{age}")) { if (!message.contains("{user}") || !message.contains("{age}")) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The message must contain the placeholders {user} and {age}") .setDescription("The message must contain the placeholders {user} and {age}")
.build()).queue(); .build()).queue();
return; return;
} }
profile.setMessage(message); profile.setMessage(message);
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("You have updated the birthday message!\n\n**Message:** %s".formatted(profile.getBirthdayMessage(user.getDiscordUser()))) .setDescription("You have updated the birthday message!\n\n**Message:** %s".formatted(profile.getBirthdayMessage(user.getDiscordUser())))
.build()).queue(); .build()).queue();
} }

@ -29,11 +29,11 @@ public class PrivateSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { 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 = interaction.getOption("enabled"); OptionMapping enabledOption = event.getOption("enabled");
if (enabledOption == null) { if (enabledOption == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide whether your birthday is private or not") .setDescription("You must provide whether your birthday is private or not")
.build()).queue(); .build()).queue();
return; return;
@ -42,14 +42,14 @@ public class PrivateSubCommand extends BatSubCommand {
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) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You have not set your birthday yet") .setDescription("You have not set your birthday yet")
.build()).queue(); .build()).queue();
return; return;
} }
birthday.setHidden(enabled); birthday.setHidden(enabled);
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Your birthday privacy settings have been updated\n\n**Private:** " + (enabled ? "Yes" : "No")) .setDescription("Your birthday privacy settings have been updated\n\n**Private:** " + (enabled ? "Yes" : "No"))
.build()).queue(); .build()).queue();
} }

@ -20,11 +20,11 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "remove", description = "Remove your birthday from this guild") @CommandInfo(name = "remove", description = "Remove your birthday from this guild")
public class RemoveSubCommand extends BatSubCommand { public class RemoveSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile(); BirthdayProfile profile = guild.getBirthdayProfile();
profile.removeBirthday(user.getId()); profile.removeBirthday(user.getId());
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Your birthday has been removed from this guild") .setDescription("Your birthday has been removed from this guild")
.build()).queue(); .build()).queue();
} }

@ -35,18 +35,18 @@ public class SetSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile(); BirthdayProfile profile = guild.getBirthdayProfile();
if (!profile.hasChannelSetup()) { if (!profile.hasChannelSetup()) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Birthdays have not been enabled in this guild. Please ask an administrator to enable them.") .setDescription("Birthdays have not been enabled in this guild. Please ask an administrator to enable them.")
.build()).queue(); .build()).queue();
return; return;
} }
OptionMapping birthdayOption = interaction.getOption("birthday"); OptionMapping birthdayOption = event.getOption("birthday");
if (birthdayOption == null) { if (birthdayOption == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide a birthday") .setDescription("You must provide a birthday")
.build()).queue(); .build()).queue();
return; return;
@ -54,7 +54,7 @@ public class SetSubCommand extends BatSubCommand {
String birthdayString = birthdayOption.getAsString(); String birthdayString = birthdayOption.getAsString();
Date birthday = parseBirthday(birthdayString); Date birthday = parseBirthday(birthdayString);
if (birthday == null) { if (birthday == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription(""" .setDescription("""
Invalid birthday format. Please use the following format: Invalid birthday format. Please use the following format:
DAY/MONTH/YEAR - 01/05/2004 DAY/MONTH/YEAR - 01/05/2004
@ -67,7 +67,7 @@ public class SetSubCommand extends BatSubCommand {
userBirthday.setBirthday(birthday); userBirthday.setBirthday(birthday);
userBirthday.setHidden(false); userBirthday.setHidden(false);
profile.addBirthday(member.getId(), userBirthday); profile.addBirthday(member.getId(), userBirthday);
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("You have updated your birthday!") .setDescription("You have updated your birthday!")
.build()).queue(); .build()).queue();
} }

@ -33,38 +33,38 @@ public class ViewSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile(); BirthdayProfile profile = guild.getBirthdayProfile();
if (!profile.hasChannelSetup()) { if (!profile.hasChannelSetup()) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Birthdays have not been enabled in this guild. Please ask an administrator to enable them.") .setDescription("Birthdays have not been enabled in this guild. Please ask an administrator to enable them.")
.build()).queue(); .build()).queue();
return; return;
} }
OptionMapping birthdayOption = interaction.getOption("user"); OptionMapping birthdayOption = event.getOption("user");
BatUser target = birthdayOption == null ? user : userService.getUser(birthdayOption.getAsUser().getId()); BatUser target = birthdayOption == null ? user : userService.getUser(birthdayOption.getAsUser().getId());
if (target == null) { if (target == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You must provide a valid user") .setDescription("You must provide a valid user")
.build()).queue(); .build()).queue();
return; return;
} }
UserBirthday birthday = profile.getBirthday(target.getId()); UserBirthday birthday = profile.getBirthday(target.getId());
if (birthday == null) { if (birthday == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("%s does not have a birthday set".formatted(target.getDiscordUser().getAsMention())) .setDescription("%s does not have a birthday set".formatted(target.getDiscordUser().getAsMention()))
.build()).queue(); .build()).queue();
return; return;
} }
if (birthday.isHidden() && !user.getId().equals(target.getId())) { if (birthday.isHidden() && !user.getId().equals(target.getId())) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("%s has their birthday set to private".formatted(target.getDiscordUser().getAsMention())) .setDescription("%s has their birthday set to private".formatted(target.getDiscordUser().getAsMention()))
.build()).queue(); .build()).queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("%s was born on <t:%s:D> they are `%s` years old!".formatted( .setDescription("%s was born on <t:%s:D> they are `%s` years old!".formatted(
target.getDiscordUser().getAsMention(), birthday.getBirthday().toInstant().toEpochMilli()/1000, target.getDiscordUser().getAsMention(), birthday.getBirthday().toInstant().toEpochMilli()/1000,
birthday.calculateAge() birthday.calculateAge()

@ -32,8 +32,8 @@ public class GuildSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping userOption = interaction.getOption("user"); OptionMapping userOption = event.getOption("user");
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId()); BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
if (target == null) { if (target == null) {
channel.sendMessage("User not found").queue(); channel.sendMessage("User not found").queue();
@ -53,7 +53,7 @@ public class GuildSubCommand extends BatSubCommand {
} }
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("%s's Nickname History in %s".formatted(target.getName(), guild.getName())) .setAuthor("%s's Nickname History in %s".formatted(target.getName(), guild.getName()))
.setDescription(builder.toString()) .setDescription(builder.toString())
.build() .build()

@ -32,8 +32,8 @@ public class UserSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping userOption = interaction.getOption("user"); OptionMapping userOption = event.getOption("user");
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId()); BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
if (target == null) { if (target == null) {
channel.sendMessage("User not found").queue(); channel.sendMessage("User not found").queue();
@ -50,7 +50,7 @@ public class UserSubCommand extends BatSubCommand {
} }
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setAuthor("%s's Global Name History".formatted(target.getName())) .setAuthor("%s's Global Name History".formatted(target.getName()))
.setDescription(builder.toString()) .setDescription(builder.toString())
.build() .build()

@ -30,17 +30,17 @@ public class ChannelSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class); NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
OptionMapping option = interaction.getOption("channel"); OptionMapping option = event.getOption("channel");
if (option == null) { if (option == null) {
if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("There is no channel set for the feed notifications.") .setDescription("There is no channel set for the feed notifications.")
.build()).queue(); .build()).queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("The current feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .setDescription("The current feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId())))
.build()).queue(); .build()).queue();
return; return;
@ -48,14 +48,14 @@ public class ChannelSubCommand extends BatSubCommand {
GuildChannelUnion targetChannel = option.getAsChannel(); GuildChannelUnion targetChannel = option.getAsChannel();
if (targetChannel.getType() != ChannelType.TEXT) { if (targetChannel.getType() != ChannelType.TEXT) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid channel type, please provide a text channel") .setDescription("Invalid channel type, please provide a text channel")
.build()).queue(); .build()).queue();
return; return;
} }
profile.setChannelId(targetChannel.getId()); profile.setChannelId(targetChannel.getId());
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully set the feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .setDescription("Successfully set the feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -19,11 +19,11 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "reset", description = "Resets the settings") @CommandInfo(name = "reset", description = "Resets the settings")
public class ResetSubCommand extends BatSubCommand { public class ResetSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class); NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
profile.reset(); profile.reset();
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully reset the settings.") .setDescription("Successfully reset the settings.")
.build()).queue(); .build()).queue();
} }

@ -31,10 +31,10 @@ public class LinkSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping option = interaction.getOption("link"); OptionMapping option = event.getOption("link");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a ScoreSaber profile link") .setDescription("Please provide a ScoreSaber profile link")
.build()).queue(); .build()).queue();
return; return;
@ -42,7 +42,7 @@ public class LinkSubCommand extends BatSubCommand {
String link = option.getAsString(); String link = option.getAsString();
if (!link.contains("scoresaber.com/u/")) { if (!link.contains("scoresaber.com/u/")) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid ScoreSaber profile link") .setDescription("Invalid ScoreSaber profile link")
.build()).queue(); .build()).queue();
return; return;
@ -55,14 +55,14 @@ public class LinkSubCommand extends BatSubCommand {
ScoreSaberAccountToken account = scoreSaberService.getAccount(id); ScoreSaberAccountToken account = scoreSaberService.getAccount(id);
if (account == null) { if (account == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid ScoreSaber profile link") .setDescription("Invalid ScoreSaber profile link")
.build()).queue(); .build()).queue();
return; return;
} }
user.getScoreSaberProfile().setAccountId(id); user.getScoreSaberProfile().setAccountId(id);
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully linked your [ScoreSaber](%s) profile".formatted("https://scoresaber.com/u/%s".formatted(id))) .setDescription("Successfully linked your [ScoreSaber](%s) profile".formatted("https://scoresaber.com/u/%s".formatted(id)))
.build()).queue(); .build()).queue();
} }

@ -26,7 +26,7 @@ public class MeSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
ScoreSaberCommand.sendProfileEmbed(true, user, scoreSaberService, interaction); ScoreSaberCommand.sendProfileEmbed(true, user, scoreSaberService, event);
} }
} }

@ -19,11 +19,11 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "reset", description = "Reset your settings") @CommandInfo(name = "reset", description = "Reset your settings")
public class ResetSubCommand extends BatSubCommand { public class ResetSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
ScoreSaberProfile profile = user.getScoreSaberProfile(); ScoreSaberProfile profile = user.getScoreSaberProfile();
profile.reset(); profile.reset();
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully reset your settings.") .setDescription("Successfully reset your settings.")
.build()).queue(); .build()).queue();
} }

@ -100,7 +100,7 @@ public class ScoreSaberCommand extends BatCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
sendProfileEmbed(true, user, scoreSaberService, interaction); sendProfileEmbed(true, user, scoreSaberService, event);
} }
} }

@ -33,17 +33,17 @@ public class UserSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping option = interaction.getOption("user"); OptionMapping option = event.getOption("user");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a user to view the ScoreSaber profile of") .setDescription("Please provide a user to view the ScoreSaber profile of")
.build()).queue(); .build()).queue();
return; return;
} }
if (option.getAsUser().isBot()) { if (option.getAsUser().isBot()) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You cannot view the ScoreSaber profile for a Bot") .setDescription("You cannot view the ScoreSaber profile for a Bot")
.build()).queue(); .build()).queue();
return; return;
@ -51,11 +51,11 @@ public class UserSubCommand extends BatSubCommand {
BatUser target = userService.getUser(option.getAsUser().getId()); BatUser target = userService.getUser(option.getAsUser().getId());
if (target == null) { if (target == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Unknown user") .setDescription("Unknown user")
.build()).queue(); .build()).queue();
return; return;
} }
ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, interaction); ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, event);
} }
} }

@ -30,17 +30,17 @@ public class ChannelSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class); UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
OptionMapping option = interaction.getOption("channel"); OptionMapping option = event.getOption("channel");
if (option == null) { if (option == null) {
if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("There is no channel set for the feed notifications.") .setDescription("There is no channel set for the feed notifications.")
.build()).queue(); .build()).queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("The current feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .setDescription("The current feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId())))
.build()).queue(); .build()).queue();
return; return;
@ -48,14 +48,14 @@ public class ChannelSubCommand extends BatSubCommand {
GuildChannelUnion targetChannel = option.getAsChannel(); GuildChannelUnion targetChannel = option.getAsChannel();
if (targetChannel.getType() != ChannelType.TEXT) { if (targetChannel.getType() != ChannelType.TEXT) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid channel type, please provide a text channel") .setDescription("Invalid channel type, please provide a text channel")
.build()).queue(); .build()).queue();
return; return;
} }
profile.setChannelId(targetChannel.getId()); profile.setChannelId(targetChannel.getId());
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully set the feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .setDescription("Successfully set the feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -19,10 +19,10 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "reset", description = "Resets the settings") @CommandInfo(name = "reset", description = "Resets the settings")
public class ResetSubCommand extends BatSubCommand { public class ResetSubCommand extends BatSubCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class); UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
profile.reset(); profile.reset();
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully reset the settings.") .setDescription("Successfully reset the settings.")
.build()).queue(); .build()).queue();
} }

@ -36,12 +36,12 @@ public class UserSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class); UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
OptionMapping option = interaction.getOption("user"); OptionMapping option = event.getOption("user");
if (option == null) { if (option == null) {
if (profile.getTrackedUsers().isEmpty()) { if (profile.getTrackedUsers().isEmpty()) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("There are no users being tracked in the feed") .setDescription("There are no users being tracked in the feed")
.build()).queue(); .build()).queue();
return; return;
@ -53,7 +53,7 @@ public class UserSubCommand extends BatSubCommand {
"https://scoresaber.com/u/%s".formatted(accountId) "https://scoresaber.com/u/%s".formatted(accountId)
)); ));
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("The current users being tracked in the feed are:\n%s".formatted(stringBuilder.toString())) .setDescription("The current users being tracked in the feed are:\n%s".formatted(stringBuilder.toString()))
.build()).queue(); .build()).queue();
return; return;
@ -63,7 +63,7 @@ public class UserSubCommand extends BatSubCommand {
BatUser targetUser = userService.getUser(target.getId()); BatUser targetUser = userService.getUser(target.getId());
ScoreSaberProfile targetProfile = targetUser.getScoreSaberProfile(); ScoreSaberProfile targetProfile = targetUser.getScoreSaberProfile();
if (targetProfile.getAccountId() == null) { if (targetProfile.getAccountId() == null) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The user you are trying to track does not have a linked ScoreSaber profile") .setDescription("The user you are trying to track does not have a linked ScoreSaber profile")
.build()).queue(); .build()).queue();
return; return;
@ -77,7 +77,7 @@ public class UserSubCommand extends BatSubCommand {
added = true; added = true;
} }
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully %s %s from the feed".formatted( .setDescription("Successfully %s %s from the feed".formatted(
added ? "added" : "removed", added ? "added" : "removed",
target.getAsMention() target.getAsMention()

@ -39,8 +39,8 @@ public class CurrentSubCommand extends BatSubCommand implements EventListener {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
interaction.replyEmbeds(SpotifyFeature.currentSong(spotifyService, user).build()).addComponents(createActions()).queue(); event.replyEmbeds(SpotifyFeature.currentSong(spotifyService, user).build()).addComponents(createActions()).queue();
} }
@Override @SneakyThrows @Override @SneakyThrows

@ -41,7 +41,7 @@ public class LinkSubCommand extends BatSubCommand implements EventListener {
} }
@Override @SneakyThrows @Override @SneakyThrows
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
if (!user.getId().equals(Consts.BOT_OWNER)) { if (!user.getId().equals(Consts.BOT_OWNER)) {
throw new BatException(""" throw new BatException("""
%s We are currently awaiting Spotify's approval for our application. Please check back later. %s We are currently awaiting Spotify's approval for our application. Please check back later.
@ -53,7 +53,7 @@ public class LinkSubCommand extends BatSubCommand implements EventListener {
throw new BatException("%s You have already linked your Spotify account.".formatted(Emojis.CROSS_MARK_EMOJI)); throw new BatException("%s You have already linked your Spotify account.".formatted(Emojis.CROSS_MARK_EMOJI));
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed() event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("%s You can link your Spotify account by clicking [here](%s)".formatted( .setDescription("%s You can link your Spotify account by clicking [here](%s)".formatted(
Emojis.SPOTIFY_EMOJI.getFormatted(), Emojis.SPOTIFY_EMOJI.getFormatted(),
spotifyService.getAuthorizationUrl() spotifyService.getAuthorizationUrl()

@ -27,7 +27,7 @@ public class PauseSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
interaction.replyEmbeds(SpotifyFeature.pauseSong(spotifyService, user).build()).queue(); event.replyEmbeds(SpotifyFeature.pauseSong(spotifyService, user).build()).queue();
} }
} }

@ -27,7 +27,7 @@ public class ResumeSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
interaction.replyEmbeds(SpotifyFeature.resumeSong(spotifyService, user).build()).queue(); event.replyEmbeds(SpotifyFeature.resumeSong(spotifyService, user).build()).queue();
} }
} }

@ -30,7 +30,7 @@ public class SkipSubCommand extends BatSubCommand {
} }
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
interaction.replyEmbeds(SpotifyFeature.skipSong(spotifyService, user).build()).queue(); event.replyEmbeds(SpotifyFeature.skipSong(spotifyService, user).build()).queue();
} }
} }

@ -23,14 +23,14 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "unlink", description = "Unlink your Spotify account") @CommandInfo(name = "unlink", description = "Unlink your Spotify account")
public class UnlinkSubCommand extends BatSubCommand implements EventListener { public class UnlinkSubCommand extends BatSubCommand implements EventListener {
@Override @SneakyThrows @Override @SneakyThrows
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
SpotifyProfile profile = user.getProfile(SpotifyProfile.class); SpotifyProfile profile = user.getProfile(SpotifyProfile.class);
if (!profile.hasLinkedAccount()) { if (!profile.hasLinkedAccount()) {
throw new BatException("%s You do not have a linked Spotify account.".formatted(Emojis.CROSS_MARK_EMOJI)); throw new BatException("%s You do not have a linked Spotify account.".formatted(Emojis.CROSS_MARK_EMOJI));
} }
profile.reset(); profile.reset();
interaction.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("%s Successfully unlinked your Spotify account.".formatted(Emojis.CHECK_MARK_EMOJI)) .setDescription("%s Successfully unlinked your Spotify account.".formatted(Emojis.CHECK_MARK_EMOJI))
.build()) .build())
.setEphemeral(true) .setEphemeral(true)