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

179
Vistas
Set a discord bot's presence with json config variables

I'm trying to create a typescript discord bot that can set its presence appearance based on the bot's config variables from the config.json file.

index.ts:


client.on('ready', async () => {
   client.user?.setPresence({
      activities: [{ 
         name: `${config.activity}`,
         type: `${config.type}`
      }],
   status: `${config.status}`
   });
});

config.json:

{
    "status": "online",
    "type": "LISTENING",
    "activity": "for !help",

    "prefix": "!",
    "version": "1.0",
}

I get an error saying "Type 'string' is not assignable to type 'PresenceStatusData | undefined'.ts(2322) in the type and status part. The name part doesn't seem to be affected by this error. Before anybody asks, I have checked if the json configurations works properly. It parses the data as it should (not sure if parse is the correct word here, please correct me if this is a mistake).

I'm also using Discord.js version 13 if that helps.

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