Skip to content

Commit

Permalink
Merge pull request #17 from tanhongit/develop
Browse files Browse the repository at this point in the history
feat: check chat id from telegram permission with config
  • Loading branch information
tanhongit authored Oct 14, 2023
2 parents 0f0d3fd + 3401035 commit ec9b166
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 ec9b166

Please sign in to comment.