client.user.setStatus not working

const { Client, Intents } = require("discord.js");

const client = new Client({
partials: ["CHANNEL"],
intents: new Intents(32767)
});

client.on('ready', async () => {
client.user.setStatus('offline');
console.log(`${client.user.tag} is ready!`);
});

client.login(process.env.DISCORD_BOT_TOKEN)
const { Client, Intents } = require("discord.js");

const client = new Client({
partials: ["CHANNEL"],
intents: new Intents(32767)
});

client.on('ready', async () => {
client.user.setStatus('offline');
console.log(`${client.user.tag} is ready!`);
});

client.login(process.env.DISCORD_BOT_TOKEN)
13 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Kevinnnn
Kevinnnn11mo ago
is there an error when you try to set the status?
みなもとしずか
No errors occurred
Kevinnnn
Kevinnnn11mo ago
Also, you can pass presence data in the client options
d.js docs
d.js docs11mo ago
interface ClientOptions Options for a client.
Kevinnnn
Kevinnnn11mo ago
under the option presence, and it takes a PresenceData object its also called "invisible", not "offline"
みなもとしずか
It does not work Is the code wrong?
const client = new Client({
partials: ["CHANNEL"],
intents: new Intents(32767),
presence:{
status:'invisible',
}
});
const client = new Client({
partials: ["CHANNEL"],
intents: new Intents(32767),
presence:{
status:'invisible',
}
});
Kevinnnn
Kevinnnn11mo ago
it looks right from what i can tell add this into your code before the ready event and send the console output
d.js docs
d.js docs11mo ago
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on("debug", console.log)
.on("warn", console.log)
client
.on("debug", console.log)
.on("warn", console.log)
- Note: if you initialize your Client as bot or other identifiers you need to use these instead of client - If the output is too long to post consider using a bin instead: gist | paste.gg | sourceb.in | hastebin
みなもとしずか
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 853

[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 9
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 45ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 32767
[WS => Shard 0] [READY] Session dec411b6d1e01aea6925fc517bbf7a9a | Resume url wss://gateway-us-east1-b.discord.gg.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
test#8343 is ready!
[WS => Shard 0] Heartbeat acknowledged, latency of 16ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 15ms.
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 853

[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 9
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 45ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 32767
[WS => Shard 0] [READY] Session dec411b6d1e01aea6925fc517bbf7a9a | Resume url wss://gateway-us-east1-b.discord.gg.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
test#8343 is ready!
[WS => Shard 0] Heartbeat acknowledged, latency of 16ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 15ms.
Kevinnnn
Kevinnnn11mo ago
And you're saying the bot is still marked as online when it logs in?
みなもとしずか
Sorry this code worked. The position of semicolon was inappropriate
jay
jay11mo ago
just wanted to add something to prevent other problems you don’t need 32767 as intents
Want results from more Discord servers?
Add your server