add execution time for commands
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 40s

This commit is contained in:
Lee 2024-07-03 00:34:10 +01:00
parent e795d542b9
commit 82a87c79b2

@ -138,6 +138,7 @@ public class CommandService extends ListenerAdapter {
@Override @Override
public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) { public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) {
long before = System.currentTimeMillis();
Guild discordGuild = event.getGuild(); Guild discordGuild = event.getGuild();
if (event.getUser().isBot()) { if (event.getUser().isBot()) {
return; return;
@ -230,7 +231,8 @@ public class CommandService extends ListenerAdapter {
} }
} }
log.info("Executing command \"{}\" for user \"{}\"", commandName, user.getDiscordUser().getName()); log.info("Executing command \"{}\" for user \"{}\" (took: {}ms}", commandName, user.getDiscordUser().getName(),
System.currentTimeMillis() - before);
executor.execute(guild, user, ranInsideGuild ? event.getChannel().asTextChannel() : event.getChannel().asPrivateChannel(), executor.execute(guild, user, ranInsideGuild ? event.getChannel().asTextChannel() : event.getChannel().asPrivateChannel(),
event.getMember(), event.getInteraction()); event.getMember(), event.getInteraction());
} catch (Exception ex) { } catch (Exception ex) {