0

I'm really trying to fix this error. How can I fix it?

C:\Users\yeet\node_modules\discord.js\src\client\Client.js:41
    } catch {
            ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\yeet\node_modules\discord.js\src\index.js:8:11)

Source code of the bot

const discord = require("discord.js")
const fs = require("fs");
const clc = require("cli-color");
const ConsoleTitle = require("node-bash-title");

const bot = new discord.Client({disableEveryone: true})

ConsoleTitle("TypicSelfBot version b1.0.0")

bot.on("ready", async () => {
    console.log(clc.red("Your current name is: ${bot.user.username}"))
    setTimeout( () => {
        console.log(clc.green("Ready to use"))
        console.log(clc.green("Prefix is -"))
        console.log(clc.green("Commands: -embed; More coming soon"))
    }, 200)
})
bot.on("message", async message => {
    if(message.content === "-embed")
    {
        let embed = new discord.RichEmbed()
        .setDescription("Made by TypicScripter on Roblox, Discord: Typic#0001 or TypicScripter#0001")
        .setFooter("This is a embed message - adding arguments soon")
    }
})

bot.login("") // Put your Discord token here. This wont log your token.

I want to make this bot, but nobody knows how to fix it.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124

1 Answers1

0

I've been having the same issue regarding one of the bots I'm currently working on. This seems to be an issue with the current discord.js version as replacing the node_modules folder with an older intact one seemed to fix the problem.

Try replacing your node_modules folder with this one. This resolved the problem for me

https://drive.google.com/file/d/1Us8qO-_jUkRRx6oUpEasvsflRAMdko6R/view?usp=sharing

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
  • Why would we trust random code downloaded from the Internet? Where does this code originate? – Peter Mortensen Dec 09 '20 at 13:12
  • This is the zip archive of a folder directly generated from executing the npm install discord.js command, just an earlier version than what was up to date at the time. If you don't trust it, don't download it. I'm just trying to help. – Kawataro Dec 10 '20 at 14:07