From 82a87c79b24d3940320a5853d9be3d22f05d6a39 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 3 Jul 2024 00:34:10 +0100 Subject: [PATCH] add execution time for commands --- src/main/java/cc/fascinated/bat/service/CommandService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java index a7f4f46..2f621d6 100644 --- a/src/main/java/cc/fascinated/bat/service/CommandService.java +++ b/src/main/java/cc/fascinated/bat/service/CommandService.java @@ -138,6 +138,7 @@ public class CommandService extends ListenerAdapter { @Override public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) { + long before = System.currentTimeMillis(); Guild discordGuild = event.getGuild(); if (event.getUser().isBot()) { 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(), event.getMember(), event.getInteraction()); } catch (Exception ex) {