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
/
function.js
44 lines (34 loc) · 1.51 KB
/
function.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
module.exports = {
/* getMember: function(message, toFind = '') {
toFind = toFind.toLowerCase();
let target = message.guild.members.get(toFind);
if (!target && message.mentions.members)
target = message.mentions.members.first();
if (!target && toFind) {
target = message.guild.members.find(member => {
return member.displayName.toLowerCase().includes(toFind) ||
member.user.tag.toLowerCase().includes(toFind)
});
}
if (!target)
target = message.member;
return target;
},
formatDate: function(date) {
return new Intl.DateTimeFormat('en-US').format(date)
},
promptMessage: async function (message, author, time, validReactions) {
// We put in the time as seconds, with this it's being transfered to MS
time *= 1000;
// For every emoji in the function parameters, react in the good order.
for (const reaction of validReactions) await message.react(reaction);
// Only allow reactions from the author,
// and the emoji must be in the array we provided.
const filter = (reaction, user) => validReactions.includes(reaction.emoji.name) && user.id === author.id;
// And ofcourse, await the reactions
return message
.awaitReactions(filter, { max: 1, time: time})
.then(collected => collected.first() && collected.first().emoji.name);
}
*/
};