My Discord bot does not show the activity status I have tried several methods but none worked my current code looks like this.
client.once('ready', () => {
try {
client.user.setActivity('Test', { type: 'PLAYING' });
console.log(`Bot's Status: successfully updated`);
} catch (error) {
console.error(`Bot's Status: error while updating status`, error);
}
});
I am using node.js v18.18.1
and discord.js the latest version
I have already tried with .setPresence
see below but it did not work either.
client.once('ready', async () => {
try {
client.user.setPresence({
status: 'online',
activity: {
name: 'Test',
type: 'PLAYING'
}
});
console.log(`Bot's Status: successfully updated`)
} catch (error) {
console.error(`Bot's Status: error while updating status`)
}
});
So either I’m not awake enough or it just doesn’t work the bot has got adminesstrator rights has already been kicked and reloaded and the token has been reset but it still doesn’t work.
2
Answers
If you’re using the latest version of
discord.js
then the examples you showed are no longer valid (they used to work before like 2 major versions behind).Right now, for you to change the presence, you should:
For more info, check out the setPresence() method’s documentation.
"type: ‘PLAYING’" is no longer available in discord.js v14 you would need to use the number values or ActivityType Enums