mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 22:16:13 +00:00
Better logging for command execution time
This commit is contained in:
1 parent
9f5dd47954
commit
217e2f1c2a
1 file changed
+5
-2
@@ -101,14 +101,17 @@ client.on('interactionCreate', async (interaction) => {
|
||||
if (!command) return;
|
||||
|
||||
try {
|
||||
const inputTime = new Date();
|
||||
await interaction.deferReply();
|
||||
await command.run({ interaction, client });
|
||||
const outputTime = new Date();
|
||||
const executionTime = outputTime - inputTime;
|
||||
console.log(
|
||||
`${new Date().toISOString().substring(11, 19)}: ${
|
||||
interaction.guild.name
|
||||
} (#${interaction.guild.memberCount})> Command '/${
|
||||
} (#${interaction.guild.memberCount})> Ran command '/${
|
||||
interaction.commandName
|
||||
}' was executed successfully.`
|
||||
}' successfully in ${executionTime} ms.`
|
||||
);
|
||||
} catch (error) {
|
||||
// log error to console with full object depth
|
||||
|
||||
Reference in new issue
Block a user