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.