DaRealTurtyWurty / SuperTurtyBot

A multi-purpose discord bot.
GNU Affero General Public License v3.0
6 stars 10 forks source link

[Suggestion] Have a server status command #266

Closed wolfieboy09 closed 1 month ago

wolfieboy09 commented 1 month ago

A command to see things like how many people are in the server. I started a JDA bot a while ago, and here's some code from it:

public class ServerInfoCommand extends BaseCommand {
    @Override
    public void executeCommand(@NotNull SlashCommandInteractionEvent event) {
        EmbedBuilder embedBuilder = new EmbedBuilder();
        Guild guild = event.getGuild();
        assert guild != null;
        String name = guild.getName();

        embedBuilder.setTitle("Server Info for " + name);
        embedBuilder.addField("Name", name, false);
        embedBuilder.addField("Members", guild.getMemberCount() + " Members", false);
        embedBuilder.addField("Created", String.format("<t:%d:f>", ZonedDateTime.parse(guild.getTimeCreated().toString()).toEpochSecond()) , false);
        embedBuilder.setThumbnail(guild.getIconUrl());
        event.replyEmbeds(embedBuilder.build()).queue();
    }

    @NotNull
    @Override
    public CommandData getCommandData() {
        return Commands.slash("serverinfo", "Gets the server info");
    }
}

You would need to change it for TurtyBot to register it and such, and maybe make it better, because I touched this last MONTHS ago

wolfieboy09 commented 1 month ago

Apparently it already exists, just did not know it did