Skip to content

Commit f240240

Browse files
committed
lang: update menu in bot tools
1 parent 15f583f commit f240240

File tree

4 files changed

+61
-29
lines changed

4 files changed

+61
-29
lines changed

lang/en/tools/menu.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
return [
4+
'title' => 'BOT MENU',
5+
6+
'start' => 'Welcome to the bot',
7+
'menu' => 'Show menu of the bot',
8+
'token' => 'Show token of the bot',
9+
'id' => 'Show the ID of the current chat',
10+
'usage' => 'Show step by step usage',
11+
'server' => 'To get Server Information',
12+
'settings' => 'Go to settings of the bot',
13+
'back' => 'Back',
14+
];

resources/views/tools/menu.blade.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
use CSlant\LaravelTelegramGitNotifier\Services\CommandService;
4+
5+
$menuCommands = CommandService::menuCommands() ?? [];
6+
?>
7+
8+
<b>{{ __('tg-notifier::tools/menu.title') }}</b> 🤖
9+
10+
<?php foreach ($menuCommands as $menuCommand) : ?>
11+
<b><?= $menuCommand['command'] ?></b> - <?= $menuCommand['description'] ?>
12+
13+
<?php endforeach; ?>

src/Services/CallbackService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public function __construct(Bot $bot)
2525
}
2626

2727
/**
28-
* Answer the back button
28+
* Answer the back button.
2929
*
30-
* @param string $callback
30+
* @param string $callback
3131
*
3232
* @return void
3333
* @throws MessageIsEmptyException

src/Services/CommandService.php

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,6 @@ class CommandService
1111
{
1212
use Markup;
1313

14-
public const MENU_COMMANDS
15-
= [
16-
[
17-
'command' => '/start',
18-
'description' => 'Welcome to the bot',
19-
], [
20-
'command' => '/menu',
21-
'description' => 'Show menu of the bot',
22-
], [
23-
'command' => '/token',
24-
'description' => 'Show token of the bot',
25-
], [
26-
'command' => '/id',
27-
'description' => 'Show the ID of the current chat',
28-
], [
29-
'command' => '/usage',
30-
'description' => 'Show step by step usage',
31-
], [
32-
'command' => '/server',
33-
'description' => 'To get Server Information',
34-
], [
35-
'command' => '/settings',
36-
'description' => 'Go to settings of the bot',
37-
],
38-
];
39-
4014
private Bot $bot;
4115

4216
protected string $viewNamespace = '';
@@ -98,11 +72,42 @@ public function handle(): void
9872

9973
break;
10074
case '/set_menu':
101-
$this->bot->setMyCommands(CommandService::MENU_COMMANDS);
75+
$this->bot->setMyCommands(self::menuCommands());
10276

10377
break;
10478
default:
10579
$this->bot->sendMessage('🤨 Invalid Request!');
10680
}
10781
}
82+
83+
/**
84+
* @return array[]
85+
*/
86+
public static function menuCommands(): array
87+
{
88+
return [
89+
[
90+
'command' => '/start',
91+
'description' => __('tg-notifier::tools/menu.start'),
92+
], [
93+
'command' => '/menu',
94+
'description' => __('tg-notifier::tools/menu.menu'),
95+
], [
96+
'command' => '/token',
97+
'description' => __('tg-notifier::tools/menu.token'),
98+
], [
99+
'command' => '/id',
100+
'description' => __('tg-notifier::tools/menu.id'),
101+
], [
102+
'command' => '/usage',
103+
'description' => __('tg-notifier::tools/menu.usage'),
104+
], [
105+
'command' => '/server',
106+
'description' => __('tg-notifier::tools/menu.server'),
107+
], [
108+
'command' => '/settings',
109+
'description' => __('tg-notifier::tools/menu.settings'),
110+
],
111+
];
112+
}
108113
}

0 commit comments

Comments
 (0)