@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | $client = new Slack\RealTimeClient($loop); |
17 | 17 | $client->setToken($GLOBALS['config']['slack']['botAuthToken']); |
18 | 18 | |
19 | -$client->on('message', function (Slack\Payload $payload) use ($client) { |
|
19 | +$client->on('message', function(Slack\Payload $payload) use ($client) { |
|
20 | 20 | $user = $payload->getData()['user']; |
21 | 21 | $blackList = array_map('trim', explode(',', $GLOBALS['config']['slack']['userBlacklist'])); |
22 | 22 | if (in_array($user, $blackList, true)) { |
23 | 23 | $client->apiCall('im.open', ['user' => $user]) |
24 | - ->then(function (Slack\Payload $response) use ($client) { |
|
24 | + ->then(function(Slack\Payload $response) use ($client) { |
|
25 | 25 | $channel = $response->getData()['channel']['id']; |
26 | 26 | $data = []; |
27 | 27 | $data['unfurl_links'] = false; |
@@ -48,28 +48,28 @@ discard block |
||
48 | 48 | } |
49 | 49 | }); |
50 | 50 | |
51 | -$client->on('channel_created', function (Slack\Payload $payload) use ($client) { |
|
51 | +$client->on('channel_created', function(Slack\Payload $payload) use ($client) { |
|
52 | 52 | if ($payload->getData()['user'] !== $GLOBALS['config']['slack']['botId']) { |
53 | 53 | $command = new \T3Bot\Commands\ChannelCommand($payload, $client); |
54 | 54 | $command->processChannelCreated($payload->getData()); |
55 | 55 | } |
56 | 56 | }); |
57 | 57 | |
58 | -$client->on('presence_change', function (Slack\Payload $payload) use ($client) { |
|
58 | +$client->on('presence_change', function(Slack\Payload $payload) use ($client) { |
|
59 | 59 | if ($payload->getData()['user'] !== $GLOBALS['config']['slack']['botId']) { |
60 | 60 | $command = new \T3Bot\Commands\TellCommand($payload, $client); |
61 | 61 | $command->processPresenceChange($payload->getData()['user'], $payload->getData()['presence']); |
62 | 62 | } |
63 | 63 | }); |
64 | 64 | |
65 | -$client->connect()->then(function () use ($client) { |
|
65 | +$client->connect()->then(function() use ($client) { |
|
66 | 66 | echo "Connected!\n"; |
67 | 67 | }); |
68 | 68 | |
69 | 69 | /* @noinspection PhpInternalEntityUsedInspection */ |
70 | 70 | $db = \Doctrine\DBAL\DriverManager::getConnection($GLOBALS['config']['db'], new \Doctrine\DBAL\Configuration()); |
71 | 71 | |
72 | -$loop->addPeriodicTimer(5, function () use ($client, $db) { |
|
72 | +$loop->addPeriodicTimer(5, function() use ($client, $db) { |
|
73 | 73 | $messages = $db->fetchAll('SELECT * FROM messages ORDER BY id ASC'); |
74 | 74 | foreach ($messages as $message) { |
75 | 75 | $data = json_decode($message['message'], true); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -(new Dotenv\Dotenv(__DIR__ . '/../'))->load(); |
|
3 | +(new Dotenv\Dotenv(__DIR__.'/../'))->load(); |
|
4 | 4 | |
5 | 5 | $GLOBALS['config'] = [ |
6 | 6 | // project phase |