GeoXTen
1
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 using Discord.Client
and also, don’t set the activity twice.
And make sure that you are in the client.on("ready")
event.
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" });
GeoXTen
7
and then i get error below
picture :
GeoXTen
8
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”
//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
Yonle
16
Client variable is already declarated at the Top of your Code. Please check your Code.
Yonle
17
If i see at your code, You can do this:
client.user.setActivity("Cave Story")
That is not a discord client.