-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathembed.js
47 lines (47 loc) · 1.28 KB
/
embed.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
const env = require('./env.js');
const merge = require('lodash/merge');
var setembed = function(opts){
var embed = {
// Discord Embed Template Coda
title: '',
description: '',
color: 0x19ebfe,
url: '',
timestamp: `${new Date().toISOString()}`,
footer: {
text: 'discord.gg/coda',
icon_url: `${global.client.guilds.cache.get(env.discord.guild).iconURL({ dynamic: true })}`,
},
};
return merge (embed, opts);
};
var sendError = function(message){
try {
var embed = setembed({
title: 'Error',
description: `${message}`,
color: 0xe74c3c,
});
global.client.channels.cache.get(env.discord.logs_channel).send({ embeds: [embed] });
}
catch (err) {
console.log(err);
}
};
var log = function(message){
var embed = setembed({
title: 'Log',
description: `${message}`,
color: 0x19ebfe,
});
global.client.channels.cache.get(env.discord.logs_channel).send({ embeds: [embed] });
};
var alert = function(message){
var embed = setembed({
title: '🚨 Alert 🚨',
description: `${message}`,
color: 0xe74c3c,
});
global.client.channels.cache.get(env.discord.logs_channel).send({ content: '🚨 Critical Alert 🚨' + '\n<@&' + env.discord.admin_role + '> <@&' + env.discord.mod_role + '>', embeds: [embed] });
};
module.exports = { setembed, sendError, log, alert };