Skip to content

Commit

Permalink
fix: format code and update lang for bot tools
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Nov 23, 2023
1 parent f240240 commit 378275a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
return [
'by' => 'by',
'unknown_callback' => 'Unknown Callback. Something went wrong!',
'invalid_request' => '🤨 Invalid Request!',
];
3 changes: 3 additions & 0 deletions lang/en/tools/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
'server' => 'To get Server Information',
'settings' => 'Go to settings of the bot',
'back' => 'Back',

'discussion' => '🗨 Discussion',
'source_code' => '💠 Source Code',
];
3 changes: 2 additions & 1 deletion src/Services/CallbackService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function __construct(Bot $bot)
* Answer the back button.
*
* @param string $callback
*
* @return void
*
* @throws MessageIsEmptyException
* @throws BotException
* @throws CallbackException
Expand Down Expand Up @@ -71,6 +71,7 @@ public function answerBackButton(string $callback): void

/**
* @return void
*
* @throws MessageIsEmptyException
* @throws InvalidViewTemplateException
* @throws BotException|CallbackException
Expand Down
11 changes: 6 additions & 5 deletions src/Services/CommandService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public function __construct(Bot $bot)
}

/**
* @param Bot $bot
*
* @param Bot $bot
* @return void
*
* @throws EntryNotFoundException
*/
public function sendStartMessage(Bot $bot): void
Expand All @@ -34,13 +34,14 @@ public function sendStartMessage(Bot $bot): void
['first_name' => $bot->telegram->FirstName()]
);
$bot->sendPhoto(
__DIR__ . '/../../resources/images/start.png',
__DIR__.'/../../resources/images/start.png',
['caption' => $reply]
);
}

/**
* @return void
*
* @throws EntryNotFoundException
* @throws MessageIsEmptyException
*/
Expand All @@ -64,7 +65,7 @@ public function handle(): void
case '/id':
case '/usage':
case '/server':
$this->bot->sendMessage(view('tools.' . trim($text, '/')));
$this->bot->sendMessage(view("$this->viewNamespace::tools.".trim($text, '/')));

break;
case '/settings':
Expand All @@ -76,7 +77,7 @@ public function handle(): void

break;
default:
$this->bot->sendMessage('🤨 Invalid Request!');
$this->bot->sendMessage(__('tg-notifier::app.invalid_request'));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Traits/Markup.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
trait Markup
{
/**
* Generate menu markup
* Generate menu markup.
*
* @return array[]
*/
public function menuMarkup(Telegram $telegram): array
{
return [
[
$telegram->buildInlineKeyBoardButton('🗨 Discussion', config('telegram-git-notifier.author.discussion')),
$telegram->buildInlineKeyBoardButton(__('tg-notifier::tools/menu.discussion'), config('telegram-git-notifier.author.discussion')),
], [
$telegram->buildInlineKeyBoardButton('💠 Source Code', config('telegram-git-notifier.author.source_code')),
$telegram->buildInlineKeyBoardButton(__('tg-notifier::tools/menu.source_code'), config('telegram-git-notifier.author.source_code')),
],
];
}
Expand Down

0 comments on commit 378275a

Please sign in to comment.