Compare commits
No commits in common. "cfad048b8e5810b474fad9eb33687e507a958ad2" and "a0de902935752cb5b95b9d585b79cc2e03a4a11b" have entirely different histories.
cfad048b8e
...
a0de902935
4 changed files with 9 additions and 37 deletions
|
@ -4,7 +4,7 @@ import db from '../../models/index.js';
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('optout')
|
.setName('optout')
|
||||||
.setDescription('Opt out of the non commands features and arguments logging (for debugging purposes)'),
|
.setDescription('Opt out of the non commands features.'),
|
||||||
category: 'utility',
|
category: 'utility',
|
||||||
async execute(interaction, args, client) {
|
async execute(interaction, args, client) {
|
||||||
const isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } });
|
const isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } });
|
||||||
|
|
|
@ -27,15 +27,7 @@ export default {
|
||||||
|
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
const isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } });
|
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m with slash`);
|
||||||
|
|
||||||
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
|
// Owner only check
|
||||||
if (command.ownerOnly && interaction.user.id !== ownerId) {
|
if (command.ownerOnly && interaction.user.id !== ownerId) {
|
||||||
|
@ -82,10 +74,6 @@ export default {
|
||||||
args[arg.name] = payload;
|
args[arg.name] = payload;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isOptOut) {
|
|
||||||
console.log(`\x1b[33m${commandName}\x1b[0m with args ${JSON.stringify(args)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
await command.execute(interaction, args, client);
|
await command.execute(interaction, args, client);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
|
@ -290,14 +290,7 @@ export default {
|
||||||
const userTag = message.author.tag;
|
const userTag = message.author.tag;
|
||||||
const userID = message.author.id;
|
const userID = message.author.id;
|
||||||
|
|
||||||
const isOptOut = await db.optout.findOne({ where: { userID: message.author.id } });
|
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m with prefix`);
|
||||||
|
|
||||||
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
|
// Owner only check
|
||||||
if (command.ownerOnly && message.author.id !== ownerId) {
|
if (command.ownerOnly && message.author.id !== ownerId) {
|
||||||
|
@ -401,11 +394,6 @@ export default {
|
||||||
|
|
||||||
args[payloadName] = payload;
|
args[payloadName] = payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOptOut) {
|
|
||||||
console.log(`\x1b[33m${commandName}\x1b[0m with args ${JSON.stringify(args)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
await command.execute(message, args, client);
|
await command.execute(message, args, client);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
16
index.js
16
index.js
|
@ -18,19 +18,15 @@ const client = new Client({
|
||||||
// Load commands
|
// Load commands
|
||||||
client.commands = new Collection();
|
client.commands = new Collection();
|
||||||
|
|
||||||
fs.readdir(`${__dirname}/commands`, (err, categoryPath) => {
|
const categoryPath = fs.readdirSync(`${__dirname}/commands`);
|
||||||
if (err) {
|
categoryPath.forEach(category => {
|
||||||
return console.error(err);
|
loadCommandFromDir(category);
|
||||||
}
|
|
||||||
categoryPath.forEach(category => {
|
|
||||||
loadCommandFromDir(category);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load events
|
// Load events
|
||||||
loadEventFromDir('client', client);
|
await loadEventFromDir('client', client);
|
||||||
if (NODE_ENV !== 'development') {
|
if (NODE_ENV !== 'development') {
|
||||||
loadEventFromDir('process', process);
|
await loadEventFromDir('process', process);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.login(token);
|
client.login(token);
|
||||||
|
@ -64,4 +60,4 @@ async function loadEventFromDir(dir, listener) {
|
||||||
listener.on(event.name, (...args) => event.execute(...args, client));
|
listener.on(event.name, (...args) => event.execute(...args, client));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue