@ -1,3 +1,4 @@
import { Permissions } from 'discord.js' ;
import db from '../../models/index.js' ;
import db from '../../models/index.js' ;
const ratelimit = { } ;
const ratelimit = { } ;
@ -30,10 +31,26 @@ export default {
console . log ( ` \x 1b[33m ${ userTag } ( ${ userID } ) \x 1b[0m launched command \x 1b[33m ${ commandName } \x 1b[0m ` ) ;
console . log ( ` \x 1b[33m ${ userTag } ( ${ userID } ) \x 1b[0m launched command \x 1b[33m ${ commandName } \x 1b[0m ` ) ;
// Owner only check
if ( command . ownerOnly && interaction . user . id !== ownerId ) {
if ( command . ownerOnly && interaction . user . id !== ownerId ) {
return interaction . reply ( { content : '❌ This command is reserved for the owner!' , ephemeral : true } ) ;
return interaction . reply ( { content : '❌ This command is reserved for the owner!' , ephemeral : true } ) ;
}
}
// Check if the bot has the needed permissions
if ( command . clientPermissions ) {
const clientMember = await interaction . guild . members . fetch ( client . user . id ) ;
if ( ! clientMember . permissions . has ( command . clientPermissions ) ) {
return interaction . reply ( { content : ` ❌ I am missing one of the following permission(s): \` ${ new Permissions ( command . clientPermissions ) . toArray ( ) } \` ` , ephemeral : true } ) ;
}
}
// Check if the user has the needed permissions
if ( command . userPermissions ) {
if ( ! interaction . member . permissions . has ( command . userPermissions ) ) {
return interaction . reply ( { content : ` ❌ You are missing one of the following permission(s): \` ${ new Permissions ( command . userPermissions ) . toArray ( ) } \` ` , ephemeral : true } ) ;
}
}
try {
try {
const date = new Date ( ) ;
const date = new Date ( ) ;
if ( ratelimit [ userID ] ) {
if ( ratelimit [ userID ] ) {