-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiscord-message.js
52 lines (36 loc) · 1.16 KB
/
discord-message.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const Discord = require('discord.js');
const {
NEW_WORLD_STATUS_SITE,
NEW_LINE_EMBED,
MATERIAL_UNHEALTHY_COLOR,
FIRE_EMOJI,
OK_EMOJI } = require('./constants')
const GetBaseEmbed = () => {
const embed = new Discord.MessageEmbed()
.setColor(MATERIAL_UNHEALTHY_COLOR)
.setTitle('New World Server Status')
.setURL(NEW_WORLD_STATUS_SITE)
.setTimestamp()
.setFooter('Ultima atualização', '');
return embed
}
const GetEmbedNotificationMessage = (serversStatus) => {
let reportList = []
serversStatus.forEach(el => {
let regionNotification = GetBaseEmbed()
console.log(el.region, el.servers.length)
regionNotification.addField(el.region, NEW_LINE_EMBED, false)
el.servers.forEach(s => {
regionNotification.addField(GetEmojiStatus(s.status), s.name, true)
})
reportList.push(regionNotification)
})
return reportList
}
const GetEmojiStatus = (status) => {
if (status === "UP") return OK_EMOJI
return FIRE_EMOJI
}
const GetWelcomeMessage = () => {
}
module.exports = { GetEmbedNotificationMessage }