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

177
Vistas
Cannot read properties of undefined (reading 'join')

When i'm try to run my command i'm getting TypeError: Cannot read properties of undefined (reading 'join') error. I'm on discord.js 13, and here is my code

const { MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const translate = require('@iamtraction/google-translate');
module.exports = {
  name: 'fact',
  description: 'Випадковий факт',
  category: 'Fun',
  async run({ interaction, bot }) {
    const response = await fetch('https://uselessfacts.jsph.pl/random.json?language=en');
    await response.json().then(res => {
    const translated = translate(res, { to: 'uk' });
      interaction.reply({
        embeds: [new MessageEmbed().setTitle('Факт').setDescription(translated.text.join("\n")).setColor('RANDOM')]
      });
    });
  }
};
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

translate function returns a Promise object, so you have to put await keyword infront of translate function as below.

await response.json().then(async res => {
const translated = await translate(res, { to: 'uk' });
  
about 4 years ago · Santiago Gelvez Denunciar
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