@@ -31,7 +31,7 @@ |
||
| 31 | 31 | "trigger" => "!", // what trigger is used for commands |
| 32 | 32 | "guild" => 152677265635803136, // guildID |
| 33 | 33 | "token" => "", //enter the token for your app (https://discordapp.com/developers/applications/me) |
| 34 | - "adminRoles" => array("Admin","")//enter the roles that you'd like to have access to admin commands |
|
| 34 | + "adminRoles" => array("Admin","")//enter the roles that you'd like to have access to admin commands |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | $config["database"] = array( |
@@ -102,8 +102,8 @@ |
||
| 102 | 102 | $plugins = array(); |
| 103 | 103 | foreach ($pluginDirs as $dir) { |
| 104 | 104 | foreach (glob($dir) as $plugin) { |
| 105 | - var_dump($plugin); |
|
| 106 | - var_dump($adminPlugins); |
|
| 105 | + var_dump($plugin); |
|
| 106 | + var_dump($adminPlugins); |
|
| 107 | 107 | // Only load the plugins we want to load, according to the config |
| 108 | 108 | if (!in_array(str_replace(".php", "", basename($plugin)), $config["enabledPlugins"]) && in_array(str_replace(".php", "", basename($plugin), $adminPlugins))) { |
| 109 | 109 | continue; |
@@ -74,32 +74,32 @@ |
||
| 74 | 74 | $data = command($message, $this->information()["trigger"], $this->config["bot"]["trigger"]); |
| 75 | 75 | if (isset($data["trigger"])) {
|
| 76 | 76 | |
| 77 | - //Admin Check |
|
| 78 | - $botID = $this->discord->id; |
|
| 79 | - $userID = $msgData["message"]["fromID"]; |
|
| 77 | + //Admin Check |
|
| 78 | + $botID = $this->discord->id; |
|
| 79 | + $userID = $msgData["message"]["fromID"]; |
|
| 80 | 80 | $adminRoles = $this->config["bot"]["adminRoles"]; |
| 81 | 81 | $id = $this->config["bot"]["guild"]; |
| 82 | 82 | $guild = $this->discord->guilds->get('id', $id);
|
| 83 | - $member = $guild->members->get("id", $userID);
|
|
| 84 | - $roles = $member->roles; |
|
| 85 | - foreach ($roles as $role) {
|
|
| 83 | + $member = $guild->members->get("id", $userID);
|
|
| 84 | + $roles = $member->roles; |
|
| 85 | + foreach ($roles as $role) {
|
|
| 86 | 86 | if(!isset($role->name)){
|
| 87 | 87 | if(!in_array($role->name, $adminRoles, true)){
|
| 88 | 88 | $msg = ":bangbang: You do not have the necessary roles to issue this command :bangbang:"; |
| 89 | - $this->message->reply($msg); |
|
| 90 | - return null; |
|
| 89 | + $this->message->reply($msg); |
|
| 90 | + return null; |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $update = updateBot($this->logger); |
| 96 | - if ($update = "1"){
|
|
| 97 | - $msg = "Bot succesfully updated, restarting."; |
|
| 98 | - $this->logger->addInfo("Bot succesfully updated, restarting.");
|
|
| 99 | - $this->message->reply($msg); |
|
| 100 | - sleep(5); |
|
| 101 | - die(); |
|
| 102 | - } |
|
| 96 | + if ($update = "1"){
|
|
| 97 | + $msg = "Bot succesfully updated, restarting."; |
|
| 98 | + $this->logger->addInfo("Bot succesfully updated, restarting.");
|
|
| 99 | + $this->message->reply($msg); |
|
| 100 | + sleep(5); |
|
| 101 | + die(); |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -74,20 +74,20 @@ |
||
| 74 | 74 | $data = command($message, $this->information()["trigger"], $this->config["bot"]["trigger"]); |
| 75 | 75 | if (isset($data["trigger"])) {
|
| 76 | 76 | |
| 77 | - //Admin Check |
|
| 78 | - $botID = $this->discord->id; |
|
| 79 | - $userID = $msgData["message"]["fromID"]; |
|
| 77 | + //Admin Check |
|
| 78 | + $botID = $this->discord->id; |
|
| 79 | + $userID = $msgData["message"]["fromID"]; |
|
| 80 | 80 | $adminRoles = $this->config["bot"]["adminRoles"]; |
| 81 | 81 | $id = $this->config["bot"]["guild"]; |
| 82 | 82 | $guild = $this->discord->guilds->get('id', $id);
|
| 83 | - $member = $guild->members->get("id", $userID);
|
|
| 84 | - $roles = $member->roles; |
|
| 85 | - foreach ($roles as $role) {
|
|
| 83 | + $member = $guild->members->get("id", $userID);
|
|
| 84 | + $roles = $member->roles; |
|
| 85 | + foreach ($roles as $role) {
|
|
| 86 | 86 | if(!isset($role->name)){
|
| 87 | 87 | if(!in_array($role->name, $adminRoles, true)){
|
| 88 | 88 | $msg = ":bangbang: You do not have the necessary roles to issue this command :bangbang:"; |
| 89 | - $this->message->reply($msg); |
|
| 90 | - return null; |
|
| 89 | + $this->message->reply($msg); |
|
| 90 | + return null; |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -29,12 +29,12 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | function updateBot($logger) |
| 31 | 31 | {
|
| 32 | - $logger->addInfo("Updating Bot");
|
|
| 33 | - putenv("COMPOSER_HOME=/usr/local/bin/composer");
|
|
| 32 | + $logger->addInfo("Updating Bot");
|
|
| 33 | + putenv("COMPOSER_HOME=/usr/local/bin/composer");
|
|
| 34 | 34 | $output = shell_exec('sh ' . dirname(__FILE__) . '/update.sh');
|
| 35 | - if ($output = "1"){
|
|
| 36 | - $logger->addInfo("Update Complete");
|
|
| 37 | - return "1"; |
|
| 38 | - } |
|
| 35 | + if ($output = "1"){
|
|
| 36 | + $logger->addInfo("Update Complete");
|
|
| 37 | + return "1"; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |