-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaxs.js
33 lines (25 loc) · 885 Bytes
/
axs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const Discord = require('discord.js')
const schedule = require('node-schedule')
const { updateActivity, scheduleRule } = require('./utils')
const client = new Discord.Client({ intents:[] });
client.login(process.env.AXS_BOT_TOKEN);
const updateClient = async () => {
console.info('Bot AXS ready.')
const promises = []
try {
client.guilds.cache.each((guild) => {
const bot = guild.members.cache.first()
const role = guild.roles.cache.find((role) => role.name === 'AXS Price')
const user = client.user;
promises.push(updateActivity('AXS', user, bot, role))
schedule.scheduleJob(scheduleRule, async () => {
await updateActivity('AXS', user, bot, role)
})
})
await Promise.all(promises)
} catch (err) {
console.error(err)
}
}
client.on('ready', updateClient)
client.on('guildCreate', updateClient)