fix premium admin command

This commit is contained in:
Lee 2024-07-01 01:46:56 +01:00
parent ed83175a39
commit 7485bd2ec8
2 changed files with 9 additions and 9 deletions

View File

@ -37,18 +37,18 @@ public class RemoveSubCommand extends BatSubCommand {
return;
}
String guildId = guildOption.getAsString();
BatGuild batGuild = guildService.getGuild(guildId);
if (batGuild == null) {
BatGuild targetGuild = guildService.getGuild(guildId);
if (targetGuild == null) {
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
return;
}
PremiumProfile premium = batGuild.getPremiumProfile();
PremiumProfile premium = targetGuild.getPremiumProfile();
if (!premium.hasPremium()) {
interaction.reply("The guild does not have premium").queue();
return;
}
premium.removePremium();
interaction.reply("The guild **%s** has had its premium removed".formatted(guild.getName())).queue();
interaction.reply("The guild **%s** has had its premium removed".formatted(targetGuild.getName())).queue();
}
}

View File

@ -45,21 +45,21 @@ public class SetSubCommand extends BatSubCommand {
}
boolean infinite = infiniteOption.getAsBoolean();
BatGuild batGuild = guildService.getGuild(guildId);
if (batGuild == null) {
BatGuild targetGuild = guildService.getGuild(guildId);
if (targetGuild == null) {
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
return;
}
PremiumProfile premium = batGuild.getPremiumProfile();
PremiumProfile premium = targetGuild.getPremiumProfile();
if (!infinite) {
premium.addTime();
} else {
premium.addInfiniteTime();
}
if (!infinite) {
interaction.reply("The guild **%s** has been set as premium until <t:%s>".formatted(guild.getName(), premium.getExpiresAt().toInstant().toEpochMilli() / 1000)).queue();
interaction.reply("The guild **%s** has been set as premium until <t:%s>".formatted(targetGuild.getName(), premium.getExpiresAt().toInstant().toEpochMilli() / 1000)).queue();
} else {
interaction.reply("The guild **%s** has been set as premium indefinitely".formatted(guild.getName())).queue();
interaction.reply("The guild **%s** has been set as premium indefinitely".formatted(targetGuild.getName())).queue();
}
}
}