update command log
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m13s

This commit is contained in:
Lee 2024-07-06 20:08:26 +01:00
parent 353962e569
commit 04c4533c40

@ -16,6 +16,7 @@ import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.commands.Command;
@ -229,8 +230,14 @@ public class CommandService extends ListenerAdapter {
// Execute the command
try {
command.execute(guild, user, event.getChannel(), event.getMember(), event.getInteraction());
log.info("Executed command \"{}\" for user \"{}\" (took: {}ms)", command.getInfo().getName(), user.getName(), System.currentTimeMillis() - before);
MessageChannelUnion channel = event.getChannel();
command.execute(guild, user, channel, event.getMember(), event.getInteraction());
log.info("Executed command \"{}\" for user \"{}\" in channel \"{}\" (took: {}ms)",
command.getInfo().getName(),
user.getName(),
channel.getName(),
System.currentTimeMillis() - before
);
} catch (Exception ex) {
log.error("An error occurred while executing command \"{}\"", command.getInfo().getName(), ex);
event.replyEmbeds(EmbedUtils.genericInteractionError(ex).build()).setEphemeral(true).queue();