Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

677
Views
SyntaxError: Unexpected token 'const' on node.js (discord.js)

The "const" tag is not working on discord.js for a discord bot.

The code is being refered to this the "aboutembed". I don't know what is wrong with the code.

May someone please help? Thanks.

C:\Users\alext\OneDrive\Documents\Toast\index.js:10
const aboutembed = new Discord.MessageEmbed({
^^^^^

SyntaxError: Unexpected token 'const'
←[90m    at Object.compileFunction (node:vm:352:18)←[39m
←[90m    at wrapSafe (node:internal/modules/cjs/loader:1033:15)←[39m
←[90m    at Module._compile (node:internal/modules/cjs/loader:1069:27)←[39m
←[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)←[39m
←[90m    at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)←[39m
←[90m    at node:internal/main/run_main_module:17:47←[39m
const Discord = require('discord.js');
const request = require('request');
const fetch = require('node-fetch');
require('dotenv-flow').config();

const client = new Discord.Client();

var prefix = !!

const aboutembed = new Discord.MessageEmbed({
    title: "Food Bot",
    fields: [
        {
            name: "Author",
            value: "This bot is made by **AlexToucanYT#0001** on Discord, copyrighted by AT Products LLC."
        },
        {
            name: "Commands",
            value: "https://raw.githubusercontent.com/Alex-Toucan/Food-bot/master/files/commands.txt"
        }
    ],
    color: "GREY"
})

client.on('message', msg => {
  if(msg.content.toLowerCase() === '${prefix}help') {
    msg.reply({ embed: aboutembed });
    }
 });

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const client = new Discord.Client();

var prefix = '!!';

The issue in the live var prefix = !!

First of all it doesn't have ; at the end, and last but not least !! is invalid sign in JS.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!