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

Commit

Permalink
Merge pull request #68 from UnseenFaith/faith-patch
Browse files Browse the repository at this point in the history
Conf.js Fix && Eslint
  • Loading branch information
CyberiumShadow authored Nov 19, 2016
2 parents a496543 + 3aeb37e commit a7407d9
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions commands/System/conf.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
exports.run = (client, msg, [action, key, ... value]) => {
exports.run = (client, msg, [action, key, ...value]) => {

if (msg.guildConf[key].constructor.name === "String") {
value = value.join(' ');
} else
if (msg.guildConf[key].constructor.name === "Boolean") {
value = value[0];
} else {
value = value;
}

if(action === "list") {
if (action === "list") {
msg.channel.sendCode("json", require("util").inspect(msg.guildConf));
return;
} else

if(action === "get") {
if(!key) return msg.reply("Please provide a key you wish to view");
if (action === "get") {
if (!key) return msg.reply("Please provide a key you wish to view");
msg.reply(`The value for ${key} is currently: ${msg.guildConf[key]}`);
return;
} else

if(action === "set") {
if(!key || value === undefined) return msg.reply("Please provide both a key and value!");
if (action === "set") {
if (!key || value === undefined) return msg.reply("Please provide both a key and value!");
if (msg.guildConf[key].constructor.name === "String") {
value = value.join(" ");
} else
if (msg.guildConf[key].constructor.name === "Boolean") {
value = value[0];
}
client.funcs.confs.set(msg.guild, key, value);
return msg.reply(`The value for ${key} has been set to: ${value}`);
} else

if(action === "reset") {
if(!key) return msg.reply("Please provide a key you wish to reset");
if (action === "reset") {
if (!key) return msg.reply("Please provide a key you wish to reset");
client.funcs.confs.resetKey(msg.guild, key);
return msg.reply("The key has been reset.");
}
Expand All @@ -39,12 +34,12 @@ exports.conf = {
aliases: [],
permLevel: 3,
botPerms: [],
requiredFuncs: []
requiredFuncs: [],
};

exports.help = {
name: "conf",
description: "Define per-server configuration.",
usage: "<set|get|reset|list> [key:str] [boolean:boolean|channel:channel|user:user|role:role|int:int|str:str]",
usageDelim: " "
usageDelim: " ",
};

0 comments on commit a7407d9

Please sign in to comment.