const statuses = [
{ name: "ABC", type: ActivityType.Streaming },
{ name: "DEF", type: ActivityType.Watching },
{ name: "GHI", type: ActivityType.Listening },
{ name: "JKL", type: ActivityType.Playing },
];
client.on('ready', (c) => {
console.log(`✅ ${c.user.tag} is online!`);
setInterval(() => {
var newStatus = statuses[Math.floor(Math.random() * statuses.length)];
client.user.setActivity(newStatus);
}, 10000);
});
statuses.json
(nothing, so far)
I tried adding a JSON file (a random example shown below):
[{
name: "ABC", type: ActivityType.Streaming
name: "DEF", type: ActivityType.Watching
name: "GHI", type: ActivityType.Listening
name: "JKL", type: ActivityType.Playing
}]
But yet, I am still not sure how to call this into my main index.js file.
2
Answers
Create a
.json
file with the information for example like this:[{name: "Orange", type: "fruit"}]
.Then import using
FS
in the main.js
file like this:Create a
statuses.json
file in the same folder like this:(The numbers are enums for the ActivityType)
Then in your code import your .json file: