#i ve got the check if it s whitelisted

1 messages · Page 1 of 1 (latest)

pastel stag
#

,

#

Okay lets talk here

#

cus this may take some more time lol

#

And i fucking hate slowmode

last holly
#

yea

pastel stag
#

The command is ran by someone

#

so you have an interaction

last holly
#
client.on('interactionCreate', async interaction => {
    const foundKey=await keySchema.find({ claimedGuild: interaction.guild.id })
    if(foundKey[0]===undefined) return interaction.reply({ embeds: [errorEmbed('Uh oh! This server does not have a valid whitelist to use this bot.')] })
});
pastel stag
#

then you need to do the check, if it comes back as not whitelisted scream at the person

last holly
#

thats what i have so far

#

disregarding the command running after it

#

as it's not really needed for the example

pastel stag
#

If it is whitelisted then proceed to reply with the functionality you want

last holly
#

yeah

#

but i still want a single command to be allowed to be used even without a whitelist

pastel stag
#

put an if before the const foundkey

#

else just check if the guild is in your db

last holly
#

the one set with .setname

#

or the one set on the filename

pastel stag
#

logging interaction as a whole is easiest

#

i cant think of what the property is rn

#

cant reach my code

#

also do check its a slash command

last holly
pastel stag
#

nice thats the one

last holly
pastel stag
#

think so

#

i switchcase on interaction.type

#

i prefer to use the enums rather than the functions xd

last holly
#
!(interaction.isCommand()&&interaction.commandName==='verifykey')```
#

would that mean not all of it

pastel stag
#

why the !

#

you want to filter out this exact case

last holly
#

wouldnt it be easier to put the block in that

#

like this

#

ignore the .isbutton thats for a seperate thing i need to add later on when im done with this

pastel stag
#

possible, a bit backwards

#

no

#

cus you check if its not a command and the name is not verifykey

#

just remove the !

#

thats the specific case which you want to do