client.user.setActivity() doesnt work


When I run client.user.setActivity() in the ready script on terminal on my computer it works, but all of a sudden on Glitch it says it’s not a function?


Hi @GlitchMob04, welcome to the Glitch forum!

I’m moving this topic to the Discord Help category under the assumption that the client you mention is for a Discord bot. If that’s not the case let us know.

As far as your specific issue is concerned, seeing more of your code would be helpful. Ideally you’d share your project name so that folks to take a look.


Yes, it’s a discord bot, and the code is quite simple, it just sets the bot’s ‘game’ when it starts, and here’s the code:

client.on("ready", () => {
  console.log(`Bot: Hosting ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`); 
  client.user.setActivity(`Use f!help.`);

And the error it gives me is that it’s not a function:

Bot: Hosting 34 users, in 40 channels of 1 guilds.
client.user.setActivity(`Use f!help.`);
TypeError: client.user.setActivity is not a function
at Client.client.on (/app/server.js:24:15)
at Client.emit (events.js:187:15)

MOD EDIT: formatting


You can use this

client.on('ready', () => {
console.log('Bot: Hosting ' + `${client.users.size}` + ' users, in ' + `${client.channels.size}` + ' channels of ' + `${client.guilds.size}` + ' guilds.');
        game: {
            name: 'Use f!help',
            type: "Playing",
            url: ""

MOD EDIT: formatting


The following code should be the correct code. @PixelMania They had removed setPresence awhile back, so I do not think it would work unless he was using an earlier version!

client.on("ready", () => {
Use f!help.
client.user.setActivity(`Use f!help.`, {type: "playing"}); 


PixelMania’s code worked, but for some reason it insists that setActivity isn’t a function.


The current documentation seems to agree that setPresence is current and setActivity is no longer available.