@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | * @param \GuzzleHttp\Client $http |
| 36 | 36 | * @param string $token |
| 37 | 37 | */ |
| 38 | - public function __construct(HttpClient $http, $token) |
|
| 39 | - { |
|
| 38 | + public function __construct(HttpClient $http, $token) { |
|
| 40 | 39 | $this->httpClient = $http; |
| 41 | 40 | $this->token = $token; |
| 42 | 41 | } |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | * |
| 50 | 49 | * @return array |
| 51 | 50 | */ |
| 52 | - public function send($channel, array $data) |
|
| 53 | - { |
|
| 51 | + public function send($channel, array $data) { |
|
| 54 | 52 | return $this->request('POST', 'channels/'.$channel.'/messages', $data); |
| 55 | 53 | } |
| 56 | 54 | |
@@ -61,8 +59,7 @@ discard block |
||
| 61 | 59 | * |
| 62 | 60 | * @return string |
| 63 | 61 | */ |
| 64 | - public function getPrivateChannel($user) |
|
| 65 | - { |
|
| 62 | + public function getPrivateChannel($user) { |
|
| 66 | 63 | return $this->request('POST', 'users/@me/channels', ['recipient_id' => $user])['id']; |
| 67 | 64 | } |
| 68 | 65 | |
@@ -77,8 +74,7 @@ discard block |
||
| 77 | 74 | * |
| 78 | 75 | * @throws \NotificationChannels\Discord\Exceptions\CouldNotSendNotification |
| 79 | 76 | */ |
| 80 | - protected function request($verb, $endpoint, array $data) |
|
| 81 | - { |
|
| 77 | + protected function request($verb, $endpoint, array $data) { |
|
| 82 | 78 | $url = rtrim($this->baseUrl, '/').'/'.ltrim($endpoint, '/'); |
| 83 | 79 | |
| 84 | 80 | try { |
@@ -54,19 +54,19 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function handle() |
| 56 | 56 | { |
| 57 | - if (! $this->token) { |
|
| 57 | + if (!$this->token) { |
|
| 58 | 58 | $this->error('You must paste your Discord token (App Bot User token) into your `services.php` config file.'); |
| 59 | 59 | $this->error('View the README for more info: https://github.com/laravel-notification-channels/discord#installation'); |
| 60 | 60 | |
| 61 | 61 | return -1; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if (! $this->confirm('Is the bot already added to your server?')) { |
|
| 64 | + if (!$this->confirm('Is the bot already added to your server?')) { |
|
| 65 | 65 | $clientId = $this->ask('What is your Discord app client ID?'); |
| 66 | 66 | |
| 67 | 67 | $this->warn('Add the bot to your server by visiting this link: https://discordapp.com/oauth2/authorize?&client_id='.$clientId.'&scope=bot&permissions=0'); |
| 68 | 68 | |
| 69 | - if (! $this->confirm('Continue?', true)) { |
|
| 69 | + if (!$this->confirm('Continue?', true)) { |
|
| 70 | 70 | return -1; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $response = $client->receive(); |
| 102 | 102 | $identified = Arr::get(json_decode($response, true), 't') === 'READY'; |
| 103 | 103 | |
| 104 | - if (! $identified) { |
|
| 104 | + if (!$identified) { |
|
| 105 | 105 | $this->error("Discord responded with an error while trying to identify the bot: $response"); |
| 106 | 106 | |
| 107 | 107 | return -1; |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | * @param \GuzzleHttp\Client $guzzle |
| 40 | 40 | * @param string|null $token |
| 41 | 41 | */ |
| 42 | - public function __construct(HttpClient $guzzle, $token = null) |
|
| 43 | - { |
|
| 42 | + public function __construct(HttpClient $guzzle, $token = null) { |
|
| 44 | 43 | parent::__construct(); |
| 45 | 44 | |
| 46 | 45 | $this->guzzle = $guzzle; |
@@ -52,8 +51,7 @@ discard block |
||
| 52 | 51 | * |
| 53 | 52 | * @return int|void |
| 54 | 53 | */ |
| 55 | - public function handle() |
|
| 56 | - { |
|
| 54 | + public function handle() { |
|
| 57 | 55 | if (! $this->token) { |
| 58 | 56 | $this->error('You must paste your Discord token (App Bot User token) into your `services.php` config file.'); |
| 59 | 57 | $this->error('View the README for more info: https://github.com/laravel-notification-channels/discord#installation'); |
@@ -117,8 +115,7 @@ discard block |
||
| 117 | 115 | * |
| 118 | 116 | * @return \WebSocket\Client |
| 119 | 117 | */ |
| 120 | - public function getSocket($gateway) |
|
| 121 | - { |
|
| 118 | + public function getSocket($gateway) { |
|
| 122 | 119 | return new Client($gateway); |
| 123 | 120 | } |
| 124 | 121 | |
@@ -127,8 +124,7 @@ discard block |
||
| 127 | 124 | * |
| 128 | 125 | * @return string |
| 129 | 126 | */ |
| 130 | - public function getGateway() |
|
| 131 | - { |
|
| 127 | + public function getGateway() { |
|
| 132 | 128 | $gateway = $this->gateway; |
| 133 | 129 | |
| 134 | 130 | try { |
@@ -16,16 +16,14 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return static |
| 18 | 18 | */ |
| 19 | - public static function create($body = '') |
|
| 20 | - { |
|
| 19 | + public static function create($body = '') { |
|
| 21 | 20 | return new static($body); |
| 22 | 21 | } |
| 23 | 22 | |
| 24 | 23 | /** |
| 25 | 24 | * @param string $body |
| 26 | 25 | */ |
| 27 | - public function __construct($body = '') |
|
| 28 | - { |
|
| 26 | + public function __construct($body = '') { |
|
| 29 | 27 | $this->body = $body; |
| 30 | 28 | } |
| 31 | 29 | |
@@ -36,8 +34,7 @@ discard block |
||
| 36 | 34 | * |
| 37 | 35 | * @return $this |
| 38 | 36 | */ |
| 39 | - public function body($body) |
|
| 40 | - { |
|
| 37 | + public function body($body) { |
|
| 41 | 38 | $this->body = $body; |
| 42 | 39 | |
| 43 | 40 | return $this; |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * Register the application services. |
| 12 | 12 | */ |
| 13 | - public function register() |
|
| 14 | - { |
|
| 13 | + public function register() { |
|
| 15 | 14 | $this->app->bind('command.discord:setup', SetupCommand::class); |
| 16 | 15 | $this->commands('command.discord:setup'); |
| 17 | 16 | } |
@@ -19,8 +18,7 @@ discard block |
||
| 19 | 18 | /** |
| 20 | 19 | * Bootstrap the application services. |
| 21 | 20 | */ |
| 22 | - public function boot() |
|
| 23 | - { |
|
| 21 | + public function boot() { |
|
| 24 | 22 | $token = $this->app->make('config')->get('services.discord.token'); |
| 25 | 23 | |
| 26 | 24 | $this->app->when(Discord::class) |