fix premium admin command
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 37s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 37s
This commit is contained in:
parent
ed83175a39
commit
7485bd2ec8
@ -37,18 +37,18 @@ public class RemoveSubCommand extends BatSubCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String guildId = guildOption.getAsString();
|
String guildId = guildOption.getAsString();
|
||||||
BatGuild batGuild = guildService.getGuild(guildId);
|
BatGuild targetGuild = guildService.getGuild(guildId);
|
||||||
if (batGuild == null) {
|
if (targetGuild == null) {
|
||||||
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
|
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PremiumProfile premium = batGuild.getPremiumProfile();
|
PremiumProfile premium = targetGuild.getPremiumProfile();
|
||||||
if (!premium.hasPremium()) {
|
if (!premium.hasPremium()) {
|
||||||
interaction.reply("The guild does not have premium").queue();
|
interaction.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(guild.getName())).queue();
|
interaction.reply("The guild **%s** has had its premium removed".formatted(targetGuild.getName())).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,21 +45,21 @@ public class SetSubCommand extends BatSubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean infinite = infiniteOption.getAsBoolean();
|
boolean infinite = infiniteOption.getAsBoolean();
|
||||||
BatGuild batGuild = guildService.getGuild(guildId);
|
BatGuild targetGuild = guildService.getGuild(guildId);
|
||||||
if (batGuild == null) {
|
if (targetGuild == null) {
|
||||||
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
|
interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PremiumProfile premium = batGuild.getPremiumProfile();
|
PremiumProfile premium = targetGuild.getPremiumProfile();
|
||||||
if (!infinite) {
|
if (!infinite) {
|
||||||
premium.addTime();
|
premium.addTime();
|
||||||
} else {
|
} else {
|
||||||
premium.addInfiniteTime();
|
premium.addInfiniteTime();
|
||||||
}
|
}
|
||||||
if (!infinite) {
|
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 {
|
} 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user