Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

432
Vistas
SyntaxError: Unexpected token '??=' // Making a Quote Bot with Autocode using node.js/discord.js

Trying to make a quote bot that pulls from a discord text channel. im a total newbie at this, but i think this error means i have a library problem since it seems to reference something outside my function. I'm using autocode if it helps.

{
  "error": {
    "type": "RuntimeError",
    "message": "Unexpected token '??='",
    "stack": "/opt/node_modules/discord.js/src/rest/APIRequest.js:34\n    agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });\n          ^^^\n\nSyntaxError: Unexpected token '??='"
  }
}

and here's my code

const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});

const Discord = require('discord.js');
const client = new Discord.Client();

const channel = client.channels.cache.get(773835211699912724) 
// you can use `message.channel` instead of this variable if you want to get the message from the channel you send the command
const randomMsg = channel.messages.cache.random(1)
message.channel.send(`"${randomMsg.content}"`)

// Only respond to messages containing the word "hi", "hey", "hello", or "sup"
if (context.params.event.content.match(/\bquote\b/i)) {
  await lib.discord.channels['@0.3.1'].messages.create({
    channel_id: context.params.event.channel_id,
    content: messageContent.join('\n'),
    message_reference: {
      message_id: context.params.event.id
    }
  });
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda