/**
  * Handles the message.
  *
  * @param Message $message 
  * @param array $params
  * @param Discord $discord 
  * @param Config $config 
  * @return void 
  */
 public static function handleMessage($message, $params, $discord, $config)
 {
     $loadedComms = count($discord->websocket->listeners(Event::MESSAGE_CREATE));
     $message->channel->sendMessage('-' . count($loadedComms) . ' COMMANDS BEFORE RELOAD -');
     $message->channel->sendMessage('Reloading all commands from disk...');
     $discord->websocket->removeAllListeners(Event::MESSAGE_CREATE);
     $commandResearch = glob('./src/Commands/*.php');
     $commandLoad = true;
     foreach ($commandResearch as $file) {
         include $file;
     }
     $currCommands = getCommands();
     foreach ($currCommands as $command => $data) {
         $discord->websocket->on(Event::MESSAGE_CREATE, function ($message, $discord, $new) use($command, $data) {
             $content = explode(' ', $message->content);
             $config = Config::getConfig($discord->configfile);
             if ($content[0] == $config['prefix'] . $command) {
                 Arr::forget($content, 0);
                 $user_perms = @$config['perms']['perms'][$message->author->id];
                 if (empty($user_perms)) {
                     $user_perms = $config['perms']['default'];
                 }
                 if ($user_perms >= $data['perms']) {
                     try {
                         $data['class']::handleMessage($message, $content, $discord, $config, $this);
                     } catch (\Exception $e) {
                         $message->reply("There was an error running the command. `{$e->getMessage()}`");
                     }
                 } else {
                     $message->reply('You do not have permission to do this!');
                     echo "[Auth] User {$message->author->username} blocked from running {$config['prefix']}{$command}, <@{$message->author->id}>\r\n";
                 }
             }
         });
     }
     $loadedComms = count($discord->websocket->listeners(Event::MESSAGE_CREATE));
     $message->channel->sendMessage('-' . count($loadedComms) . ' COMMANDS AFTER RELOAD -');
 }
Beispiel #2
0
<?php

include 'includes/master.php';
getHead();
getNav();
?>
<div class="container">
	<div class="row">
		<table class="table table-striped">
			<tr>
				<th>Time</th>
				<th>Action</th>
				<th>Result</th>
				<th>Source</th>
			</tr>
			<?php 
getCommands();
?>
		</table>
	</div>
</div>

<?php 
getFooter();
Beispiel #3
0
if (isset($_POST["data"])) {
    $input = $_POST["data"];
}
//Hand off based on the paragmeters.
switch ($parameters[1]) {
    case "setupEnvironment":
        echo setupEnvironment($input);
        break;
    case "newCommands":
        echo newCommands($input);
        break;
    case "clearCommands":
        echo clearCommands();
        break;
    case "getCommands":
        echo getCommands();
        break;
    case "getLastModifiedTime":
        echo getLastModifiedTime();
        break;
    case "getPhysicalGridSize":
        echo getPhysicalGridSize();
        break;
    case "getLogicalGridSize":
        echo getLogicalGridSize();
        break;
    case "getOrigin":
        echo getOrigin();
        break;
    case "setOrigin":
        echo setOrigin($input);