#idk error
31 messages · Page 1 of 1 (latest)
Is that the lines where the error occurs?
Show the error stack
but yeah show the stack
the error stack
@craggy hound preferably explain what's wrong instead of just chugging the solution at people
Can you show us the whole error
whole stack
Can you send the eventHandler.js code
alright well it's very clear
You don’t export an execute function in messageCreate file
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
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
Sooo, you did use the code lovre sent
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
Array.includes(string)
Not string.includes(array)
Nah, they want <String>.includes(<String>)
I see, then add back the loop or use array.some(e => string.includes(e))
What the hell
Anybody else seen that?