ownerOnly commands

This commit is contained in:
Supositware 2022-08-17 16:22:22 +02:00
parent 4530b265e7
commit ce945612da

View file

@ -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]) {