forked from Supositware/Haha-Yes
Log command args and allow users to opt out
This commit is contained in:
parent
fa3671efdf
commit
cfad048b8e
2 changed files with 26 additions and 2 deletions
|
@ -27,7 +27,15 @@ export default {
|
|||
|
||||
if (!command) return;
|
||||
|
||||
const isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } });
|
||||
|
||||
if (isOptOut) {
|
||||
console.log(`A user launched command \x1b[33m${commandName}\x1b[0m with slash`);
|
||||
}
|
||||
else {
|
||||
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m with slash`);
|
||||
}
|
||||
|
||||
|
||||
// Owner only check
|
||||
if (command.ownerOnly && interaction.user.id !== ownerId) {
|
||||
|
@ -74,6 +82,10 @@ export default {
|
|||
args[arg.name] = payload;
|
||||
});
|
||||
|
||||
if (!isOptOut) {
|
||||
console.log(`\x1b[33m${commandName}\x1b[0m with args ${JSON.stringify(args)}`);
|
||||
}
|
||||
|
||||
await command.execute(interaction, args, client);
|
||||
}
|
||||
catch (error) {
|
||||
|
|
|
@ -290,7 +290,14 @@ export default {
|
|||
const userTag = message.author.tag;
|
||||
const userID = message.author.id;
|
||||
|
||||
const isOptOut = await db.optout.findOne({ where: { userID: message.author.id } });
|
||||
|
||||
if (isOptOut) {
|
||||
console.log(`A user launched command \x1b[33m${commandName}\x1b[0m with prefix`);
|
||||
}
|
||||
else {
|
||||
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m with prefix`);
|
||||
}
|
||||
|
||||
// Owner only check
|
||||
if (command.ownerOnly && message.author.id !== ownerId) {
|
||||
|
@ -394,6 +401,11 @@ export default {
|
|||
|
||||
args[payloadName] = payload;
|
||||
}
|
||||
|
||||
if (!isOptOut) {
|
||||
console.log(`\x1b[33m${commandName}\x1b[0m with args ${JSON.stringify(args)}`);
|
||||
}
|
||||
|
||||
await command.execute(message, args, client);
|
||||
}
|
||||
catch (error) {
|
||||
|
|
Loading…
Reference in a new issue