I want to change the status of my Discord bot. I tried the one below, but it didn't work.
const { Client, MessageAttachment } = require('discord.js');
const client = new Client();
client.once('ready', () => {
console.log('Status:Ready');
client.user.setPresence({
game: {
name: 'to radio',
type: 'LISTENING',
},
status: 'online',
});
});
You can use client.user.setActivity. The first parameter in this method is what you want the name of your activity to be.
In the second parameter, you can specify what activity type you want in your status (WATCHING, PLAYING, STREAMING, and LISTENING). For example:
client.on("ready", () => {
// Playing in my support server
client.user.setActivity("in my support server", { type: "PLAYING" });
// Streaming <name of stream>
client.user.setActivity({ type: "STREAMING", url: "<twich url>" });
// Watching over xx servers
client.user.setActivity(`over ${client.guilds.cache.size} servers`, {
type: "WATCHING",
});
// Listening to xxx users
client.user.setActivity(
`to ${client.guilds.cache
.map((guild) => guild.memberCount)
.reduce((p, c) => p + c)} users`,
{ type: "LISTENING" }
);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With