blob: 9b02c31f6d3db2c029d32ba16e7e5e11d28efcf8 (
plain)
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
|
import { MessageMentionOptions, MessageMentionTypes } from 'discord.js';
export class AllowedMentions {
public everyone: boolean;
public users: boolean;
public roles: boolean;
public static none(): MessageMentionOptions {
return { parse: [] };
}
public static all(): MessageMentionOptions {
return {
parse: ['everyone', 'roles', 'users']
};
}
public static users(): MessageMentionOptions {
return {
parse: ['users']
};
}
public static everyone(): MessageMentionOptions {
return {
parse: ['everyone']
};
}
public static roles(): MessageMentionOptions {
return {
parse: ['roles']
};
}
public constructor(users = true, roles = false, everyone = false) {
this.everyone = everyone;
this.roles = roles;
this.users = users;
}
public toObject(): MessageMentionOptions {
return {
parse: [
...(this.users ? ['users'] : []),
...(this.roles ? ['roles'] : []),
...(this.everyone ? ['everyone'] : [])
] as MessageMentionTypes[]
};
}
}
|