fix it up!

This commit is contained in:
rhearmas 2019-12-23 20:43:35 -05:00
parent 1af82361a4
commit dac1eb5eae
2 changed files with 5 additions and 60 deletions

View file

@ -1,51 +1,31 @@
const config = { const config = {
// Bot Owner, level 10 by default. A User ID. Should never be anything else than the bot owner's ID.
"ownerID": "123456789123456", "ownerID": "123456789123456",
// Bot Admins, level 9 by default. Array of user ID strings.
"admins": [], "admins": [],
// Bot Support, level 8 by default. Array of user ID strings
"support": [], "support": [],
// Your Bot's Token. Available on https://discordapp.com/developers/applications/me
"token": "mfa.VkO_2G4Qv3T--NO--lWetW_tjND--TOKEN--QFTm6YGtzq9PH--4U--tG0", "token": "mfa.VkO_2G4Qv3T--NO--lWetW_tjND--TOKEN--QFTm6YGtzq9PH--4U--tG0",
// Default per-server settings. New guilds have these settings.
// DO NOT LEAVE ANY OF THESE BLANK, AS YOU WILL NOT BE ABLE TO UPDATE THEM
// VIA COMMANDS IN THE GUILD.
"defaultSettings" : { "defaultSettings" : {
"prefix": "-", "prefix": "/",
"modLogChannel": "mod-log", "modLogChannel": "mod-log",
"modRole": "Moderator", "modRole": "Moderator",
"adminRole": "Administrator", "adminRole": "Administrator",
"systemNotice": "true", // This gives a notice when a user tries to run a command that they do not have permission to use. "systemNotice": "true",
"welcomeChannel": "welcome", "welcomeChannel": "welcome",
"welcomeMessage": "Say hello to {{user}}, everyone! We all need a warm welcome sometimes :D", "welcomeMessage": "Say hello to {{user}}, everyone! We all need a warm welcome sometimes :D",
"welcomeEnabled": "false" "welcomeEnabled": "false"
}, },
// PERMISSION LEVEL DEFINITIONS.
permLevels: [ permLevels: [
// This is the lowest permisison level, this is for non-roled users.
{ level: 0, { level: 0,
name: "User", name: "User",
// Don't bother checking, just return true which allows them to execute any command their
// level allows them to.
check: () => true check: () => true
}, },
// This is your permission level, the staff levels should always be above the rest of the roles.
{ level: 2, { level: 2,
// This is the name of the role.
name: "Moderator", 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.
check: (message) => { check: (message) => {
try { try {
const modRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.modRole.toLowerCase()); const modRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.modRole.toLowerCase());
@ -67,35 +47,24 @@ const config = {
} }
} }
}, },
// This is the server owner.
{ level: 4, { level: 4,
name: "Server Owner", 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.
check: (message) => message.channel.type === "text" ? (message.guild.ownerID === message.author.id ? true : false) : false check: (message) => message.channel.type === "text" ? (message.guild.ownerID === message.author.id ? true : false) : false
}, },
// Bot Support is a special inbetween 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, { level: 8,
name: "Bot Support", name: "Bot Support",
// The check is by reading if an ID is part of this array. Yes, this means you need to
// change this and reboot the bot to add a support user. Make it better yourself!
check: (message) => config.support.includes(message.author.id) check: (message) => config.support.includes(message.author.id)
}, },
// Bot Admin has some limited access like rebooting the bot or reloading commands.
{ level: 9, { level: 9,
name: "Bot Admin", name: "Bot Admin",
check: (message) => config.admins.includes(message.author.id) 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, { level: 10,
name: "Bot Owner", name: "Bot Owner",
// Another simple check, compares the message author id to the one stored in the config file.
check: (message) => message.client.config.ownerID === message.author.id check: (message) => message.client.config.ownerID === message.author.id
} }
] ]

View file

@ -1,34 +1,21 @@
const config = { const config = {
// Bot Owner, level 10 by default. A User ID. Should never be anything else than the bot owner's ID.
"ownerID": "{{ownerID}}", "ownerID": "{{ownerID}}",
// Bot Admins, level 9 by default. Array of user ID strings.
"admins": [], "admins": [],
// Bot Support, level 8 by default. Array of user ID strings
"support": [], "support": [],
// Your Bot's Token. Available on https://discordapp.com/developers/applications/me
"token": {{token}}, "token": {{token}},
// PERMISSION LEVEL DEFINITIONS.
permLevels: [ permLevels: [
// This is the lowest permisison level, this is for non-roled users. // This is the lowest permisison level, this is for non-roled users.
{ level: 0, { level: 0,
name: "User", name: "User",
// Don't bother checking, just return true which allows them to execute any command their
// level allows them to.
check: () => true check: () => true
}, },
// This is your permission level, the staff levels should always be above the rest of the roles.
{ level: 2, { level: 2,
// This is the name of the role.
name: "Moderator", 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.
check: (message) => { check: (message) => {
try { try {
const modRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.modRole.toLowerCase()); const modRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.modRole.toLowerCase());
@ -50,35 +37,24 @@ const config = {
} }
} }
}, },
// This is the server owner.
{ level: 4, { level: 4,
name: "Server Owner", 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.
check: (message) => message.channel.type === "text" ? (message.guild.ownerID === message.author.id ? true : false) : false check: (message) => message.channel.type === "text" ? (message.guild.ownerID === message.author.id ? true : false) : false
}, },
// Bot Support is a special inbetween 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, { level: 8,
name: "Bot Support", name: "Bot Support",
// The check is by reading if an ID is part of this array. Yes, this means you need to
// change this and reboot the bot to add a support user. Make it better yourself!
check: (message) => config.support.includes(message.author.id) check: (message) => config.support.includes(message.author.id)
}, },
// Bot Admin has some limited access like rebooting the bot or reloading commands.
{ level: 9, { level: 9,
name: "Bot Admin", name: "Bot Admin",
check: (message) => config.admins.includes(message.author.id) 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, { level: 10,
name: "Bot Owner", name: "Bot Owner",
// Another simple check, compares the message author id to the one stored in the config file.
check: (message) => message.client.config.ownerID === message.author.id check: (message) => message.client.config.ownerID === message.author.id
} }
] ]