use of gg.projecteden.discord.appcommands.annotations.Command in project Nexus by ProjectEdenGG.
the class BalanceAppCommand method check.
@Command(value = "Check a player's balance", literals = false)
void check(@Desc("player") @Default("self") Nerd player, @Desc("gamemode") @Default("SURVIVAL") @Optional ShopGroup gamemode) {
boolean isSelf = PlayerUtils.isSelf(player, verify());
String formatted = new BankerService().getBalanceFormatted(player, gamemode);
replyEphemeral(camelCase(gamemode) + " balance" + (isSelf ? "" : " of " + player.getNickname()) + ": " + formatted);
}
use of gg.projecteden.discord.appcommands.annotations.Command in project Nexus by ProjectEdenGG.
the class NewPlayersAppCommand method run.
@Command(value = "List new players", literals = false)
void run() {
final HoursService service = new HoursService();
Map<Player, Integer> players = new HashMap<>() {
{
for (Player player : OnlinePlayers.getAll()) {
Hours hours = service.get(player);
if (!hours.has(TickTime.HOUR))
put(player, hours.getTotal());
}
}
};
if (players.isEmpty())
throw new InvalidInputException("No new players found");
StringBuilder response = new StringBuilder();
Utils.sortByValue(players).forEach((player, hours) -> response.append(Nickname.of(player)).append(" - ").append(Timespan.ofSeconds(players.get(player)).format()).append(System.lineSeparator()));
reply(StringUtils.getDiscordPrefix("NewPlayers") + System.lineSeparator() + response);
}
use of gg.projecteden.discord.appcommands.annotations.Command in project Nexus by ProjectEdenGG.
the class SuggestAppCommand method run.
@Command(value = "Suggest a player for promotion", literals = false)
void run(@Desc("Player") Nerd nerd, @Desc("Rank") @Optional Rank rank) {
if (rank == null)
rank = nerd.getRank().getPromotion();
if (!Arrays.asList(Rank.MEMBER, Rank.TRUSTED, Rank.ELITE, Rank.VETERAN).contains(nerd.getRank()))
throw new InvalidInputException(nerd.getName() + " is not eligible for promotion (They are " + nerd.getRank().getName() + ")");
Hours hours = new HoursService().get(nerd);
String firstJoin = nerd.getFirstJoin().format(DateTimeFormatter.ofPattern("MMMM dd, yyyy"));
String hoursTotal = TimespanBuilder.ofSeconds(hours.getTotal()).noneDisplay(true).format();
String hoursMonthly = TimespanBuilder.ofSeconds(hours.getMonthly()).noneDisplay(true).format();
String history = "None";
if (Punishments.of(nerd).hasHistory())
history = Punishments.of(nerd).getPunishments().size() + " [View](" + Justice.URL + "/history/" + nerd.getName() + ")";
EmbedBuilder embed = new EmbedBuilder().appendDescription("\n:information_source: **Rank**: " + nerd.getRank().getName()).appendDescription("\n:calendar_spiral: **First join**: " + firstJoin).appendDescription("\n:clock" + RandomUtils.randomInt(1, 12) + ": **Hours (Total)**: " + hoursTotal).appendDescription("\n:clock" + RandomUtils.randomInt(1, 12) + ": **Hours (Monthly)**: " + hoursMonthly).appendDescription("\n:scroll: **History**: " + history).setThumbnail("https://minotar.net/helm/" + nerd.getName() + "/100.png");
embed.setColor(rank.getDiscordColor());
String name = nerd.getName();
if (nerd.hasNickname())
name = "%s (%s)".formatted(nerd.getNickname(), name);
reply(new MessageBuilder().setContent("@here " + member().getAsMention() + " is suggesting **" + name + "** for **" + camelCase(rank.getName()) + "**").setEmbeds(embed.build()));
}
use of gg.projecteden.discord.appcommands.annotations.Command in project Nexus by ProjectEdenGG.
the class TicketsAppCommand method reopen.
@Command("Reopen a ticket")
void reopen(@Desc("Ticket Id") Ticket ticket) {
if (ticket.isOpen())
throw new InvalidInputException("Ticket already open");
ticket.setOpen(true);
service.save(tickets);
TicketFeature.broadcastDiscord(ticket, nickname(), TicketAction.REOPEN);
thumbsupEphemeral();
}
use of gg.projecteden.discord.appcommands.annotations.Command in project Nexus by ProjectEdenGG.
the class TicketsAppCommand method list.
@Command("List open tickets")
void list() {
List<Ticket> opened = tickets.getTickets().stream().filter(Ticket::isOpen).collect(Collectors.toList());
if (opened.isEmpty())
throw new InvalidInputException("There are no open tickets");
String ids = opened.stream().map(_ticket -> "#" + _ticket.getId()).collect(Collectors.joining(", "));
replyEphemeral(PREFIX + ids);
}
Aggregations