-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBotMessage.js
43 lines (39 loc) · 990 Bytes
/
BotMessage.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
// eslint-disable-next-line no-unused-vars
const Discord = require('discord.js');
/**
* @property {Discord.Message} message
* @property {Discord.Channel} channel
* @property { 'info' | 'reply' | 'unknown'}
*/
class BotMessage {
/**
*
* @param {Discord.Channel} channel
* @param {Discord.Message} message
* @param {'info' | 'reply' | 'unknown'} type
*/
constructor(channel, message, type = 'unknown') {
this.channel = channel;
this.message = message;
this.type = type;
}
/**
* @returns
*/
flatten() {
return { channel: this.channel.id, message: this.message.id, type: this.type };
}
/**
*
* @param {Discord.Snowflake[]} list
* @return {Discord.Snowflake[]}
*/
buildlist(list) {
if (list.includes(this.channel)) {
return list;
} else {
return list.concat(this.channel);
}
}
}
module.exports = BotMessage;