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

188
Views
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
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!