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 toolkit17mo 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
SujitOP17mo 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
grass17mo ago
is it not setting anything? are you getting an error?
Sujit
SujitOP17mo ago
no error, it just shows the bot is online
grass
grass17mo ago
Not sure if this’ll work, but provide a since value
Sujit
SujitOP17mo ago
since? what should I set it to?
d4
d417mo ago
i think that one's nullable, maybe afk is needed instead
grass
grass17mo ago
I don’t believe it is, let me check it is
d4
d417mo ago
d4
d417mo ago
try to provide an afk value ^
Sujit
SujitOP17mo 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
d417mo ago
ah try doing since: null
Sujit
SujitOP17mo ago
sadly didn't work
d4
d417mo ago
worked for me after waiting a bit
Sujit
SujitOP17mo ago
Ah yes @d4isdavid thankyou so much!
d4
d417mo ago
np
Want results from more Discord servers?
Add your server