use of de.tectoast.emolga.commands.Command in project Emolga by TecToast.
the class StatisticsCommand method process.
@Override
public void process(GuildCommandEvent e) throws Exception {
ResultSet set = Database.select("SELECT * FROM `statistics` ORDER BY `count` DESC");
String analysis = "";
ArrayList<String> otherCmds = new ArrayList<>();
while (set.next()) {
int count = set.getInt("count");
String name = set.getString("name");
if (name.equals("analysis"))
analysis = "Analysierte Replays: " + count;
else {
Command c = byName(name.substring(4));
if (c == null)
continue;
logger.info("name = " + name);
if (c.checkBot(e.getJDA(), e.getGuild().getIdLong()))
otherCmds.add(c.getPrefix() + c.getName() + ": " + count);
}
}
e.reply(new EmbedBuilder().setColor(Color.CYAN).setTitle("Anzahl der Nutzung").setDescription(analysis + "\n" + String.join("\n", otherCmds)).build());
}
Aggregations