コード例 #1
0
 /**
  * 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 -');
 }
コード例 #2
0
ファイル: helpers.php プロジェクト: runningjack/busticketAPI1
 /**
  * Remove one or many array items from a given array using "dot" notation.
  *
  * @param  array  $array
  * @param  array|string  $keys
  * @return void
  */
 function array_forget(&$array, $keys)
 {
     return Arr::forget($array, $keys);
 }
コード例 #3
0
ファイル: Collection.php プロジェクト: chchmlml/ceshi
 /**
  * Remove item form Collection.
  *
  * @param string $key
  */
 public function forget($key)
 {
     Arr::forget($this->items, $key);
 }
コード例 #4
0
ファイル: Session.php プロジェクト: ncaneldiee/sampadeh
 public static function forget($key)
 {
     return Arr::forget($_SESSION, $key);
 }
コード例 #5
0
 /**
  * Remove item form Bag
  *
  * @param string $key
  */
 public function forget($key)
 {
     Arr::forget($this->data, $key);
 }