Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

Custom Permission Roles Support #57

Merged
merged 1 commit into from
Oct 30, 2016
Merged

Custom Permission Roles Support #57

merged 1 commit into from
Oct 30, 2016

Conversation

UnseenFaith
Copy link
Owner

Adds support for custom roles per server. Also fixes the disabledCommands to be an actual array as opposed to the string "[]". Made the custom roles two different strings so they could easily be edited with the conf core command, instead of dumping them into an object.

Copy link
Collaborator

@CyberiumShadow CyberiumShadow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various changes just to stay with optimisation as well as coding conventions

@@ -11,7 +11,9 @@ exports.init = (client) => {
// Load default configuration, create if not exist.
defaultConf = {
prefix: {type: "String", data: client.config.prefix},
disabledCommands: {type: "Array", data: "[]"}
disabledCommands: {type: "Array", data: []},
mod_role: {type: "String", data: "Mods"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hard coding Mods and Devs to be default

Why not default them as blank values?

disabledCommands: {type: "Array", data: "[]"}
disabledCommands: {type: "Array", data: []},
mod_role: {type: "String", data: "Mods"},
admin_role: {type: "String", data: "Devs"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing with Line 16

let member = guild.member(user);
let mod_role = guild.roles.find("name", "Mods");
let mod_role = guild.roles.find("name", guildConf.mod_role);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also like please use camelCase for modRole

if (mod_role && member.roles.has(mod_role.id))
permlvl = 2;
let admin_role = guild.roles.find("name", "Devs");
let admin_role = guild.roles.find("name", guildConf.admin_role);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here

@UnseenFaith
Copy link
Owner Author

@CyberiumShadow For the last 2 comments, followed snake case in the original Komada permissionLevel.js, and for why not defaulting them to undefined you could do that. but then whats the point of having a default configuration? It'd be like defaulting the prefix to "". Just my person opinion though.

@CyberiumShadow
Copy link
Collaborator

Fair enough

Copy link
Collaborator

@CyberiumShadow CyberiumShadow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, everything seems good @eslachance

@eslachance eslachance merged commit fb9ca6c into UnseenFaith:indev Oct 30, 2016
@UnseenFaith UnseenFaith deleted the faith-patch-1 branch October 30, 2016 03:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants