Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda