Skip to content

Commit

Permalink
fix: handle to setting of the bot
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Oct 13, 2023
1 parent 4758642 commit 66fefac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/Services/SettingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ class SettingService extends AppService implements SettingInterface
public function __construct(
Telegram $telegram,
Setting $setting,
Event $event
Event $event,
?string $chatId = null
) {
parent::__construct($telegram);

$this->setting = $setting;
$this->event = $event;

$this->setCurrentChatId($chatId);
}
}
8 changes: 4 additions & 4 deletions src/Trait/BotSettingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trait BotSettingTrait
public function settingHandle(?string $view = null): void
{
$this->sendMessage(
view($view ?? config('telegram-git-notifier.view.tools.setting')),
view($view ?? config('telegram-git-notifier.view.tools.settings')),
['reply_markup' => $this->settingMarkup()]
);
}
Expand All @@ -19,7 +19,7 @@ public function settingMarkup(): array
$markup = [
[
$this->telegram->buildInlineKeyBoardButton(
$this->setting[SettingConstant::T_IS_NOTIFIED]
$this->setting->getSettings()[SettingConstant::T_IS_NOTIFIED]
? '✅ Allow notifications'
: 'Allow notifications',
'',
Expand All @@ -28,7 +28,7 @@ public function settingMarkup(): array
],
[
$this->telegram->buildInlineKeyBoardButton(
$this->setting[SettingConstant::T_ALL_EVENTS_NOTIFICATION]
$this->setting->getSettings()[SettingConstant::T_ALL_EVENTS_NOTIFICATION]
? '✅ Enable All Events Notify'
: 'Enable All Events Notify',
'',
Expand All @@ -52,7 +52,7 @@ public function settingMarkup(): array

public function customEventMarkup(array $markup): array
{
if (!$this->setting[SettingConstant::T_ALL_EVENTS_NOTIFICATION]) {
if (!$this->setting->getSettings()[SettingConstant::T_ALL_EVENTS_NOTIFICATION]) {
$markup[] = [
$this->telegram->buildInlineKeyBoardButton(
'🦑 Custom github events',
Expand Down

0 comments on commit 66fefac

Please sign in to comment.