diff --git a/config/tg-notifier.php b/config/tg-notifier.php index 20db490..4939d03 100644 --- a/config/tg-notifier.php +++ b/config/tg-notifier.php @@ -44,7 +44,7 @@ ?? 'tools.custom_event_action', 'custom_event' => $_ENV['TGN_VIEW_TOOL_CUSTOM_EVENT'] ?? 'tools.custom_event', - 'set_menu_cmd' => $_ENV['TGN_VIEW_TOOL_SET_MENU_COMMAND'] + 'set_menu_cmd' => $_ENV['TGN_VIEW_TOOL_SET_MENU_COMMAND'] ?? 'tools.set_menu_cmd', ], ], diff --git a/src/Models/Setting.php b/src/Models/Setting.php index 3789242..bce7fe8 100644 --- a/src/Models/Setting.php +++ b/src/Models/Setting.php @@ -41,7 +41,7 @@ public function getSettingFile(): string * * @return void */ - private function setSettingConfig(): void + public function setSettingConfig(): void { $json = file_get_contents($this->settingFile); $this->settings = json_decode($json, true); diff --git a/src/Services/AppService.php b/src/Services/AppService.php index 3666ad4..c115806 100644 --- a/src/Services/AppService.php +++ b/src/Services/AppService.php @@ -19,9 +19,9 @@ public function __construct(Telegram $telegram = null) $this->telegram = $telegram ?? new Telegram(config('telegram-git-notifier.bot.token')); } - public function setCurrentChatId(string $chatId): void + public function setCurrentChatId(string $chatId = null): void { - $this->chatId = $chatId; + $this->chatId = $chatId ?? config('telegram-git-notifier.bot.chat_id'); } private function createBaseContent(): array diff --git a/src/Services/SettingService.php b/src/Services/SettingService.php index 3356383..b05b3c5 100644 --- a/src/Services/SettingService.php +++ b/src/Services/SettingService.php @@ -175,7 +175,8 @@ public function sendSettingEventMessage( ) { $this->editMessageText( view( - $view ?? config('telegram-git-notifier.view.tools.custom_event'), + $view ?? + config('telegram-git-notifier.view.tools.custom_event'), compact('platform') ), ['reply_markup' => $this->eventMarkup(null, $platform)] @@ -259,7 +260,8 @@ public function settingMarkup(): array $markup = [ [ $this->telegram->buildInlineKeyBoardButton( - $this->setting[SettingConstant::T_IS_NOTIFIED] ? '✅ Allow notifications' + $this->setting[SettingConstant::T_IS_NOTIFIED] + ? '✅ Allow notifications' : 'Allow notifications', '', SettingConstant::SETTING_IS_NOTIFIED