#idk error

31 messages · Page 1 of 1 (latest)

sly lily

Show the code, if you don't know which line it's referencing show the stack

craggy hound

Is that the lines where the error occurs?

sly lily

Show the error stack

craggy hound

but yeah show the stack

the error stack

calm hornet

@craggy hound preferably explain what's wrong instead of just chugging the solution at people

craggy hound

Can you show us the whole error

whole stack

Can you send the eventHandler.js code

alright well it's very clear

barren tulip

You don’t export an execute function in messageCreate file

craggy hound

Give me a moment

const { PermissionFlagsBits, Events } = require("discord.js");
const client = require("../../index");

const hayday = [
    "kurwa",
    "ku",
    "kur",
    "fuck",
    "chuj",
    "kutas",
    "wtf",
    "fuc",
    "fuk",
    "fu-ck",
];

module.exports = {
    name: Events.MessageCreate,
    execute: async function (message) {
        for (const val of hayday) {
            if (message.content.toLowerCase().includes(val)) {
                if (message.member.permissions.has(PermissionFlagsBits.Administrator))
                    return;
                setTimeout(() => {
                    message.delete();
                    message.channel.send("Nie pisz tak!");
                }, 1000);
            }
        }
    },
};

I'm pretty sure you are supposed to add execute with a function and I recommend you to use the Events enum instead of that format, which also works

barren tulip

Did the message contain multiple swear words? Because you send that embed for every swear word it finds nvm, this was wrong, but that👇

Also don’t use a var as that‘ll be globally scoped… use let

What does? Probably the delete because you now try to delete the message multiple times

And I hope you fixed your own code and not copy the completely wrong code you got spoonfed by lovre

They changed the nesting of the for loop, so it now starts a timeout for every iteration (your code did it correctly to iterate first and then start one timeout after)

Wdym, now? I never said it was right and actually timed them out for spoonfeeding (wrong) code after being asked to not do that

And you would face the same issue if someone said wtf kurwa fuck

So move the timeout out of the for loop either way

sly lily

Sooo, you did use the code lovre sent

barren tulip

Doesn’t change the fact that the message.delete() needs to be outside the loop and sour channel.send too

Is hayday still an array?

Then that will never be true

A string never includes an array

sly lily

Array.includes(string)
Not string.includes(array)

barren tulip

Nah, they want <String>.includes(<String>)

sly lily

I see, then add back the loop or use array.some(e => string.includes(e))

What the hell

Anybody else seen that?