mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-11-22 03:15:41 +01:00
server: send command usage to logging channel
This commit is contained in:
parent
35a3204866
commit
e3c51adf20
@ -186,7 +186,7 @@ client.on('messageCreate', async (message) => {
|
|||||||
|
|
||||||
// Check by the name of the command.
|
// Check by the name of the command.
|
||||||
const cachedModule = cachedModules[`${cmd.toLowerCase()}`];
|
const cachedModule = cachedModules[`${cmd.toLowerCase()}`];
|
||||||
let quoteResponse = null;
|
let quoteResponse: { reply: string; } | null = null;
|
||||||
// Check by the quotes in the configuration.
|
// Check by the quotes in the configuration.
|
||||||
if (!cachedModule) quoteResponse = state.responses.quotes[cmd];
|
if (!cachedModule) quoteResponse = state.responses.quotes[cmd];
|
||||||
if (!cachedModule && !quoteResponse) return; // Not a valid command.
|
if (!cachedModule && !quoteResponse) return; // Not a valid command.
|
||||||
@ -203,15 +203,22 @@ client.on('messageCreate', async (message) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.info(`${message.author.username} ${message.author} [Channel: ${message.channel}] executed command: ${message.content}`);
|
logger.info(`${message.author.username} ${message.author} [Channel: ${message.channel}] executed command: ${message.content}`);
|
||||||
await message.delete();
|
const executeModule = async () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (cachedModule) {
|
if (cachedModule) {
|
||||||
await cachedModule.command(message);
|
await cachedModule.command(message);
|
||||||
} else if (cachedModules.quote) {
|
} else if (cachedModules.quote && quoteResponse) {
|
||||||
await cachedModules.quote.command(message, quoteResponse?.reply);
|
await cachedModules.quote.command(message, quoteResponse.reply);
|
||||||
}
|
}
|
||||||
} catch (err) { logger.error(err); }
|
} catch (err) { logger.error(err); }
|
||||||
|
};
|
||||||
|
await Promise.all(
|
||||||
|
[
|
||||||
|
state.logChannel?.send(`${message.author.username} ${message.author.id} [Channel: ${message.channel}] executed command: \`${message.content}\``),
|
||||||
|
message.delete(),
|
||||||
|
executeModule()
|
||||||
|
]
|
||||||
|
);
|
||||||
} else if (!message.author.bot) {
|
} else if (!message.author.bot) {
|
||||||
// This is a normal channel message.
|
// This is a normal channel message.
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
Loading…
Reference in New Issue
Block a user