-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.js.example
159 lines (137 loc) · 4.92 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
const config = {
// Bot Owner(s), level 10 by default. Array of user ID strings.
owners: ['ownerId'],
// Bot Admins, level 9 by default. Array of user ID strings.
admins: ['adminId'],
// Bot Support, level 8 by default. Array of user ID strings
support: ['supportId'],
// Your Bots Token. Available on https://discordapp.com/developers/applications/me
token: '',
// Auth token for BotList.me
BotListToken: '',
// OxFord Dictionary
OxfordID: '',
OxfordKey: '',
// Github API Token
github: '',
// TMDb API Token
TMDb: '',
// OpenWeather API Token
OpenWeather: '',
// Discord webhook to send bot logs to
botLogsWebhookURL: '',
// YouTube cookie for discord-player
youtubeCookie: '',
// Bot panel ID
BotPanelID: '',
// Bot panel secret
BotPanelSecret: '',
// Default per-server settings. These settings are entered in a database on first load,
// And are then completely ignored from this file. To modify default settings, use the `conf` command.
// DO NOT REMOVE THIS BEFORE YOUR BOT IS LOADED AND FUNCTIONAL.
defaultSettings: {
prefix: '*',
modRole: 'Moderator',
adminRole: 'Administrator',
systemNotice: 'true',
welcomeEnabled: 'false',
welcomeChannel: 'welcome-leave',
welcomeMessage: 'Hello {{user}} ({{globalName}}), welcome to {{guild}}. We hope you have a great time here!',
leaveChannel: 'welcome-leave',
leaveMessage: 'Goodbye {{user}} ({{globalName}}) :( Sorry to see you go.',
leaveEnabled: 'false',
embedColor: '#0099CC',
embedErrorColor: '#FF0000',
embedSuccessColor: '#00FF00'
},
// PERMISSION LEVEL DEFINITIONS.
permLevels: [
{
level: 0,
name: 'User',
// Don't bother checking, just return true which allows them to execute any command their
// level allows them to.
checkPermissions: () => true,
},
{
level: 2,
// This is the name of the role.
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 return true, which will allow them to execute the command in question.
// If they don't then return false, which will prevent them from executing the command.
checkPermissions: (context) => {
try {
const modRole = context.guild.roles.cache.find(
(r) => r.name.toLowerCase() === context.settings.modRole.toLowerCase(),
);
if (!modRole) return false;
if (context.member.roles.cache.has(modRole.id)) return true;
if (context.member.roles.highest.position > modRole.position) return true;
} catch (e) {
return false;
}
},
},
{
level: 3,
name: 'Administrator',
checkPermissions: (context) => {
try {
const adminRole = context.guild.roles.cache.find(
(r) => r.name.toLowerCase() === context.settings.adminRole.toLowerCase(),
);
if (context.member.permissions.has('Administrator')) return true;
if (!adminRole) return false;
if (context.member.roles.cache.has(adminRole.id)) return true;
if (context.member.roles.highest.position > adminRole.position) return true;
} catch (e) {
return false;
}
},
},
{
level: 4,
name: 'Server Owner',
// Simple check, if the guild owner id matches the message author's ID, then it will return true.
// Otherwise it will return false.
checkPermissions: (context) => {
try {
return context.guild.ownerId === (context.user ? context.user.id : context.author.id);
} catch (e) {
return false;
}
},
},
// Bot Support is a special in between level that has the equivalent of server owner access
// to any server they joins, in order to help troubleshoot the bot on behalf of owners.
{
level: 8,
name: 'Bot Support',
checkPermissions: (context) => {
return config.support.includes(context.user ? context.user.id : context.author.id);
},
},
// Bot Admin has some limited access like rebooting the bot or reloading commands.
{
level: 9,
name: 'Bot Admin',
checkPermissions: (context) => {
return config.admins.includes(context.user ? context.user.id : context.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',
// Another simple check, compares the message author id to the one stored in the config file.
checkPermissions: (context) => {
return config.owners.includes(context.user ? context.user.id : context.author.id);
},
},
],
};
module.exports = config;