@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $this->message = $message; |
| 90 | 90 | $user = $msgData["message"]["from"]; |
| 91 | - $channelID = (int)$msgData["message"]["channelID"]; |
|
| 91 | + $channelID = (int) $msgData["message"]["channelID"]; |
|
| 92 | 92 | |
| 93 | 93 | if (in_array($channelID, $this->excludeChannel, true)) |
| 94 | 94 | { |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | $data = new SimpleXMLElement(downloadData("https://api.eve-central.com/api/marketstat?usesystem={$solarSystemID}&typeid={$typeID}")); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $lowBuy = number_format((float)$data->marketstat->type->buy->min, 2); |
|
| 154 | - $avgBuy = number_format((float)$data->marketstat->type->buy->avg, 2); |
|
| 155 | - $highBuy = number_format((float)$data->marketstat->type->buy->max, 2); |
|
| 156 | - $lowSell = number_format((float)$data->marketstat->type->sell->min, 2); |
|
| 157 | - $avgSell = number_format((float)$data->marketstat->type->sell->avg, 2); |
|
| 158 | - $highSell = number_format((float)$data->marketstat->type->sell->max, 2); |
|
| 153 | + $lowBuy = number_format((float) $data->marketstat->type->buy->min, 2); |
|
| 154 | + $avgBuy = number_format((float) $data->marketstat->type->buy->avg, 2); |
|
| 155 | + $highBuy = number_format((float) $data->marketstat->type->buy->max, 2); |
|
| 156 | + $lowSell = number_format((float) $data->marketstat->type->sell->min, 2); |
|
| 157 | + $avgSell = number_format((float) $data->marketstat->type->sell->avg, 2); |
|
| 158 | + $highSell = number_format((float) $data->marketstat->type->sell->max, 2); |
|
| 159 | 159 | |
| 160 | 160 | $this->logger->addInfo("Price: Sending pricing info to {$user}"); |
| 161 | 161 | $solarSystemName = $systemName == "pc" ? "Global" : ucfirst($systemName); |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | $this->dbUser = $config["database"]["user"]; |
| 72 | 72 | $this->dbPass = $config["database"]["pass"]; |
| 73 | 73 | $this->dbName = $config["database"]["database"]; |
| 74 | - $this->corpID = (int)$config["plugins"]["auth"]["corpID"]; |
|
| 75 | - $this->allianceID = (int)$config["plugins"]["auth"]["allianceID"]; |
|
| 74 | + $this->corpID = (int) $config["plugins"]["auth"]["corpID"]; |
|
| 75 | + $this->allianceID = (int) $config["plugins"]["auth"]["allianceID"]; |
|
| 76 | 76 | $this->roleName = $config["plugins"]["auth"]["corpMemberRole"]; |
| 77 | 77 | $this->allyroleName = $config["plugins"]["auth"]["allyMemberRole"]; |
| 78 | 78 | $this->nameEnforce = $config["plugins"]["auth"]["nameEnforce"]; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | function onMessage($msgData, $message) |
| 96 | 96 | { |
| 97 | - $channelID = (int)$msgData["message"]["channelID"]; |
|
| 97 | + $channelID = (int) $msgData["message"]["channelID"]; |
|
| 98 | 98 | |
| 99 | 99 | if (in_array($channelID, $this->excludeChannel, true)) |
| 100 | 100 | { |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | while ($rows = $result->fetch_assoc()) { |
| 130 | - $charid = (int)$rows['characterID']; |
|
| 131 | - $corpid = (int)$rows['corporationID']; |
|
| 132 | - $allianceid = (int)$rows['allianceID']; |
|
| 130 | + $charid = (int) $rows['characterID']; |
|
| 131 | + $corpid = (int) $rows['corporationID']; |
|
| 132 | + $allianceid = (int) $rows['allianceID']; |
|
| 133 | 133 | $url = "https://api.eveonline.com/eve/CharacterName.xml.aspx?ids=$charid"; |
| 134 | 134 | $xml = makeApiRequest($url); |
| 135 | 135 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | foreach ($xml->result->rowset->row as $character) { |
| 148 | 148 | $member = $guild->members->get("id", $userID); |
| 149 | 149 | $inGameName = $character->attributes()->name; |
| 150 | - $nick = (string)$inGameName; |
|
| 150 | + $nick = (string) $inGameName; |
|
| 151 | 151 | $member->setNickname($nick); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | function onMessage($msgData, $message) |
| 72 | 72 | { |
| 73 | - $channelID = (int)$msgData["message"]["channelID"]; |
|
| 73 | + $channelID = (int) $msgData["message"]["channelID"]; |
|
| 74 | 74 | |
| 75 | 75 | if (in_array($channelID, $this->excludeChannel, true)) |
| 76 | 76 | { |
@@ -97,11 +97,11 @@ |
||
| 97 | 97 | try { |
| 98 | 98 | $data = $this->twitter->load(Twitter::ME_AND_FRIENDS, 5); |
| 99 | 99 | foreach ($data as $message) { |
| 100 | - $text = (array)$message->text; |
|
| 101 | - $createdAt = (array)$message->created_at; |
|
| 102 | - $postedBy = (array)$message->user->name; |
|
| 103 | - $screenName = (array)$message->user->screen_name; |
|
| 104 | - $id = (int)$message->id; |
|
| 100 | + $text = (array) $message->text; |
|
| 101 | + $createdAt = (array) $message->created_at; |
|
| 102 | + $postedBy = (array) $message->user->name; |
|
| 103 | + $screenName = (array) $message->user->screen_name; |
|
| 104 | + $id = (int) $message->id; |
|
| 105 | 105 | $this->lastID = getPermCache("twitterLatestID"); // get the last posted ID |
| 106 | 106 | |
| 107 | 107 | if ($id <= $this->lastID) { |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | //Find item to check if feed is formatted |
| 117 | - $itemTitle = (string)$rss->channel->item->title; |
|
| 118 | - $itemUrl = (string)$rss->channel->item->link; |
|
| 117 | + $itemTitle = (string) $rss->channel->item->title; |
|
| 118 | + $itemUrl = (string) $rss->channel->item->link; |
|
| 119 | 119 | $itemDate = strtotime($rss->channel->item->pubDate); |
| 120 | 120 | |
| 121 | 121 | //Check to see if feed is formatted correctly |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | //Find item to post |
| 128 | 128 | foreach ($rss->channel->item as $item) { |
| 129 | 129 | //Get item details |
| 130 | - $itemTitle = (string)$item->title; |
|
| 131 | - $itemUrl = (string)$item->link; |
|
| 130 | + $itemTitle = (string) $item->title; |
|
| 131 | + $itemUrl = (string) $item->link; |
|
| 132 | 132 | $itemPubbed = $item->pubDate; |
| 133 | 133 | $itemDate = strtotime($item->pubDate); |
| 134 | 134 | |
@@ -28,7 +28,6 @@ |
||
| 28 | 28 | |
| 29 | 29 | // Setup logger |
| 30 | 30 | use Discord\Discord; |
| 31 | -use Discord\Parts\User\Game; |
|
| 32 | 31 | use Discord\WebSockets\Event; |
| 33 | 32 | use Discord\WebSockets\WebSocket; |
| 34 | 33 | use Monolog\Handler\StreamHandler; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $discord->on( |
| 123 | 123 | 'ready', |
| 124 | - function ($discord) use ($logger, $config, $plugins, $pluginsT, $discord) { |
|
| 124 | + function($discord) use ($logger, $config, $plugins, $pluginsT, $discord) { |
|
| 125 | 125 | // In here we can access any of the WebSocket events. |
| 126 | 126 | // |
| 127 | 127 | // There is a list of event constants that you can |
@@ -131,25 +131,25 @@ discard block |
||
| 131 | 131 | $logger->addInfo('Discord WebSocket is ready!' . PHP_EOL); |
| 132 | 132 | |
| 133 | 133 | // Database check |
| 134 | - $discord->loop->addPeriodicTimer(86400, function () use ($logger) { |
|
| 134 | + $discord->loop->addPeriodicTimer(86400, function() use ($logger) { |
|
| 135 | 135 | updateDramielDB($logger); |
| 136 | 136 | }); |
| 137 | 137 | |
| 138 | 138 | // Run the Tick plugins |
| 139 | - $discord->loop->addPeriodicTimer(3, function () use ($pluginsT) { |
|
| 139 | + $discord->loop->addPeriodicTimer(3, function() use ($pluginsT) { |
|
| 140 | 140 | foreach ($pluginsT as $plugin) { |
| 141 | 141 | $plugin->tick(); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | 144 | |
| 145 | 145 | // Message queue |
| 146 | - $discord->loop->addPeriodicTimer(15, function () use ($discord,$logger) { |
|
| 146 | + $discord->loop->addPeriodicTimer(15, function() use ($discord, $logger) { |
|
| 147 | 147 | $id = getPermCache("messageQueueID"); |
| 148 | - if(is_null($id)){ |
|
| 148 | + if (is_null($id)) { |
|
| 149 | 149 | $id = 1; |
| 150 | 150 | } |
| 151 | 151 | $queuedMessage = getQueuedMessage($id); |
| 152 | - if(!is_null($queuedMessage)){ |
|
| 152 | + if (!is_null($queuedMessage)) { |
|
| 153 | 153 | $guild = $discord->guilds->get('id', $queuedMessage['guild']); |
| 154 | 154 | $channel = $guild->channels->get('id', $queuedMessage['channel']); |
| 155 | 155 | $logger->addInfo("QueueProcessing - Completing queued item #{$id} : {$queuedMessage['message']}"); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | //clearQueuedMessages($id); bugtest me |
| 160 | 160 | } |
| 161 | 161 | $queuedMessage = getQueuedMessage($id); |
| 162 | - if(!is_null($queuedMessage)){ |
|
| 162 | + if (!is_null($queuedMessage)) { |
|
| 163 | 163 | $guild = $discord->guilds->get('id', $queuedMessage['guild']); |
| 164 | 164 | $channel = $guild->channels->get('id', $queuedMessage['channel']); |
| 165 | 165 | $logger->addInfo("QueueProcessing - Completing queued item #{$id} : {$queuedMessage['message']}"); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | }); |
| 172 | 172 | |
| 173 | 173 | // Mem cleanup every 30 minutes |
| 174 | - $discord->loop->addPeriodicTimer(1800, function () use ($logger) { |
|
| 174 | + $discord->loop->addPeriodicTimer(1800, function() use ($logger) { |
|
| 175 | 175 | $logger->addInfo("Memory in use: " . memory_get_usage() / 1024 / 1024 . "MB"); |
| 176 | 176 | gc_collect_cycles(); // Collect garbage |
| 177 | 177 | $logger->addInfo("Memory in use after garbage collection: " . memory_get_usage() / 1024 / 1024 . "MB"); |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $discord->on( |
| 181 | 181 | Event::MESSAGE_CREATE, |
| 182 | - function ($message) use ($logger, $config, $plugins) { |
|
| 182 | + function($message) use ($logger, $config, $plugins) { |
|
| 183 | 183 | |
| 184 | 184 | $msgData = array( |
| 185 | 185 | "message" => array( |
@@ -220,19 +220,19 @@ discard block |
||
| 220 | 220 | ); |
| 221 | 221 | $discord->on( |
| 222 | 222 | 'error', |
| 223 | - function ($error) use ($logger) { |
|
| 223 | + function($error) use ($logger) { |
|
| 224 | 224 | $logger->addError($error); |
| 225 | 225 | exit(1); |
| 226 | 226 | } |
| 227 | 227 | ); |
| 228 | 228 | $discord->on( |
| 229 | 229 | 'reconnecting', |
| 230 | - function () use ($logger) { |
|
| 230 | + function() use ($logger) { |
|
| 231 | 231 | $logger->addInfo('Websocket is reconnecting..'); |
| 232 | 232 | }); |
| 233 | 233 | $discord->on( |
| 234 | 234 | 'reconnected', |
| 235 | - function () use ($logger) { |
|
| 235 | + function() use ($logger) { |
|
| 236 | 236 | $logger->addInfo('Websocket was reconnected..'); |
| 237 | 237 | }); |
| 238 | 238 | // Now we will run the ReactPHP Event Loop! |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | function onMessage($msgData, $message) |
| 72 | 72 | { |
| 73 | - $channelID = (int)$msgData["message"]["channelID"]; |
|
| 73 | + $channelID = (int) $msgData["message"]["channelID"]; |
|
| 74 | 74 | |
| 75 | 75 | if (in_array($channelID, $this->excludeChannel, true)) |
| 76 | 76 | { |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | function onMessage($msgData, $message) |
| 72 | 72 | { |
| 73 | - $channelID = (int)$msgData["message"]["channelID"]; |
|
| 73 | + $channelID = (int) $msgData["message"]["channelID"]; |
|
| 74 | 74 | |
| 75 | 75 | if (in_array($channelID, $this->excludeChannel, true)) |
| 76 | 76 | { |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | function onMessage($msgData, $message) |
| 72 | 72 | { |
| 73 | - $channelID = (int)$msgData["message"]["channelID"]; |
|
| 73 | + $channelID = (int) $msgData["message"]["channelID"]; |
|
| 74 | 74 | |
| 75 | 75 | if (in_array($channelID, $this->excludeChannel, true)) |
| 76 | 76 | { |