forked from Fascinated/Bat
update command log
This commit is contained in:
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();
|
||||
|
Loading…
Reference in New Issue
Block a user