'node:events' Error in my Discord bot

Could you point us to the ready-made code and/or the tutorial? If Google translate is modifying your code you can see how that would create even more issues. We can’t see your code we see what translate felt like translating it to.

So I’ll suggest that you translate the text of your message but avoid putting your code through the translator.

If you look at your screenshot above (it shouldn’t have gone thru translation) you will see you are setting the content to “lowercase” and comparing it to “Hi” which clearly has a capital letter. This means they can never be equal.

You are pasting tiny snippets as well so we’re stuck wondering why you used a string like “everyone” originally. If that is in the tutorial it is seemingly a mistake. My feeling is if you copy some ready-made code from a tutorial it should work. If it doesn’t I tend to contact the author of the tutorial as they ought to know what they meant when they used a string where a bitfield is required.

You can see nobody is not interested in helping you don’t supply enough information and seemingly get a little annoyed when we don’t just fix it. Who is the original author of that code? Perhaps there are fixes posted.

I got this Infrastructure from a video on Youtube. Video;

The link where I got the code;

And I think there was a misunderstanding again, I’m not translating my code and in the videos I’ve watched people have said that the ToLowercase Command is used to detect all kinds of messages;
Hi hi hİ , as

And I’m a Turk

So there are a couple of things that are affecting your progress. I’m not going to outline them all but let’s start with you are using Discord.Js version 12.5.1. This one is old, I don’t know if it is still supported (maybe) but version 13 is the one to use going forward.

The line you originally posted looks as follows in the code you reference which doesn’t look like the original line that you posted.

const client = new Discord.Client({ disableMentions: ‘everyone’ });

Whomever said the toLowerCase function detects things was mistaken. It isn’t used for detecting things. My advice is to get your information from a “definitive source” not just some random people who may not really understand.

https://www.w3schools.com/jsref/jsref_tolowercase.asp

I realize that these sites are in English perhaps there are alternative Turkish versions but there is a Try It Yourself option so you can test things. If you test your code you will see that it will never match.

Thank you for giving me this information, I will do more research on this, I guess I should start with JavaScript first. Do you have a Training Video you recommend?

Note: I was able to return late because I have school

Note 2: I translated the site into Turkish and had the opportunity to review it.

JavaScript is the foundation so you should be familiar with it. Discord bots use a system called Node which is server-side JavaScript and typically a library named Discord.JS. Each layer is built upon the previous one so jumping into discord bots before knowing JS basics is going to be tough.

I found this, it looks like a translation of a modern JS book.

You don’t have to memorize everything, I often don’t remember the syntax for a library function I rarely use BUT I know the library has such a function so I look it up. You need to know what a variable is and a constant. Data types, assignments, comparisons, loops, etc.

If you see an example on a website and it shows things[0] you should be able to say “oh that’s an array”. If you wanted to learn chess (for instance) you should learn how the chessmen move before trying to play the game.

Thanks I’ll take a look at this

but i have a question, i was looking at the site right now, should i download it or check it on the site?

Writing code is error prone. You will probably make mistakes during this process. Pardon! You will definitely make mistakes

I Love This Word :smiley:

If you want to read it offline you can clone the project. It is a “project” but I assume mostly a translation of the book so reading it online is fine as well. I’d read it online so you don’t have to worry to much about updates.

"The only way to learn a new programming language is by writing programs in it." - Dennis Ritchie

"Testing leads to failure, and failure leads to understanding." - Burt Rutan

I just realized something, how did we get here from the reason I opened this topic? I was researching the latest node:Events error and suddenly I started reading articles about Javascript :smiley:

I also liked the articles you wrote.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.