-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathpermissions-handler.js
45 lines (39 loc) · 1.27 KB
/
permissions-handler.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
module.exports = {
checkTextPerms(channel) {
return Object.entries(this.textChannelPerms)
.filter((p) => !channel.permissionsFor(channel.guild.me.id).has(p[0]))
.map((p) => p[1]);
},
checkVoicePerms(vc) {
return Object.entries(this.voiceChannelPerms)
.filter((p) => !vc.permissionsFor(vc.guild.me.id).has(p[0]))
.map((p) => p[1]);
},
checkGuildPerms(guild) {
return Object.entries(this.guildPerms)
.filter((p) => !guild.me.hasPermission(p[0]))
.map((p) => p[1]);
},
// You can find a list of available permissions at
// https://discord.js.org/#/docs/main/stable/class/Permissions?scrollTo=s-FLAGS
textChannelPerms: {
VIEW_CHANNEL: 'Read Messages',
SEND_MESSAGES: 'Send Messages',
EMBED_LINKS: 'Embed Links',
ADD_REACTIONS: 'Add Reactions',
USE_EXTERNAL_EMOJIS: 'Use External Emojis',
ATTACH_FILES: 'Attach Files',
},
guildPerms: {
MANAGE_CHANNELS: 'Manage Channels',
MANAGE_ROLES: 'Manage Roles',
MOVE_MEMBERS: 'Move Members',
CREATE_INSTANT_INVITE: 'Create Invite',
},
voiceChannelPerms: {
VIEW_CHANNEL: 'View Channel',
CONNECT: 'Connect',
SPEAK: 'Speak',
USE_VAD: 'Use Voice Activity',
},
};