How do I use Client.updatePresence()?

The core library's Client class has an updatePresence function, how do I use this?
16 Replies
d.js toolkit
d.js toolkit•3y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Post the full error stack trace, not just the top part! - Show your code! - Explain what exactly your issue is. - Not a discord.js issue? Check out #useful-servers.
Sujit
SujitOP•3y ago
client.once(GatewayDispatchEvents.Ready, async ({api}) => {
await client.updatePresence(0, {
activities: [{name: 'name', type: 3}],
status: 'dnd',
});

console.log('I\'m ready!');
});
client.once(GatewayDispatchEvents.Ready, async ({api}) => {
await client.updatePresence(0, {
activities: [{name: 'name', type: 3}],
status: 'dnd',
});

console.log('I\'m ready!');
});
This doesn't seem to work
grass
grass•3y ago
is it not setting anything? are you getting an error?
Sujit
SujitOP•3y ago
no error, it just shows the bot is online
grass
grass•3y ago
Not sure if this’ll work, but provide a since value
Sujit
SujitOP•3y ago
since? what should I set it to?
d4
d4•3y ago
i think that one's nullable, maybe afk is needed instead
grass
grass•3y ago
I don’t believe it is, let me check it is
d4
d4•3y ago
d4
d4•3y ago
try to provide an afk value ^
Sujit
SujitOP•3y ago
Didn't work, tried both true and false oh wait So the activity worked, after I set afk But the status is still online instead of dnd
d4
d4•3y ago
ah try doing since: null
Sujit
SujitOP•3y ago
sadly didn't work
d4
d4•3y ago
worked for me after waiting a bit
Sujit
SujitOP•3y ago
Ah yes @d4isdavid thankyou so much!
d4
d4•3y ago
np

Did you find this page helpful?