Discord status doesn't work

const { Client } = require(“klasa”);
require(“dotenv”).config();
const { token, prefix, ytkey, sckey } = process.env;
const Discord = require(‘discord.js’);

i add this below and get error
Client.user.setActivity(’’, { type: ‘WATCHING’ });
Client.user.setActivity(’’, { type: ‘LISTENING’ });

error : Client.user.setActivity(’’, { type: ‘WATCHING’ });
------------------------^---------------------------------

something wrong at “set” ???


Try this?

Try using Discord.Client and also, don’t set the activity twice.

And make sure that you are in the client.on("ready") event.

already but didn’t work

Maybe try this:

const Discord = require("discord.js");
const client = new Discord.Client();
client.on("ready", () => {
  client.user.setActivity("Hello World", { type: "WATCHING" });
});
client.login("YOUR-DISCORD-TOKEN");

Or just this alone

Client.user.setActivity("Hello World", { type: "WATCHING" });

and then i get error below

picture :

what should do after this?

You shouldn’t put them both. Put the single lined code only.

//load the bot
let client = new Client({
fetchAllMembers: false,
prefix: prefix,
disabledCorePieces: [“commands”],
disabledEvents: [“TYPING_START”],
commandEditing: true,
typing: false,
console: { useColor: true, utc: true },
pieceDefaults: {
commands: { deletable: true, promptLimit: 5, quotedStringSupport: true }
},
readyMessage: client =>
Logged in as ${client.user.username}#${client.user.discriminator} and serving ${client.guilds.cache.size} guilds.
}).login(token);

what should i do then?
error on “let client”

can we do dm?

//load the bot
let client = new Client(
{
  fetchAllMembers: false,
  prefix: prefix,
  disabledCorePieces: [“commands”],
  disabledEvents: [“TYPING_START”],
  commandEditing: true,
  typing: false,
  console:
  {
    useColor: true,
    utc: true
  },
  pieceDefaults:
  {
    commands:
    {
      deletable: true,
      promptLimit: 5,
      quotedStringSupport: true
    }
  },
  readyMessage: client => Logged in as $
  {
    client.user.username
  }
  #$
  {
    client.user.discriminator
  }
  and serving $
  {
    client.guilds.cache.size
  }
  guilds.
}).login(token);

May I ask what Discord.js version you are using. (Commando, or Normal)

2 Likes

here (12.3.1)

Client variable is already declarated at the Top of your Code. Please check your Code.

If i see at your code, You can do this:

client.user.setActivity("Cave Story")

That is not a discord client.