This repository has been archived by the owner on May 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfig.js.example
86 lines (79 loc) · 3.14 KB
/
config.js.example
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright (c) 2019 An Idiot's Guide. All rights reserved. MIT license.
// https://github.com/AnIdiotsGuide/guidebot-class
const config = {
// Bot Admins, level 9 by default. Array of user ID strings.
"admins": [],
// Bot Support, level 8 by default. Array of user ID strings.
"support": [],
// Dashboard settings
"dashboard" : {
"oauthSecret": "",
"callbackURL": "",
"sessionSecret": "",
"domain": "",
"port": 3030
},
// PERMISSION LEVEL DEFINITIONS
permLevels: [
// Default permLevel for regular users
{ level: 0,
name: "User",
// No need to check; just returns true which allows them to execute any command their
// level allows them to.
check: () => true
},
{ level: 2,
name: "Moderator",
// The following lines check the guild the message came from for the roles.
// Then it checks if the member that authored the message has the role.
// If they do, it returns true, which will allow them to execute the command in question.
// If they don't, it returns false, which will prevent them from executing the command.
check: (message) => {
try {
const modRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.modRole.toLowerCase());
if (modRole && message.member.roles.has(modRole.id)) return true;
} catch (e) {
return false;
}
}
},
{ level: 3,
name: "Administrator",
check: (message) => {
try {
const adminRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.adminRole.toLowerCase());
return (adminRole && message.member.roles.has(adminRole.id));
} catch (e) {
return false;
}
}
},
{ level: 4,
name: "Server Owner",
// Simple check - checks if the guild owner id matches the message author's ID, and if so, it will return true.
// Otherwise, it will return false.
check: (message) => message.channel.type === "text" ? (message.guild.owner.user.id === message.author.id ? true : false) : false
},
// Bot Support is a special "in-between" level that has the equivalent access level of the server
// owner on any server they join, in order to help troubleshoot the bot on behalf of owners.
{ level: 8,
name: "Bot Support",
// The check is carried out by reading if an ID is part of this array.
// This means that the bot must be rebooted once an ID has been added.
check: (message) => config.support.includes(message.author.id)
},
// Bot Admin has some access to functions like rebooting the bot or reloading commands.
{ level: 9,
name: "Bot Admin",
check: (message) => config.admins.includes(message.author.id)
},
// This is the bot owner. This should be the highest permission level available.
// The reason this should be the highest level is because of dangerous commands such as eval
// or exec (if the owner has that).
{ level: 10,
name: "Bot Owner",
check: (message) => message.client.appInfo.owner.id === message.author.id
}
]
};
module.exports = config;