#yeah ik but on the return part it dosent

1 messages · Page 1 of 1 (latest)

trail girder
#

I think you meant to check if it wasnt the owner then return

#

that might be your issue

somber flame
#

yes

#

and it crashes my bot

trail girder
#

then fix it

somber flame
#

the thing is idk why its doing that

#

thats why i came here

somber flame
trail girder
#
 try {
        if (bannedWords.some(word => message.content.toLowerCase().includes(word))) {
            if (message.author.id === message.guild.ownerID) {
                return; // this means that if it IS the owner return early
            }
            await message.delete();
            const swearEmbed = new Discord.MessageEmbed()
            .setColor('#42b6f5')
            .setTitle('Hey!')
            .setDescription("You can't say that in this discord server! 🇽")
            message.author.send({ embeds: [swearEmbed] });
            console.log('@'+ message.author.tag,'tried saying,',message.content)
            message.channel.permissionOverwrites.edit(message.author, {
                SEND_MESSAGES: false
             })
            await new Promise(resolve => setTimeout(resolve,5000 )) //wait until unmute
           message.channel.permissionOverwrites.edit(message.author, {
                SEND_MESSAGES: true
              })
        } 
somber flame
#

thats the thing

#

i was testing it on my server which im the owner on and it dosent return

trail girder
#

so if its the owner of the bot you want to skip this

somber flame
#

it continues the code on the bottom

trail girder
#

console log the message auth and the guild owner id

somber flame
#

new to discord.js what is message auth

trail girder
#

message auth == message author

somber flame
#

oh

#

ok

#

also why would i need to do that

trail girder
#

for debuggin resons

#

lets see whats the underlying issue

#

so before if (message.author.id === message.guild.ownerID) { console.log message.author.id and message.guild.ownerID

somber flame
#

it errored

#

and it said guild is not defined

#

ReferenceError: guild is not defined

trail girder
#

prepend guild.ownerID with message

#

guild doesnt exist because it only exists on the message class

somber flame
#

whats prepend

trail girder
#

add before something

somber flame
trail girder
#

its a normal english word btw

somber flame
#

logged this

#

btw it muted me (did what is supposed to do if ur not the owner which i am)

trail girder
#

ah

#

message.guild.ownerID doesnt exist

#

thats why its failing

digital thistleBOT
trail girder
#

its ownerId not ownerID

somber flame
#

logged it

#

uhm still didint return tho

trail girder
#

are you the owner of the guild you are running the command on

somber flame
#

yes

#

and i want it to return if ur the owner of the guild

#

so basically if u swore it would ignore you

#

and if ur not the owner it would warn you

#

to not swear

trail girder
#

well according to the terminal you are not the user

somber flame
#

i just realized i did that on the wrong account🤦

trail girder
#

ah lol

somber flame
#

my god im dumb

#

ok

#

ty

#

sorry for being dumb lol

trail girder
#

np

#

we all have those issues of stupid sometimes