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