From d64ad02368b47378dbfe93d3850c19d7a7cd55ae Mon Sep 17 00:00:00 2001 From: Supositware Date: Sun, 14 Aug 2022 22:29:19 +0200 Subject: [PATCH] Block people who are blacklisted --- events/client/interactionCreate.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/events/client/interactionCreate.js b/events/client/interactionCreate.js index 42db764..a691de7 100644 --- a/events/client/interactionCreate.js +++ b/events/client/interactionCreate.js @@ -1,9 +1,19 @@ +import db from '../../models/index.js'; export default { name: 'interactionCreate', async execute(interaction) { const client = interaction.client; if (!interaction.isCommand()) return; + const globalBlacklist = await db.Blacklists.findOne({ where: { type:'global', uid:interaction.user.id } }); + const commandBlacklist = await db.Blacklists.findOne({ where: { type:interaction.commandName, uid:interaction.user.id } }); + if (globalBlacklist) { + return interaction.reply({ content: 'You are globally blacklisted.', ephemeral: true }); + } + else if (commandBlacklist) { + return interaction.reply({ content: 'You are blacklisted.', ephemeral: true }); + } + const command = client.commands.get(interaction.commandName); console.log(`\x1b[33m${interaction.user.tag} (${interaction.user.id})\x1b[0m launched command \x1b[33m${interaction.commandName}\x1b[0m`);