Skip to content

Commit

Permalink
feat: check chat id from telegram permission with config
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Oct 14, 2023
1 parent 8b8bca9 commit 3401035
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/jsons/tg-setting.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"is_notified": true,
"all_events_notify": false
"all_events_notify": false,
"command_bot_only": false
}
6 changes: 6 additions & 0 deletions src/Interfaces/TelegramInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ public function isMessage(): bool;
* @return bool
*/
public function isOwner(): bool;

/**
* Check chat id from telegram permission with config
* @return bool
*/
public function isNotifyChat(): bool;
}
10 changes: 10 additions & 0 deletions src/Services/TelegramService.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@ public function isOwner(): bool

return false;
}

public function isNotifyChat(): bool
{
$chatIds = config('telegram-git-notifier.bot.notify_chat_ids');
if (in_array($this->telegram->ChatID(), $chatIds)) {
return true;
}

return false;
}
}

0 comments on commit 3401035

Please sign in to comment.