This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
62 lines (56 loc) · 1.69 KB
/
utils.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
53
54
55
56
57
58
59
60
61
62
const moment = require("moment")
/**
* Returns a Number that is the timestamp formated for discord.js
* @returns {Date} - Actual timestamp
*/
const getTimestamp = function () {
let time = moment().format()
return time;
};
/**
* Send a discord.js Rich Embed
* @returns {Message} - Return Message Object
*/
const sendInfoEmbed = async function (message, text) {
if (!message || !text) return;
return await message.channel.send({
"embed": {
"color": 15158332,
"author": {
"name": message.author.tag,
"icon_url": message.author.displayAvatarURL
},
"description": text + "\nPlus d'informations avec la commande `e/info <Commande>` <:info:651876257386201090>",
"footer": {
"icon_url": message.guild.iconURL,
"text": "ÉclaryBOT"
},
"timestamp": this.getTimestamp()
}
});
}
/**
* Send a discord.js Rich Embed
* @returns {Message} - Return Message Object
*/
const sendCustomEmbed = async function (message, text) {
if (!message || !text) return;
return await message.channel.send({
"embed": {
"color": 15158332,
"author": {
"name": message.author.tag,
"icon_url": message.author.displayAvatarURL
},
"description": text,
"footer": {
"icon_url": message.guild.iconURL,
"text": "ÉclaryBOT"
},
"timestamp": this.getTimestamp()
}
});
}
module.exports.getTimestamp = getTimestamp
module.exports.sendInfoEmbed = sendInfoEmbed
module.exports.sendCustomEmbed = sendCustomEmbed