Errors with Discord Bot


I recently started messing around with Discord bots, and found this site as a place to keep the bot running when my personal computer is off. I’m surprised I haven’t heard of it earlier! Anyways, I get errors now with my bot on, whereas with the same code, I don’t get any when running it from my desktop. I think it might be because the version of discord.js on my desktop is newer than the version on Glitch. It seems to cause an error after I create an embed and use ".addField()" on it. I tried going into the terminal and typing npm install discord.js@12.1.1 but I don’t think that worked.

Here is a link to my project

Thanks ahead of time!

Hi, discord.js@12.x has problems (for me) and i can’t help you but you can special Embed class like discord.js@11.4.2 RichEmbed class. Look discord.js@11.4.2 source code.

Try typing “*” as the version in dependencies. also i suggest putting your bot token in .env so no one else can see it. Also if you don’t already know inactive projects go to sleep if you haven’t paid.

everything appears to be setup properly, as far as i am able to see in the project. are you still having that error?

Shadow Development

Thanks for the tip about the .env, I’ll set that up. Using * as the version the the discord.js dependencies didn’t fix the problem. I’m still getting the same error.

Yes, I’m still getting the error. Would it help to send the error message? You could also test it yourself if you put any bot token in the config and try it for yourself by typing the >help command in a server the bot is in.

yea that would help. I don’t really have a bot token i can use to test right now

Here’s a screenshot of the error.
I use .addField() on my embed, which I think was added to a recent version of discord.js, so that’s why I think it’s not using the latest version

1 Like

ah i see the problem:
discord.js v12 needs node.js v12 or higher to work, and you probably have v8 or v10 node.js in your project. you can change that in your package.json with this:

  "engines": {
    "node": "12.x"
1 Like

.addField() has actually been around for a long while, but they changed some of the internal methods they use for making the fields, that’s why (:

This worked, thanks!

1 Like