Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff95796

Browse filesBrowse files
irazasyedgithub-actions[bot]
authored andcommitted
Fix styling
1 parent e8bb4b6 commit ff95796
Copy full SHA for ff95796

18 files changed

+62
-145
lines changed

‎config/telegram.php

Copy file name to clipboardExpand all lines: config/telegram.php
+15-27Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
* Here you may specify which of the bots below you wish to use as
1111
* your default bot for regular use. Of course, you may use many
1212
* bots at once using the manager class.
13-
*
1413
*/
15-
1614
'use' => 'default',
1715

1816
/**
@@ -43,34 +41,33 @@
4341
* 'bye' => App\Telegram\Commands\ByeCommand::class,
4442
* ]
4543
*/
46-
4744
'bots' => [
4845
'default' => [
49-
'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR-BOT-TOKEN'),
46+
'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR-BOT-TOKEN'),
5047

5148
'commands' => [
5249
// 'start' => App\Telegram\Commands\Start::class,
5350
],
5451

5552
'listen' => [
56-
'update' => [],
57-
'webhook.failed' => [],
53+
'update' => [],
54+
'webhook.failed' => [],
5855

5956
// Example of various events fired.
60-
'message' => [],
61-
'poll' => [],
57+
'message' => [],
58+
'poll' => [],
6259
'message.left_chat_member' => [],
63-
'inline_query.location' => [],
60+
'inline_query.location' => [],
6461
],
6562
],
6663

6764
'second' => [
68-
'token' => '123456:abc',
65+
'token' => '123456:abc',
6966

7067
// Custom config used with the "telegram:webhook-setup" artisan command.
71-
'webhook' => [
72-
'url' => null,
73-
'certificate' => null,
68+
'webhook' => [
69+
'url' => null,
70+
'certificate' => null,
7471
'max_connections' => 40,
7572
'allowed_updates' => [],
7673
],
@@ -90,12 +87,10 @@
9087
*
9188
* Default path: telegram
9289
* Webhook path: /telegram/{token}/{bot}
93-
*
9490
*/
95-
9691
'webhook' => [
97-
'domain' => env('TELEGRAM_WEBHOOK_DOMAIN', null),
98-
'path' => env('TELEGRAM_WEBHOOK_PATH', 'telegram'),
92+
'domain' => env('TELEGRAM_WEBHOOK_DOMAIN', null),
93+
'path' => env('TELEGRAM_WEBHOOK_PATH', 'telegram'),
9994
'controller' => \Telegram\Bot\Laravel\Http\Controllers\WebhookController::class,
10095
],
10196

@@ -108,14 +103,12 @@
108103
* - async: When set to True, All the requests would be made non-blocking (Async).
109104
* - api_url: To set the Base API URL.
110105
* - client: To set HTTP Client. Should be an instance of @see \Telegram\Bot\Contracts\HttpClientInterface::class
111-
*
112106
*/
113-
114107
'http' => [
115-
'config' => [],
116-
'async' => env('TELEGRAM_ASYNC_REQUESTS', false),
108+
'config' => [],
109+
'async' => env('TELEGRAM_ASYNC_REQUESTS', false),
117110
'api_url' => 'https://api.telegram.org',
118-
'client' => \Telegram\Bot\Http\GuzzleHttpClient::class,
111+
'client' => \Telegram\Bot\Http\GuzzleHttpClient::class,
119112
],
120113

121114
/**
@@ -132,9 +125,7 @@
132125
*
133126
* Default: The SDK registers, a help command which when a user sends /help
134127
* will respond with a list of available commands and description.
135-
*
136128
*/
137-
138129
'commands' => [
139130
'help' => Telegram\Bot\Commands\HelpCommand::class,
140131
],
@@ -161,7 +152,6 @@
161152
*
162153
* Examples shown below are by the group type for you to understand each of them.
163154
*/
164-
165155
'command_groups' => [
166156
],
167157

@@ -180,9 +170,7 @@
180170
* individually in a group of commands or in bot commands.
181171
*
182172
* Think of this as a central storage, to register, reuse and maintain them across all bots.
183-
*
184173
*/
185-
186174
'command_repository' => [
187175
// 'start' => App\Telegram\Commands\StartCommand::class,
188176
// 'stop' => App\Telegram\Commands\StopCommand::class,

‎routes/telegram.php

Copy file name to clipboardExpand all lines: routes/telegram.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Telegram\Bot\Laravel\Facades\Telegram;
55
use Telegram\Bot\Laravel\Http\Middleware\ValidateWebhook;
66

7-
Route::group(['middleware' => ValidateWebhook::class], function() {
7+
Route::group(['middleware' => ValidateWebhook::class], function () {
88

99
Route::post('/{token}/{bot}', config('telegram.webhook.controller'))->name('telegram.bot.webhook');
1010

‎src/Console/Command/CommandListCommand.php

Copy file name to clipboardExpand all lines: src/Console/Command/CommandListCommand.php
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ public function handle(): void
3030
$this->displayCommands($this->getCommandsList());
3131
}
3232

33-
/**
34-
* @param array $data
35-
*/
3633
protected function displayCommands(array $data): void
3734
{
3835
$this->table(['Command', 'Description'], $data);
@@ -42,8 +39,6 @@ protected function displayCommands(array $data): void
4239
* Get Commands List.
4340
*
4441
* @throws TelegramSDKException
45-
*
46-
* @return array
4742
*/
4843
protected function getCommandsList(): array
4944
{

‎src/Console/Command/CommandMakeCommand.php

Copy file name to clipboardExpand all lines: src/Console/Command/CommandMakeCommand.php
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,23 @@ class CommandMakeCommand extends GeneratorCommand
2929

3030
/**
3131
* Get the stub file for the generator.
32-
*
33-
* @return string
3432
*/
3533
protected function getStub(): string
3634
{
3735
$relativePath = '/stubs/telegram.command.stub';
3836

3937
return file_exists($customPath = $this->laravel->basePath(trim($relativePath, '/')))
4038
? $customPath
41-
: __DIR__ . '/../../..' . $relativePath;
39+
: __DIR__.'/../../..'.$relativePath;
4240
}
4341

4442
/**
4543
* Get the default namespace for the class.
4644
*
47-
* @param string $rootNamespace
48-
*
49-
* @return string
45+
* @param string $rootNamespace
5046
*/
5147
protected function getDefaultNamespace($rootNamespace): string
5248
{
53-
return $rootNamespace . '\Telegram\Commands';
49+
return $rootNamespace.'\Telegram\Commands';
5450
}
5551
}

‎src/Console/Command/CommandRegisterCommand.php

Copy file name to clipboardExpand all lines: src/Console/Command/CommandRegisterCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function registerCommands(): void
5757

5858
return BotCommand::make([
5959
// Can contain only lowercase English letters, digits and underscores.
60-
'command' => Str::lower($name),
60+
'command' => Str::lower($name),
6161
'description' => $command->getDescription(),
6262
]);
6363
})->values()->all();

‎src/Console/ConsoleBaseCommand.php

Copy file name to clipboardExpand all lines: src/Console/ConsoleBaseCommand.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ public function bot(): Bot
2929

3030
/**
3131
* Get the console command arguments.
32-
*
33-
* @return array
3432
*/
3533
protected function getArguments(): array
3634
{

‎src/Console/InstallCommand.php

Copy file name to clipboardExpand all lines: src/Console/InstallCommand.php
+2-10Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Telegram\Bot\Laravel\Console;
44

55
use Illuminate\Console\Command;
6-
use Illuminate\Filesystem\Filesystem;
76
use Illuminate\Console\ConfirmableTrait;
7+
use Illuminate\Filesystem\Filesystem;
88

99
class InstallCommand extends Command
1010
{
@@ -29,7 +29,7 @@ class InstallCommand extends Command
2929
*/
3030
public function handle(): void
3131
{
32-
if (!$this->confirmToProceed()) {
32+
if (! $this->confirmToProceed()) {
3333
return;
3434
}
3535

@@ -40,8 +40,6 @@ public function handle(): void
4040

4141
/**
4242
* Install the Telegram Bot SDK Scaffolding into the application.
43-
*
44-
* @return void
4543
*/
4644
protected function installScaffolding(): void
4745
{
@@ -90,12 +88,6 @@ protected function setBotTokenVariableInEnvironmentFile(): void
9088

9189
/**
9290
* Replace a given string within a given file.
93-
*
94-
* @param string $search
95-
* @param string $replace
96-
* @param string $path
97-
*
98-
* @return void
9991
*/
10092
protected function replaceInFile(string $search, string $replace, string $path): void
10193
{

‎src/Console/Webhook/WebhookInfoCommand.php

Copy file name to clipboardExpand all lines: src/Console/Webhook/WebhookInfoCommand.php
+18-49Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,21 @@ class WebhookInfoCommand extends ConsoleBaseCommand
3333

3434
/**
3535
* The table headers for the command.
36-
*
37-
* @var array
3836
*/
3937
protected array $headers = [
40-
'name' => 'Name',
41-
'username' => 'Username',
42-
'pending_update_count' => 'Pending Updates',
43-
'max_connections' => 'Max Connections',
38+
'name' => 'Name',
39+
'username' => 'Username',
40+
'pending_update_count' => 'Pending Updates',
41+
'max_connections' => 'Max Connections',
4442
'has_custom_certificate' => 'Certificate',
45-
'last_error_date' => 'Last Error Date',
46-
'last_error_message' => 'Last Error Message',
47-
'allowed_updates' => 'Allowed Updates',
48-
'url' => 'Webhook URL',
43+
'last_error_date' => 'Last Error Date',
44+
'last_error_message' => 'Last Error Message',
45+
'allowed_updates' => 'Allowed Updates',
46+
'url' => 'Webhook URL',
4947
];
5048

5149
/**
5250
* The columns to display when using the "compact" flag.
53-
*
54-
* @var array
5551
*/
5652
protected array $compactColumns = [
5753
'name',
@@ -76,8 +72,6 @@ public function handle(): void
7672

7773
/**
7874
* Get webhooks info to display.
79-
*
80-
* @return array
8175
*/
8276
protected function getWebhooks(): array
8377
{
@@ -105,11 +99,8 @@ protected function getWebhooks(): array
10599
/**
106100
* Compile the webhook info into a displayable format.
107101
*
108-
* @param string $name
109102
*
110103
* @throws TelegramSDKException
111-
*
112-
* @return array|null
113104
*/
114105
protected function getWebhookInfo(string $name): ?array
115106
{
@@ -119,34 +110,30 @@ protected function getWebhookInfo(string $name): ?array
119110
$profile = $bot->getMe();
120111
$webhook = $bot->getWebhookInfo();
121112
} catch (TelegramSDKException $e) {
122-
$error = ($e->getCode() === 401) ? $e->getMessage() . ' - Token not properly configured' : $e->getMessage();
113+
$error = ($e->getCode() === 401) ? $e->getMessage().' - Token not properly configured' : $e->getMessage();
123114

124115
$this->line('');
125-
$this->warn(sprintf("Skipped bot [%s] due to Error: %s", $name, $error));
116+
$this->warn(sprintf('Skipped bot [%s] due to Error: %s', $name, $error));
126117
$this->line('');
127118

128119
return null;
129120
}
130121

131122
return [
132-
'name' => $name,
133-
'username' => $profile->username,
134-
'pending_update_count' => $webhook->get('pending_update_count', 0),
135-
'max_connections' => $webhook->get('max_connections', static::DEFAULT_MAX_CONNECTIONS),
123+
'name' => $name,
124+
'username' => $profile->username,
125+
'pending_update_count' => $webhook->get('pending_update_count', 0),
126+
'max_connections' => $webhook->get('max_connections', static::DEFAULT_MAX_CONNECTIONS),
136127
'has_custom_certificate' => $this->presentBool($webhook->has_custom_certificate),
137-
'last_error_date' => $this->presentLastErrorDate($webhook),
138-
'last_error_message' => $webhook->last_error_message,
139-
'allowed_updates' => implode(', ', $webhook->get('allowed_updates', [])),
140-
'url' => $webhook->url,
128+
'last_error_date' => $this->presentLastErrorDate($webhook),
129+
'last_error_message' => $webhook->last_error_message,
130+
'allowed_updates' => implode(', ', $webhook->get('allowed_updates', [])),
131+
'url' => $webhook->url,
141132
];
142133
}
143134

144135
/**
145136
* Present last error date unix time to readable.
146-
*
147-
* @param WebhookInfo $webhook
148-
*
149-
* @return Carbon|null
150137
*/
151138
protected function presentLastErrorDate(WebhookInfo $webhook): ?Carbon
152139
{
@@ -157,10 +144,6 @@ protected function presentLastErrorDate(WebhookInfo $webhook): ?Carbon
157144

158145
/**
159146
* Present boolean value as tick or cross.
160-
*
161-
* @param $value
162-
*
163-
* @return string
164147
*/
165148
protected function presentBool($value): string
166149
{
@@ -169,10 +152,6 @@ protected function presentBool($value): string
169152

170153
/**
171154
* Remove unnecessary columns from the webhook.
172-
*
173-
* @param array $webhooks
174-
*
175-
* @return array
176155
*/
177156
protected function pluckColumns(array $webhooks): array
178157
{
@@ -184,10 +163,8 @@ protected function pluckColumns(array $webhooks): array
184163
/**
185164
* Display the webhook information on the console.
186165
*
187-
* @param array $data
188166
*
189167
* @throws \JsonException
190-
* @return void
191168
*/
192169
protected function displayWebhookInfo(array $data): void
193170
{
@@ -202,8 +179,6 @@ protected function displayWebhookInfo(array $data): void
202179

203180
/**
204181
* Get the table headers for the visible columns.
205-
*
206-
* @return array
207182
*/
208183
protected function getHeaders(): array
209184
{
@@ -212,8 +187,6 @@ protected function getHeaders(): array
212187

213188
/**
214189
* Get the column names to show (lowercase table headers).
215-
*
216-
* @return array
217190
*/
218191
protected function getColumns(): array
219192
{
@@ -233,10 +206,6 @@ protected function getColumns(): array
233206

234207
/**
235208
* Parse the column list.
236-
*
237-
* @param array $columns
238-
*
239-
* @return array
240209
*/
241210
protected function parseColumns(array $columns): array
242211
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.