From ce945612da7e5e39693fa4abba97611e27089a30 Mon Sep 17 00:00:00 2001 From: Supositware Date: Wed, 17 Aug 2022 16:22:22 +0200 Subject: [PATCH] ownerOnly commands --- events/client/interactionCreate.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/events/client/interactionCreate.js b/events/client/interactionCreate.js index 9163d7ec..b075f2e7 100644 --- a/events/client/interactionCreate.js +++ b/events/client/interactionCreate.js @@ -1,5 +1,10 @@ import db from '../../models/index.js'; const ratelimit = {}; + +import dotenv from 'dotenv'; +dotenv.config(); +const { ownerId } = process.env; + export default { name: 'interactionCreate', async execute(interaction) { @@ -20,10 +25,15 @@ export default { const commandName = interaction.commandName; const command = client.commands.get(commandName); - console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m`); if (!command) return; + console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m`); + + if (command.ownerOnly && interaction.user.id !== ownerId) { + return interaction.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true }); + } + try { const date = new Date(); if (ratelimit[userID]) {