Skip to content

Commit

Permalink
✨ Add status
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCtrl committed Oct 16, 2021
1 parent 5b3f06d commit 0759875
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,32 @@ import { MessageEmbed } from 'discord.js'
import { createEvent } from '../models/analitycs/events.js'
import currentDate from '../utils/currentDate.js'

let statusInterval = 0
if (process.env.NODE_ENV === 'dev') {
statusInterval = 5000
} else {
statusInterval = 60000
}

export default (client, webhook) => {
console.log(`I'm online sir!`)
console.log(
`Ready to serve ${client.guilds.cache.reduce((mem, g) => (mem += g.memberCount), 0).toLocaleString()} users`
)

// -------------------- Bot status --------------------

setInterval(function () {
let statuses = [
`${client.guilds.cache.reduce((mem, g) => (mem += g.memberCount), 0).toLocaleString()} users`,
`${client.guilds.cache.size.toLocaleString()} servers`,
`${client.config.prefix}help`,
]

let status = statuses[Math.floor(Math.random() * statuses.length)]
client.user.setActivity(status, { type: 'WATCHING' })
}, statusInterval)

// -------------------- Log message --------------------

const embed = new MessageEmbed()
.setColor(client.config.colors.info)
Expand Down

0 comments on commit 0759875

Please sign in to comment.