blob: 68c44d74996cedfbcc47d827a72b3d7e62d487f1 (
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
|
import { MessageMentionOptions, MessageMentionTypes } from 'discord.js';
export default 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[]
};
}
}
|