Output :
Code :
const channelID = '780521263554494564';
const channel = bot.channels.cache.get(channelID);
const fetched = await channel.messages.fetch({
limit: 100,
});
const notPinned = fetched.filter(fetchedMsg => !fetchedMsg.pinned);
await channel.bulkDelete(notPinned, true);
const statembed = new Discord.MessageEmbed()
.setAuthor(`${bot.user.username} Statistics`, bot.user.displayAvatarURL())
.setThumbnail(bot.user.displayAvatarURL())
.setColor(`RANDOM`).setDescription(`**❯ Total Guilds : **${bot.guilds.cache.size} Guilds
**❯ Total Users : **${bot.guilds.cache.reduce((a, b) => a + b.memberCount, 0)} Users
**❯ Total Channels : **${bot.channels.cache.size} Channels
**❯ Uptime : **${ms(bot.uptime, { long: true })}
**❯ Discord.js : **v${Discord.version}
**❯ Arch : **${os.arch()}
**❯ Platform : **${os.platform()}
**❯ CPU : **${os.cpus().map(i => `${i.model}`)[0]}
**❯ Memory Usage : **${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}/${(
os.totalmem() /
1024 /
1024
).toFixed(2)} MB`);
const messsage = bot.channels.cache
.get(channelID)
.send(statembed)
.then(async msg => {
setInterval(function () {
const updatedstatembed = new Discord.MessageEmbed()
.setAuthor(`${bot.user.username} Statistics`, bot.user.displayAvatarURL())
.setThumbnail(bot.user.displayAvatarURL())
.setColor(`RANDOM`).setDescription(`**❯ Total Guilds : **${bot.guilds.cache.size} Guilds
**❯ Total Users : **${bot.guilds.cache.reduce(
(a, b) => a + b.memberCount,
0,
)} Users
**❯ Total Channels : **${bot.channels.cache.size} Channels
**❯ Uptime : **${ms(bot.uptime, { long: true })}
**❯ Discord.js : **v${Discord.version}
**❯ Arch : **${os.arch()}
**❯ Platform : **${os.platform()}
**❯ CPU : **${os.cpus().map(i => `${i.model}`)[0]}
**❯ Memory Usage : **${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(
2,
)}/${(os.totalmem() / 1024 / 1024).toFixed(2)} MB`);
msg.edit(updatedstatembed);
}, 30000);
});
Place the above code in the ready event file or create an event in the main/index.js file.
Join the Discord Server for further assistance.