diff --git a/config/jsons/tg-setting.json b/config/jsons/tg-setting.json index 5607a90..23c4895 100644 --- a/config/jsons/tg-setting.json +++ b/config/jsons/tg-setting.json @@ -1,4 +1,5 @@ { "is_notified": true, - "all_events_notify": false + "all_events_notify": false, + "command_bot_only": false } diff --git a/src/Interfaces/TelegramInterface.php b/src/Interfaces/TelegramInterface.php index 9b11158..f6d95c4 100644 --- a/src/Interfaces/TelegramInterface.php +++ b/src/Interfaces/TelegramInterface.php @@ -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; } diff --git a/src/Services/TelegramService.php b/src/Services/TelegramService.php index 3712935..0b8d9c1 100644 --- a/src/Services/TelegramService.php +++ b/src/Services/TelegramService.php @@ -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; + } }