├── .docker
├── log
│ └── nginx
│ │ └── .gitkeep
├── config
│ └── php
│ │ └── php.ini
├── Dockerfile
└── conf.d
│ └── site.conf
├── .styleci.yml
├── resources
├── views
│ ├── tools
│ │ ├── settings.php
│ │ ├── id.php
│ │ ├── token.php
│ │ ├── set_menu_cmd.php
│ │ ├── about.php
│ │ ├── start.php
│ │ ├── menu.php
│ │ ├── custom_event_action.php
│ │ ├── server.php
│ │ ├── custom_event.php
│ │ └── usage.php
│ ├── events
│ │ ├── github
│ │ │ ├── watch
│ │ │ │ └── started.php
│ │ │ ├── workflow_job
│ │ │ │ ├── queued.php
│ │ │ │ ├── in_progress.php
│ │ │ │ └── completed.php
│ │ │ ├── issues
│ │ │ │ ├── deleted.php
│ │ │ │ ├── locked.php
│ │ │ │ ├── pinned.php
│ │ │ │ ├── unlocked.php
│ │ │ │ ├── unpinned.php
│ │ │ │ ├── opened.php
│ │ │ │ ├── closed.php
│ │ │ │ ├── reopened.php
│ │ │ │ └── edited.php
│ │ │ ├── pull_request
│ │ │ │ ├── partials
│ │ │ │ │ └── _reviewers.php
│ │ │ │ ├── opened.php
│ │ │ │ ├── reopened.php
│ │ │ │ └── closed.php
│ │ │ ├── workflow_run
│ │ │ │ ├── requested.php
│ │ │ │ └── completed.php
│ │ │ ├── ping
│ │ │ │ └── default.php
│ │ │ ├── pull_request_review
│ │ │ │ ├── submitted.php
│ │ │ │ └── dismissed.php
│ │ │ ├── issue_comment
│ │ │ │ ├── deleted.php
│ │ │ │ ├── created.php
│ │ │ │ └── edited.php
│ │ │ └── push
│ │ │ │ └── default.php
│ │ ├── gitlab
│ │ │ ├── wiki_page
│ │ │ │ ├── delete.php
│ │ │ │ ├── create.php
│ │ │ │ └── update.php
│ │ │ ├── note
│ │ │ │ ├── issue.php
│ │ │ │ ├── snippet.php
│ │ │ │ ├── commit.php
│ │ │ │ └── merge_request.php
│ │ │ ├── merge_request
│ │ │ │ ├── partials
│ │ │ │ │ └── _reviewers.php
│ │ │ │ ├── close.php
│ │ │ │ ├── merge.php
│ │ │ │ ├── unapproved.php
│ │ │ │ ├── approved.php
│ │ │ │ ├── open.php
│ │ │ │ ├── update.php
│ │ │ │ ├── reopen.php
│ │ │ │ └── unapproval.php
│ │ │ ├── release
│ │ │ │ ├── create.php
│ │ │ │ └── update.php
│ │ │ ├── issue
│ │ │ │ ├── close.php
│ │ │ │ ├── open.php
│ │ │ │ ├── update.php
│ │ │ │ └── reopen.php
│ │ │ ├── tag_push
│ │ │ │ └── default.php
│ │ │ ├── push
│ │ │ │ └── default.php
│ │ │ └── feature_flag
│ │ │ │ └── default.php
│ │ └── shared
│ │ │ └── partials
│ │ │ ├── github
│ │ │ ├── _body.php
│ │ │ └── _assignees.php
│ │ │ └── gitlab
│ │ │ ├── _assignees.php
│ │ │ └── _body.php
│ └── globals
│ │ └── access_denied.php
└── images
│ └── start.png
├── .github
├── FUNDING.yml
└── workflows
│ ├── php-cs-fixer.yml
│ ├── setup_test.yml
│ ├── phpstan.yml
│ └── update-changelog.yml
├── docker.sh
├── phpstan.neon.dist
├── UPGRADING.md
├── .gitignore
├── init.php
├── webhook
├── set.php
├── delete.php
└── getUpdate.php
├── .editorconfig
├── index.php
├── src
├── Traits
│ └── Markup.php
├── Http
│ └── Actions
│ │ ├── WebhookAction.php
│ │ └── IndexAction.php
└── Services
│ ├── CommandService.php
│ ├── NotificationService.php
│ └── CallbackService.php
├── docker-compose.yml
├── .scrutinizer.yml
├── LICENSE
├── .php-cs-fixer.dist.php
├── .env.example
├── composer.json
├── CHANGELOG.md
└── README.md
/.docker/log/nginx/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.styleci.yml:
--------------------------------------------------------------------------------
1 | preset: psr12
2 |
--------------------------------------------------------------------------------
/resources/views/tools/settings.php:
--------------------------------------------------------------------------------
1 | Settings for your bot 🤖
2 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [tanhongit]
4 |
--------------------------------------------------------------------------------
/resources/views/tools/id.php:
--------------------------------------------------------------------------------
1 | Your id is = config('telegram-git-notifier.bot.chat_id') ?>
2 |
--------------------------------------------------------------------------------
/docker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | docker-compose up -d
4 | docker-compose run --rm server bash -c "composer install"
5 |
--------------------------------------------------------------------------------
/resources/views/tools/token.php:
--------------------------------------------------------------------------------
1 | This bot token is: = config('telegram-git-notifier.bot.token') ?>
2 |
--------------------------------------------------------------------------------
/resources/images/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cslant/telegram-git-notifier-app/main/resources/images/start.png
--------------------------------------------------------------------------------
/resources/views/tools/set_menu_cmd.php:
--------------------------------------------------------------------------------
1 | ✅ Menu button set successfully!
2 |
3 | Please restart the bot to apply the changes.
4 |
--------------------------------------------------------------------------------
/phpstan.neon.dist:
--------------------------------------------------------------------------------
1 | parameters:
2 | level: 8
3 | paths:
4 | - src
5 | - webhook
6 | tmpDir: build/phpstan
7 | checkMissingIterableValueType: false
8 |
--------------------------------------------------------------------------------
/resources/views/tools/about.php:
--------------------------------------------------------------------------------
1 | Thanks for using our bot.
2 |
3 | The bot is designed to send notifications based on GitHub and GitLab events from your repo instantly to your Telegram account.
4 |
--------------------------------------------------------------------------------
/UPGRADING.md:
--------------------------------------------------------------------------------
1 | ## Upgrading
2 |
3 | ### Moving from lbiltech/telegram-git-notifier-app to cslant/telegram-git-notifier-app
4 |
5 | - Replace any reference in your application from `LbilTech\TelegramGitNotifierApp` to `CSlant\TelegramGitNotifierApp`
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | .idea
3 |
4 | vendor
5 | node_modules
6 |
7 | composer.lock
8 | .env
9 | storage
10 |
11 | .docker
12 | *.log
13 | logs
14 |
15 | build
16 | .php-cs-fixer.cache
17 | .phpunit.cache
18 | .phpunit.result.cache
19 |
--------------------------------------------------------------------------------
/init.php:
--------------------------------------------------------------------------------
1 | load();
9 |
10 | date_default_timezone_set(config('telegram-git-notifier.app.timezone'));
11 |
--------------------------------------------------------------------------------
/resources/views/events/github/watch/started.php:
--------------------------------------------------------------------------------
1 | Watch Started form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
7 |
8 | $message .= "👤 Watcher: {$payload->sender->login} 👀\n\n";
9 |
10 | echo $message;
11 |
--------------------------------------------------------------------------------
/resources/views/tools/start.php:
--------------------------------------------------------------------------------
1 |
7 | 🙋🏻 = config('telegram-git-notifier.app.name') ?> 🤓
8 |
9 | Hey = $first_name ?>,
10 |
11 | I can send you notifications from your 🦑GitHub or 🦊GitLab Repository instantly to your Telegram.
12 | Use /menu for more options.
13 |
--------------------------------------------------------------------------------
/resources/views/tools/menu.php:
--------------------------------------------------------------------------------
1 |
7 |
8 | BOT MENU 🤖
9 |
10 |
11 | = $menuCommand['command'] ?> - = $menuCommand['description'] ?>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/webhook/set.php:
--------------------------------------------------------------------------------
1 | set();
12 | } catch (WebhookException $e) {
13 | echo $e->getMessage();
14 | }
15 |
--------------------------------------------------------------------------------
/resources/views/globals/access_denied.php:
--------------------------------------------------------------------------------
1 | Access Denied to Bot 🚫';
7 |
8 | if (!empty($chatId)) {
9 | $message .= "\n\n🛑 Chat ID: {$chatId} \n";
10 | }
11 |
12 | $message .= 'Please contact the administrator for further information, Thank You..';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/webhook/delete.php:
--------------------------------------------------------------------------------
1 | delete();
12 | } catch (WebhookException $e) {
13 | echo $e->getMessage();
14 | }
15 |
--------------------------------------------------------------------------------
/resources/views/tools/custom_event_action.php:
--------------------------------------------------------------------------------
1 |
12 | Setting actions for the = $event ?> event = $platformIcon ?>.
13 | Please select an action of this event to enable or disable notifications:
14 |
--------------------------------------------------------------------------------
/webhook/getUpdate.php:
--------------------------------------------------------------------------------
1 | getUpdates();
12 | } catch (WebhookException $e) {
13 | echo $e->getMessage();
14 | }
15 |
--------------------------------------------------------------------------------
/resources/views/tools/server.php:
--------------------------------------------------------------------------------
1 | Server Address : = $_SERVER['SERVER_ADDR'] ?>
2 | Server Name : = $_SERVER['SERVER_NAME'] ?>
3 | Server Port : = $_SERVER['SERVER_PORT'] ?>
4 | Server Software : = $_SERVER['SERVER_SOFTWARE'] ?>
5 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/wiki_page/delete.php:
--------------------------------------------------------------------------------
1 | Wiki Page Deleted - 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->slug} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🏷 Title: {$payload->object_attributes->title} \n\n";
9 |
10 | echo $message;
11 |
--------------------------------------------------------------------------------
/resources/views/events/shared/partials/github/_body.php:
--------------------------------------------------------------------------------
1 | {$event}->body)) {
8 | $body = $payload->{$event}->body;
9 | if (strlen($body) > 50) {
10 | $body = substr($body, 0, 50) . '...';
11 | }
12 | return "📖 Content:\n{$body}";
13 | }
14 |
15 | return '';
16 |
--------------------------------------------------------------------------------
/.docker/config/php/php.ini:
--------------------------------------------------------------------------------
1 | upload_max_filesize = 8M
2 | post_max_size = 8M
3 | max_file_uploads = 10
4 |
5 | short_open_tag = Off
6 | buffer-size = 65535
7 | output_buffering = 65535
8 | log_errors = On
9 | error_log = /dev/stderr
10 |
11 | max_execution_time = 21600
12 | max_input_time = 21600
13 | max_input_vars = 10000
14 | memory_limit = -1
15 | zend.assertions = -1
16 | error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
17 |
--------------------------------------------------------------------------------
/resources/views/events/github/workflow_job/queued.php:
--------------------------------------------------------------------------------
1 | Action Queued form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
7 |
8 | $message .= "Queued action: 💥 {$payload->workflow_job->runner_name} ⏰\n\n";
9 |
10 | $message .= "🔗 Link: workflow_job->html_url}\">{$payload->workflow_job->html_url}\n\n";
11 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/note/issue.php:
--------------------------------------------------------------------------------
1 | New Comment on Issue - 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->issue->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title} \n\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
11 |
12 | echo $message;
13 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/deleted.php:
--------------------------------------------------------------------------------
1 | Issue Deleted form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | echo $message;
13 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/partials/_reviewers.php:
--------------------------------------------------------------------------------
1 | reviewers) && count($payload->reviewers) > 0) {
8 | $reviewers = [];
9 | foreach ($payload->reviewers as $reviewer) {
10 | $reviewers[] = "{$reviewer->name}";
11 | }
12 |
13 | $textReviewers .= "👥 Reviewers: " . implode(', ', $reviewers) . "\n";
14 | }
15 |
16 | return $textReviewers;
17 |
--------------------------------------------------------------------------------
/resources/views/events/github/workflow_job/in_progress.php:
--------------------------------------------------------------------------------
1 | Action in progress form 🦑repository->html_url}\">{$payload->repository->full_name} \n\n";
7 |
8 | $message .= "Running action: 💥 {$payload->workflow_job->runner_name} ⏳\n\n";
9 |
10 | $message .= "🔗 Link: workflow_job->html_url}\">{$payload->workflow_job->html_url}\n\n";
11 |
12 | echo $message;
13 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/release/create.php:
--------------------------------------------------------------------------------
1 | Release Created - 🦊url}\">{$payload->project->path_with_namespace}#{$payload->tag} by {$payload->commit->author->name}\n\n";
7 |
8 | $message .= "🔖 {$payload->tag} \n";
9 |
10 | $message .= "🗞 {$payload->name} \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/release/update.php:
--------------------------------------------------------------------------------
1 | Release Updated - 🦊url}\">{$payload->project->path_with_namespace}#{$payload->tag} by {$payload->commit->author->name}\n\n";
7 |
8 | $message .= "🔖 {$payload->tag} \n";
9 |
10 | $message .= "🗞 {$payload->name} \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/wiki_page/create.php:
--------------------------------------------------------------------------------
1 | Wiki Page Created - 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->slug} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🏷 Title: {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
11 |
12 | echo $message;
13 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/wiki_page/update.php:
--------------------------------------------------------------------------------
1 | Wiki Page Updated - 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->slug} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🏷 Title: {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
11 |
12 | echo $message;
13 |
--------------------------------------------------------------------------------
/resources/views/events/shared/partials/gitlab/_assignees.php:
--------------------------------------------------------------------------------
1 | assignees)) {
8 | $assigneeText = "🙋 Assignee: ";
9 | $assigneeArray = [];
10 | foreach ($payload->assignees as $assignee) {
11 | $assigneeArray[] = "{$assignee->name}";
12 | }
13 | $assigneeText .= implode(', ', $assigneeArray) . "\n";
14 | }
15 |
16 | return $assigneeText ?? '';
17 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/note/snippet.php:
--------------------------------------------------------------------------------
1 | New Comment on Snippet - 🦊object_attributes->url}\">{$payload->project->path_with_namespace} by {$payload->user->name}\n\n";
7 |
8 | $message .= "📝 {$payload->snippet->title} \n\n";
9 |
10 | $message .= "🔗 object_attributes->url}\">View Comment \n\n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/pull_request/partials/_reviewers.php:
--------------------------------------------------------------------------------
1 | pull_request->requested_reviewers) && count($payload->pull_request->requested_reviewers) > 0) {
8 | $reviewers = [];
9 | foreach ($payload->pull_request->requested_reviewers as $reviewer) {
10 | $reviewers[] = "{$reviewer->login}";
11 | }
12 |
13 | $textReviewers .= "👥 Reviewers: " . implode(', ', $reviewers) . "\n";
14 | }
15 |
16 | return $textReviewers;
17 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/locked.php:
--------------------------------------------------------------------------------
1 | Issue Locked form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/pinned.php:
--------------------------------------------------------------------------------
1 | Issue Pinned form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/shared/partials/github/_assignees.php:
--------------------------------------------------------------------------------
1 | {$event}->assignees)) {
8 | $assigneeText = "🙋 Assignee: ";
9 | $assigneeArray = [];
10 | foreach ($payload->{$event}->assignees as $assignee) {
11 | $assigneeArray[] = "html_url}\">@{$assignee->login} ";
12 | }
13 | $assigneeText .= implode(', ', $assigneeArray) . "\n";
14 | }
15 |
16 | return $assigneeText ?? '';
17 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/unlocked.php:
--------------------------------------------------------------------------------
1 | Issue Unlocked form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/unpinned.php:
--------------------------------------------------------------------------------
1 | Issue Unpinned form 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/issue/close.php:
--------------------------------------------------------------------------------
1 | Issue Closed to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->id} by {$payload->user->name}\n\n";
7 |
8 | $message .= "📢 {$payload->object_attributes->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/issue/open.php:
--------------------------------------------------------------------------------
1 | New Issue to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->id} created by {$payload->user->name}\n\n";
7 |
8 | $message .= "📢 {$payload->object_attributes->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/note/commit.php:
--------------------------------------------------------------------------------
1 | New Comment on Commit - 🦊object_attributes->url}\">{$payload->project->path_with_namespace} by {$payload->user->name}\n\n";
7 |
8 | $message .= "⚙️ {$payload->commit->message} \n\n";
9 |
10 | $message .= "🔗 View Comment: object_attributes->url}\">{$payload->commit->id} \n\n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/workflow_run/requested.php:
--------------------------------------------------------------------------------
1 | Workflow Requested form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
7 |
8 | $message .= "Running workflow: 💥 {$payload->workflow_run->name} ⏳\n\n";
9 |
10 | // $message .= "📤 Commit: {$payload->workflow_run->head_commit->message}\n\n";
11 |
12 | $message .= "🔗 Link: workflow_run->html_url}\">{$payload->workflow_run->html_url}\n\n";
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/issue/update.php:
--------------------------------------------------------------------------------
1 | Issue has been edited to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->id} by {$payload->user->name}\n\n";
7 |
8 | $message .= "📢 {$payload->object_attributes->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/ping/default.php:
--------------------------------------------------------------------------------
1 | Connection Successful\n\n";
7 |
8 | if (isset($payload->organization)) {
9 | $message .= "🏢 Organization: {$payload->organization->login}\n";
10 | }
11 |
12 | if (isset($payload->repository)) {
13 | $message .= "📦 Repository: 🦑{$payload->repository->full_name}\n";
14 | }
15 |
16 | if (isset($payload->sender)) {
17 | $message .= "👤 Sender (triggered the event): {$payload->sender->login}\n";
18 | }
19 |
20 | echo $message;
21 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/issue/reopen.php:
--------------------------------------------------------------------------------
1 | Issue has been reopened ⚠️ to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->id} by {$payload->user->name}\n\n";
7 |
8 | $message .= "📢 {$payload->object_attributes->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/tag_push/default.php:
--------------------------------------------------------------------------------
1 | ref);
7 | $tag = implode('/', array_slice($ref, 2));
8 |
9 | $tagUrl = $payload->project->web_url . '/tags/' . $tag;
10 |
11 | $message = "⚙️ A new tag has been pushed to the project 🦊project->web_url}\">{$payload->project->path_with_namespace}\n\n";
12 |
13 | $message .= "🔖 Tag: {$tag}\n\n";
14 |
15 | $message .= "👤 Pushed by : {$payload->user_name}\n";
16 |
17 | echo $message;
18 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/opened.php:
--------------------------------------------------------------------------------
1 | New Issue to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by issue->user->html_url}\">@{$payload->issue->user->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/tools/custom_event.php:
--------------------------------------------------------------------------------
1 |
11 | Go to check the = $platform ?> documentation for more information about events.
12 | ---
13 | Click and configure child events if the option has the ⚙ icon.
14 | And select an event to enable or disable notifications:
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/closed.php:
--------------------------------------------------------------------------------
1 | Issue Closed to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by issue->user->html_url}\">@{$payload->issue->user->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/pull_request_review/submitted.php:
--------------------------------------------------------------------------------
1 | New Pull Request Review Comment 💬 - 🦑pull_request->html_url}\">{$payload->repository->full_name}#{$payload->pull_request->number} by review->user->html_url}\">@{$payload->review->user->login}\n\n";
7 |
8 | $message .= "🛠 {$payload->pull_request->title} \n\n";
9 |
10 | $message .= "🔗 Link: review->html_url}\">{$payload->review->html_url}\n\n";
11 |
12 | echo $message;
13 |
--------------------------------------------------------------------------------
/resources/views/events/github/pull_request_review/dismissed.php:
--------------------------------------------------------------------------------
1 | Dismissed Pull Request Review Comment 💬 - 🦑pull_request->html_url}\">{$payload->repository->full_name}#{$payload->pull_request->number} by review->user->html_url}\">@{$payload->review->user->login}\n\n";
7 |
8 | $message .= "🛠 {$payload->pull_request->title} \n\n";
9 |
10 | $message .= "🔗 Link: review->html_url}\">{$payload->review->html_url}\n\n";
11 |
12 | echo $message;
13 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/reopened.php:
--------------------------------------------------------------------------------
1 | Issue has been reopened ⚠️ to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by issue->user->html_url}\">@{$payload->issue->user->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/resources/views/events/github/issue_comment/deleted.php:
--------------------------------------------------------------------------------
1 | Issue Comment Deleted 💬 from 🦑repository->html_url}\">{$payload->repository->full_name} by sender->html_url}\">@{$payload->sender->login}\n\n";
9 |
10 | $message .= "📢 {$payload->issue->title}\n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
15 |
16 | echo $message;
17 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/note/merge_request.php:
--------------------------------------------------------------------------------
1 | New Comment on Merge Request - 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->merge_request->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->merge_request->title} \n";
9 |
10 | $message .= "🌳 {$payload->merge_request->source_branch} -> {$payload->merge_request->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
13 |
14 | echo $message;
15 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | ; This is the top-most EditorConfig file, which is not inherited by any other files.
2 | ; This file is used for unify the coding style for different editors and IDEs.
3 | ; More information at https://editorconfig.org
4 |
5 | root = true
6 |
7 | [*]
8 | charset = utf-8
9 | end_of_line = lf
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
14 | [*.yml]
15 | indent_style = space
16 |
17 | [*.php]
18 | ij_php_concat_spaces = true
19 | ij_php_phpdoc_param_spaces_between_name_and_description = 1
20 | ij_php_phpdoc_param_spaces_between_tag_and_type = 1
21 | ij_php_phpdoc_param_spaces_between_type_and_name = 1
22 |
--------------------------------------------------------------------------------
/resources/views/events/github/issue_comment/created.php:
--------------------------------------------------------------------------------
1 | New Issue Comment ⚠️ to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by comment->user->html_url}\">@{$payload->comment->user->login}\n\n";
9 |
10 | $message .= "📢 {$payload->issue->title}\n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
15 |
16 | echo $message;
17 |
--------------------------------------------------------------------------------
/resources/views/events/github/issue_comment/edited.php:
--------------------------------------------------------------------------------
1 | Issue Comment Edited 💬 in 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by comment->user->html_url}\">@{$payload->comment->user->login}\n\n";
9 |
10 | $message .= "📢 {$payload->issue->title}\n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
15 |
16 | echo $message;
17 |
--------------------------------------------------------------------------------
/.docker/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG PHP_VERSION_SELECTED=8.2
2 |
3 | FROM php:${PHP_VERSION_SELECTED}-fpm
4 |
5 | RUN apt-get update && apt-get install -y --no-install-recommends \
6 | git \
7 | nano \
8 | libpng-dev \
9 | libonig-dev \
10 | libzip-dev \
11 | && rm -r /var/lib/apt/lists/* \
12 | && docker-php-ext-install -j$(nproc) \
13 | zip \
14 | pcntl
15 |
16 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
17 | COPY --from=composer/composer /usr/bin/composer /usr/local/bin/composer
18 |
19 | WORKDIR /var/www/html
20 |
21 | EXPOSE 80
22 |
23 | CMD ["php-fpm"]
24 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 | getMessage());
17 | }
18 |
--------------------------------------------------------------------------------
/src/Traits/Markup.php:
--------------------------------------------------------------------------------
1 | buildInlineKeyBoardButton('🗨 Discussion', config('telegram-git-notifier.author.discussion')),
19 | ], [
20 | $telegram->buildInlineKeyBoardButton('💠 Source Code', config('telegram-git-notifier.author.source_code')),
21 | ],
22 | ];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.github/workflows/php-cs-fixer.yml:
--------------------------------------------------------------------------------
1 | name: Check & fix styling
2 |
3 | on: [push]
4 |
5 | permissions:
6 | contents: write
7 |
8 | jobs:
9 | php-cs-fixer:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Checkout code
14 | uses: actions/checkout@v4
15 | with:
16 | ref: ${{ github.head_ref }}
17 |
18 | - name: Run PHP CS Fixer
19 | uses: docker://oskarstark/php-cs-fixer-ga
20 | with:
21 | args: --config=.php-cs-fixer.dist.php --allow-risky=yes
22 |
23 | - name: Commit changes
24 | uses: stefanzweifel/git-auto-commit-action@v5
25 | with:
26 | commit_message: Fix styling
27 |
--------------------------------------------------------------------------------
/resources/views/events/github/push/default.php:
--------------------------------------------------------------------------------
1 | commits);
7 | $noun = ($count > 1) ? "commits" : "commit";
8 |
9 | $ref = explode('/', $payload->ref);
10 | $branch = implode('/', array_slice($ref, 2));
11 |
12 | $message = "⚙️ {$count} new {$noun} to 🦑{$payload->repository->full_name}:{$branch}\n\n";
13 |
14 | foreach ($payload->commits as $commit) {
15 | $commitId = substr($commit->id, -7);
16 | $message .= "url}\">{$commitId}: {$commit->message} - by {$commit->author->name}\n";
17 | }
18 |
19 | $message .= "\n👤 Pushed by : {$payload->pusher->name}\n";
20 |
21 | echo $message;
22 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/push/default.php:
--------------------------------------------------------------------------------
1 | commits);
7 | $noun = ($count > 1) ? "commits" : "commit";
8 |
9 | $ref = explode('/', $payload->ref);
10 | $branch = implode('/', array_slice($ref, 2));
11 |
12 | $message = "⚙️ {$count} new {$noun} to 🦊{$payload->project->path_with_namespace}:{$branch}\n\n";
13 |
14 | foreach ($payload->commits as $commit) {
15 | $commitId = substr($commit->id, -7);
16 | $message .= "url}\">{$commitId}: {$commit->message} - by {$commit->author->name}\n";
17 | }
18 |
19 | $message .= "\n👤 Pushed by : {$payload->user_name}\n";
20 |
21 | echo $message;
22 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/close.php:
--------------------------------------------------------------------------------
1 | Close Merge Request - 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/.github/workflows/setup_test.yml:
--------------------------------------------------------------------------------
1 | name: Setup & test
2 |
3 | on: [ push, pull_request ]
4 |
5 | jobs:
6 | tests:
7 | name: Composer P${{ matrix.php }} - ${{ matrix.os }}
8 | runs-on: ${{ matrix.os }}
9 | strategy:
10 | matrix:
11 | os: [ ubuntu-latest ]
12 | php: [ '8.1', '8.2', '8.3' ]
13 | steps:
14 | - name: Setup PHP
15 | uses: shivammathur/setup-php@v2
16 | with:
17 | php-version: ${{ matrix.php }}
18 |
19 | - name: Checkout code
20 | uses: actions/checkout@v4
21 |
22 | - name: Install dependencies
23 | run: |
24 | composer install --no-interaction --no-progress --no-suggest
25 |
26 | - name: Run tests
27 | run: |
28 | composer validate --strict
29 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/merge.php:
--------------------------------------------------------------------------------
1 | Merge Request Merged to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/unapproved.php:
--------------------------------------------------------------------------------
1 | Close Merge Request - 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/approved.php:
--------------------------------------------------------------------------------
1 | Merge Request Approved to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/open.php:
--------------------------------------------------------------------------------
1 | Merge Request Opened to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/update.php:
--------------------------------------------------------------------------------
1 | Merge Request Updated to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/reopen.php:
--------------------------------------------------------------------------------
1 | Merge Request Reopened to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/merge_request/unapproval.php:
--------------------------------------------------------------------------------
1 | Merge Request Unapproved to 🦊object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid} by {$payload->user->name}\n\n";
7 |
8 | $message .= "🛠 {$payload->object_attributes->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/github/workflow_job/completed.php:
--------------------------------------------------------------------------------
1 | workflow_job->conclusion === 'success') {
7 | $message = "🎉 Action Completed form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
8 |
9 | $message .= "Done action: 🎉 {$payload->workflow_job->runner_name} ✨ \n\n";
10 | } else {
11 | $message = "🚫 Canceled Action form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
12 |
13 | $message .= "Failed action: 🚫 {$payload->workflow_job->runner_name} ❌ \n\n";
14 | }
15 |
16 | $message .= "🔗 Link: workflow_job->html_url}\">{$payload->workflow_job->html_url}\n\n";
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/gitlab/feature_flag/default.php:
--------------------------------------------------------------------------------
1 | object_attributes->active) {
7 | $active = "Enabled";
8 | $icon = "🚩";
9 | } else {
10 | $active = "Disabled";
11 | $icon = "🏴";
12 | }
13 |
14 | $flagUrl = $payload->project->web_url . "/-/feature_flags/" . $payload->object_attributes->id;
15 |
16 | $message = "{$icon} Feature Flag {$active} - 🦊{$payload->project->path_with_namespace}#{$payload->object_attributes->name} by user_url}\">{$payload->user->name}\n\n";
17 |
18 | $message .= "{$icon} Name: {$payload->object_attributes->name} \n\n";
19 |
20 | $message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
21 |
22 | echo $message;
23 |
--------------------------------------------------------------------------------
/resources/views/events/github/pull_request/opened.php:
--------------------------------------------------------------------------------
1 | New Pull Request - 🦑pull_request->html_url}\">{$payload->repository->full_name}#{$payload->pull_request->number} create by pull_request->user->html_url}\">@{$payload->pull_request->user->login}\n\n";
7 |
8 | $message .= "🛠 {$payload->pull_request->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->pull_request->head->ref} -> {$payload->pull_request->base->ref} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/resources/views/events/github/pull_request/reopened.php:
--------------------------------------------------------------------------------
1 | Reopened Pull Request - 🦑pull_request->html_url}\">{$payload->repository->full_name}#{$payload->pull_request->number} by pull_request->user->html_url}\">@{$payload->pull_request->user->login}\n\n";
7 |
8 | $message .= "🛠 {$payload->pull_request->title} \n\n";
9 |
10 | $message .= "🌳 {$payload->pull_request->head->ref} -> {$payload->pull_request->base->ref} 🎯 \n";
11 |
12 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
13 |
14 | $message .= require __DIR__ . '/partials/_reviewers.php';
15 |
16 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
17 |
18 | echo $message;
19 |
--------------------------------------------------------------------------------
/.github/workflows/phpstan.yml:
--------------------------------------------------------------------------------
1 | name: PHPStan
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | phpstan:
7 | runs-on: ubuntu-latest
8 | name: PHPStan - P${{ matrix.php }}
9 |
10 | strategy:
11 | matrix:
12 | os: [ ubuntu-latest ]
13 | php: [ '8.1', '8.2', '8.3' ]
14 |
15 | steps:
16 | - uses: actions/checkout@v4
17 |
18 | - name: Setup PHP
19 | uses: shivammathur/setup-php@2.26.0
20 | with:
21 | php-version: ${{ matrix.php }}
22 |
23 | - name: Checkout code
24 | uses: actions/checkout@v4
25 |
26 | - name: Install dependencies
27 | run: |
28 | composer install --no-interaction --no-progress --no-suggest
29 |
30 | - name: Run PHPStan
31 | run: |
32 | composer analyse --error-format=github
33 |
--------------------------------------------------------------------------------
/.github/workflows/update-changelog.yml:
--------------------------------------------------------------------------------
1 | name: Update Changelog
2 |
3 | on:
4 | release:
5 | types: [released]
6 |
7 | permissions:
8 | contents: write
9 |
10 | jobs:
11 | update:
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - name: Checkout code
16 | uses: actions/checkout@v4
17 | with:
18 | ref: main
19 |
20 | - name: Update Changelog
21 | uses: stefanzweifel/changelog-updater-action@v1
22 | with:
23 | latest-version: ${{ github.event.release.name }}
24 | release-notes: ${{ github.event.release.body }}
25 |
26 | - name: Commit updated CHANGELOG
27 | uses: stefanzweifel/git-auto-commit-action@v5
28 | with:
29 | branch: main
30 | commit_message: Update CHANGELOG for ${{ github.event.release.name }}
31 | file_pattern: CHANGELOG.md
32 |
--------------------------------------------------------------------------------
/resources/views/events/github/issues/edited.php:
--------------------------------------------------------------------------------
1 | Issue has been edited to 🦑issue->html_url}\">{$payload->repository->full_name}#{$payload->issue->number} by issue->user->html_url}\">@{$payload->issue->user->login}\n\n";
7 |
8 | $message .= "📢 {$payload->issue->title}\n";
9 |
10 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
11 |
12 | if (isset($payload->changes->title)) {
13 | $message .= "📖 Title has been changed\n";
14 | $message .= " 📝 From: {$payload->changes->title->from}\n";
15 | $message .= " 🏷 To: {$payload->issue->title}\n";
16 | } elseif (isset($payload->changes->body)) {
17 | $message .= "📖 Body has been changed\n";
18 | $message .= "Please check the issue for more details\n";
19 | }
20 |
21 | echo $message;
22 |
--------------------------------------------------------------------------------
/resources/views/tools/usage.php:
--------------------------------------------------------------------------------
1 | Adding webhook (Web Address) to GitHub repositories 🦑
2 |
3 | 1) Redirect to Repository Settings->Webhooks->Add Webhook.
4 | 2) Set your Payload URL.
5 | 3) Set content type to "application/x-www-form-urlencoded".
6 | 4) Choose events would you like to trigger in this webhook.
7 | (Recommended: Let me select individual events, and choose any events you want).
8 | 5) Check Active checkbox. And click Add Webhook.
9 |
10 | ----------
11 | Adding webhook (Web Address) to GitLab repositories 🦊
12 |
13 | 1) Redirect to Repository Settings->Webhooks->Add new webhook.
14 | 2) Set your Payload URL.
15 | 3) Choose events would you like to trigger in this webhook.
16 | 4) Check Enable SSL verification if you are using SSL. And click Add Webhook.
17 |
18 | That it. you will receive all notifications through me 🤗
19 |
--------------------------------------------------------------------------------
/resources/views/events/shared/partials/gitlab/_body.php:
--------------------------------------------------------------------------------
1 | object_attributes->description)) {
8 | $body = $payload->object_attributes->description;
9 | } elseif (!empty($payload->object_attributes->content)) {
10 | $body = $payload->object_attributes->content;
11 | } elseif (!empty($payload->object_attributes->note)) {
12 | $body = $payload->object_attributes->note;
13 | } elseif (!empty($payload->object_attributes->body)) {
14 | $body = $payload->object_attributes->body;
15 | } elseif (!empty($payload->description)) {
16 | $body = $payload->description;
17 | } else {
18 | return '';
19 | }
20 | if (strlen($body) > 50) {
21 | $body = substr($body, 0, 50) . '...';
22 | }
23 | return "📖 Content:\n{$body}";
24 | }
25 |
26 | return '';
27 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.9'
2 |
3 | networks:
4 | telegram-git-notifier:
5 |
6 | services:
7 | server:
8 | build:
9 | context: .
10 | args:
11 | - PHP_VERSION_SELECTED=${PHP_VERSION_SELECTED:-8.2}
12 | dockerfile: ./.docker/Dockerfile
13 | container_name: '${CONTAINER_NAME:-telegram-git-notifier}-server'
14 | volumes:
15 | - ./:/var/www/html
16 | - ./.docker/config/php/php.ini:/usr/local/etc/php/conf.d/extra-php-config.ini
17 | user: '${USER_ID:-1000}:${GROUP_ID:-1000}'
18 | networks:
19 | - telegram-git-notifier
20 |
21 | nginx:
22 | image: nginx:alpine
23 | container_name: '${CONTAINER_NAME:-telegram-git-notifier}-nginx'
24 | ports:
25 | - '${APP_PORT:-1080}:80'
26 | volumes:
27 | - ./:/var/www/html
28 | - ./.docker/conf.d/:/etc/nginx/conf.d/
29 | - ./.docker/log/nginx:/var/log/nginx/
30 | depends_on:
31 | - server
32 | networks:
33 | - telegram-git-notifier
34 |
--------------------------------------------------------------------------------
/resources/views/events/github/pull_request/closed.php:
--------------------------------------------------------------------------------
1 | Pull Request Merged';
7 | if (!isset($payload->pull_request->merged) || $payload->pull_request->merged !== true) {
8 | $message = '❌ Pull Request Closed';
9 | }
10 |
11 | $message = $message . " - 🦑pull_request->html_url}\">{$payload->repository->full_name}#{$payload->pull_request->number} by pull_request->user->html_url}\">@{$payload->pull_request->user->login}\n\n";
12 |
13 | $message .= "🛠 {$payload->pull_request->title} \n\n";
14 |
15 | $message .= "🌳 {$payload->pull_request->head->ref} -> {$payload->pull_request->base->ref} 🎯 \n";
16 |
17 | $message .= require __DIR__ . '/../../shared/partials/github/_assignees.php';
18 |
19 | $message .= require __DIR__ . '/partials/_reviewers.php';
20 |
21 | $message .= require __DIR__ . '/../../shared/partials/github/_body.php';
22 |
23 | echo $message;
24 |
--------------------------------------------------------------------------------
/.scrutinizer.yml:
--------------------------------------------------------------------------------
1 | build:
2 | nodes:
3 | analysis:
4 | project_setup:
5 | override: true
6 | tests:
7 | override: [ php-scrutinizer-run ]
8 | environment:
9 | php:
10 | version: 8.0
11 |
12 | checks:
13 | php:
14 | code_rating: true
15 | remove_extra_empty_lines: true
16 | remove_php_closing_tag: true
17 | remove_trailing_whitespace: true
18 | fix_use_statements:
19 | remove_unused: true
20 | preserve_multiple: false
21 | preserve_blanklines: true
22 | order_alphabetically: true
23 | fix_php_opening_tag: true
24 | fix_linefeed: true
25 | fix_line_ending: true
26 | fix_identation_4spaces: true
27 | fix_doc_comments: true
28 |
29 | tools:
30 | php_analyzer: true
31 | php_code_coverage: true
32 | php_code_sniffer:
33 | config:
34 | standard: PSR4
35 | filter:
36 | paths: [ 'src' ]
37 | php_loc:
38 | enabled: true
39 | excluded_dirs: [ vendor ]
40 | php_cpd:
41 | enabled: true
42 | excluded_dirs: [ vendor ]
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 CSlant
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.docker/conf.d/site.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name telegram-git-notifier.com;
4 |
5 | error_log /var/log/nginx/telegram-git-notifier-error.log;
6 | access_log /var/log/nginx/telegram-git-notifier-access.log;
7 |
8 | root /var/www/html/;
9 | index index.php index.html index.htm;
10 |
11 | location / {
12 | try_files $uri $uri/ /index.php?$query_string;
13 | gzip_static on;
14 | }
15 |
16 | client_body_timeout 180s;
17 | client_max_body_size 16M;
18 |
19 | location ~ \.php$ {
20 | try_files $uri =404;
21 | fastcgi_split_path_info ^(.+\.php)(/.+)$;
22 | fastcgi_pass server:9000;
23 | fastcgi_index index.php;
24 | include fastcgi_params;
25 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
26 | fastcgi_param PATH_INFO $fastcgi_path_info;
27 |
28 | fastcgi_temp_file_write_size 10m;
29 | fastcgi_intercept_errors off;
30 | fastcgi_buffer_size 16k;
31 | fastcgi_buffers 16 512k;
32 | fastcgi_connect_timeout 300;
33 | fastcgi_send_timeout 300;
34 | fastcgi_read_timeout 300;
35 | }
36 |
37 | location ~ /\.ht {
38 | deny all;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Http/Actions/WebhookAction.php:
--------------------------------------------------------------------------------
1 | webhook = new Webhook();
17 | $this->webhook->setToken(config('telegram-git-notifier.bot.token'));
18 | $this->webhook->setUrl(config('telegram-git-notifier.app.url'));
19 | }
20 |
21 | /**
22 | * Set webhook for telegram bot
23 | *
24 | * @return string
25 | * @throws WebhookException
26 | */
27 | public function set(): string
28 | {
29 | return $this->webhook->setWebhook();
30 | }
31 |
32 | /**
33 | * Delete webhook for telegram bot
34 | *
35 | * @return string
36 | * @throws WebhookException
37 | */
38 | public function delete(): string
39 | {
40 | return $this->webhook->deleteWebHook();
41 | }
42 |
43 | /**
44 | * Get webhook update
45 | *
46 | * @return string
47 | * @throws WebhookException
48 | */
49 | public function getUpdates(): string
50 | {
51 | return $this->webhook->getUpdates();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/.php-cs-fixer.dist.php:
--------------------------------------------------------------------------------
1 | in([
5 | __DIR__ . '/src',
6 | __DIR__ . '/webhook',
7 | ])
8 | ->name('*.php')
9 | ->ignoreDotFiles(true)
10 | ->ignoreVCS(true);
11 |
12 | return (new PhpCsFixer\Config())
13 | ->setRules([
14 | '@PSR12' => true,
15 | 'array_syntax' => ['syntax' => 'short'],
16 | 'ordered_imports' => ['sort_algorithm' => 'alpha'],
17 | 'no_unused_imports' => true,
18 | 'trailing_comma_in_multiline' => true,
19 | 'phpdoc_scalar' => true,
20 | 'unary_operator_spaces' => true,
21 | 'binary_operator_spaces' => true,
22 | 'blank_line_before_statement' => [
23 | 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
24 | ],
25 | 'phpdoc_single_line_var_spacing' => true,
26 | 'phpdoc_var_without_name' => true,
27 | 'class_attributes_separation' => [
28 | 'elements' => [
29 | 'method' => 'one',
30 | ],
31 | ],
32 | 'method_argument_space' => [
33 | 'on_multiline' => 'ensure_fully_multiline',
34 | 'keep_multiple_spaces_after_comma' => true,
35 | ],
36 | 'single_trait_insert_per_statement' => true,
37 | ])
38 | ->setFinder($finder);
39 |
--------------------------------------------------------------------------------
/resources/views/events/github/workflow_run/completed.php:
--------------------------------------------------------------------------------
1 | workflow_run->conclusion) {
7 | case 'success':
8 | $message = "🎉 Workflow Completed form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
9 |
10 | $message .= "Done workflow: 🎉 {$payload->workflow_run->name} ✨ \n\n";
11 | break;
12 | case 'failure':
13 | $message = "🚫 Workflow Failed form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
14 |
15 | $message .= "Failed workflow: 🚫 {$payload->workflow_run->name} ❌ \n\n";
16 | break;
17 | case 'cancelled':
18 | $message = "❌ Workflow Cancelled form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
19 |
20 | $message .= "Cancelled workflow: 🚨 {$payload->workflow_run->name} ❌ \n\n";
21 | break;
22 | default:
23 | $message = "🚨 Workflow Can't Success form 🦑repository->html_url}\">{$payload->repository->full_name}\n\n";
24 |
25 | $message .= "Can't Success workflow: 🚨 {$payload->workflow_run->name} ❌ \n\n";
26 | break;
27 | }
28 |
29 | // $message .= "📤 Commit: {$payload->workflow_run->head_commit->message}\n\n";
30 |
31 | $message .= "🔗 Link: workflow_run->html_url}\">{$payload->workflow_run->html_url}\n\n";
32 |
33 | echo $message;
34 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | TGN_APP_NAME='Telegram Git Notify'
2 |
3 | # Set your app url here (Required for the bot to work properly)
4 | TGN_APP_URL=https://152.132.127.172:3000
5 |
6 | TELEGRAM_BOT_TOKEN="###########:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
7 | TELEGRAM_BOT_CHAT_ID="##########"
8 |
9 | # Set the chat ids that will receive notifications here.
10 | # You can add the owner bot id, group id, ...
11 | # -------------------------------------------------------
12 | # Note:
13 | # Please use semicolon ";" to separate chat ids
14 | # And use colon ":" to separate chat id and thread id
15 | # And use comma "," if you want to add multiple thread ids
16 | # -------------------------------------------------------
17 | # The environment variable is expected to be in the format:
18 | # "chat_id1;chat_id2:thread_id2;chat_id3:thread_id3_1,thread_id3_2;..."
19 | TELEGRAM_NOTIFY_CHAT_IDS="-###########1;-############2:######2;-############3:######1,######2"
20 |
21 | # Docker
22 | PHP_VERSION_SELECTED=8.2
23 | CONTAINER_NAME=telegram-git-notifier
24 | APP_PORT=3000
25 |
26 |
27 | # -----------------------------------------------------
28 | # --------------------- Optional ----------------------
29 | # Please change or comment if you want to use default.
30 | # Note: Don't set blank value
31 | # -----------------------------------------------------
32 |
33 | #TGN_PATH_SETTING=
34 | #TGN_PATH_PLATFORM_GITLAB=
35 | #TGN_PATH_PLATFORM_GITHUB=
36 |
37 | #TGN_VIEW_PATH=
38 | #TGN_VIEW_EVENT_DEFAULT=
39 |
40 | #TGN_VIEW_GLOBALS_ACCESS_DENIED=
41 |
42 | #TGN_VIEW_TOOL_SETTING=
43 | #TGN_VIEW_TOOL_CUSTOM_EVENT_ACTION=
44 | #TGN_VIEW_TOOL_CUSTOM_EVENT=
45 | #TGN_VIEW_TOOL_SET_MENU_COMMAND=
46 |
47 | TIMEZONE=Asia/Ho_Chi_Minh
48 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cslant/telegram-git-notifier-app",
3 | "description": "The PHP app to send notification from Gitlab and Github events to Telegram",
4 | "keywords": [
5 | "cslant",
6 | "telegram-bot",
7 | "notify",
8 | "git-webhook",
9 | "telegram-notifier",
10 | "telegram-git-notifier",
11 | "github-notifier",
12 | "gitlab-notifier",
13 | "github-telegram-bot",
14 | "gitlab-telegram-bot",
15 | "telegram-bot-github-notify",
16 | "telegram-bot-gitlab-notify",
17 | "telegram-git-notifier-app"
18 | ],
19 | "type": "project",
20 | "homepage": "https://github.com/cslant/telegram-git-notifier-app",
21 | "license": "MIT",
22 | "require": {
23 | "php": "^8.1",
24 | "ext-json": "*",
25 | "cslant/telegram-git-notifier": "^1.3.1"
26 | },
27 | "require-dev": {
28 | "friendsofphp/php-cs-fixer": "^v3.37.1",
29 | "phpstan/phpstan": "^1.10.39"
30 | },
31 | "autoload": {
32 | "psr-4": {
33 | "CSlant\\TelegramGitNotifierApp\\": "src/"
34 | }
35 | },
36 | "authors": [
37 | {
38 | "name": "Tan Nguyen",
39 | "email": "tannp27@gmail.com",
40 | "homepage": "https://tanhongit.com",
41 | "role": "Lead"
42 | }
43 | ],
44 | "support": {
45 | "issues": "https://github.com/cslant/telegram-git-notifier-app/issues"
46 | },
47 | "config": {
48 | "sort-packages": true,
49 | "optimize-autoloader": true
50 | },
51 | "scripts": {
52 | "analyse": "vendor/bin/phpstan",
53 | "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
54 | "post-install-cmd": [
55 | "bash vendor/cslant/telegram-git-notifier/install.sh"
56 | ],
57 | "post-update-cmd": [
58 | "bash vendor/cslant/telegram-git-notifier/install.sh"
59 | ]
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/Http/Actions/IndexAction.php:
--------------------------------------------------------------------------------
1 | client = new Client();
37 |
38 | $telegram = new Telegram(config('telegram-git-notifier.bot.token'));
39 | $this->bot = new Bot($telegram);
40 | $this->notifier = new Notifier();
41 | }
42 |
43 | /**
44 | * Handle telegram git notifier app
45 | *
46 | * @return void
47 | * @throws EntryNotFoundException
48 | * @throws InvalidViewTemplateException
49 | * @throws MessageIsEmptyException
50 | * @throws SendNotificationException
51 | * @throws BotException
52 | * @throws CallbackException
53 | */
54 | public function __invoke(): void
55 | {
56 | if ($this->bot->isCallback()) {
57 | $callbackAction = new CallbackService($this->bot);
58 | $callbackAction->handle();
59 |
60 | return;
61 | }
62 |
63 | if ($this->bot->isMessage() && $this->bot->isOwner()) {
64 | $commandAction = new CommandService($this->bot);
65 | $commandAction->handle();
66 |
67 | return;
68 | }
69 |
70 | $sendNotification = new NotificationService($this->notifier, $this->bot->setting);
71 | $sendNotification->handle();
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/Services/CommandService.php:
--------------------------------------------------------------------------------
1 | '/start',
18 | 'description' => 'Welcome to the bot',
19 | ], [
20 | 'command' => '/menu',
21 | 'description' => 'Show menu of the bot',
22 | ], [
23 | 'command' => '/token',
24 | 'description' => 'Show token of the bot',
25 | ], [
26 | 'command' => '/id',
27 | 'description' => 'Show the ID of the current chat',
28 | ], [
29 | 'command' => '/usage',
30 | 'description' => 'Show step by step usage',
31 | ], [
32 | 'command' => '/server',
33 | 'description' => 'To get Server Information',
34 | ], [
35 | 'command' => '/settings',
36 | 'description' => 'Go to settings of the bot',
37 | ],
38 | ];
39 |
40 | private Bot $bot;
41 |
42 | public function __construct(Bot $bot)
43 | {
44 | $this->bot = $bot;
45 | }
46 |
47 | /**
48 | * @param Bot $bot
49 | *
50 | * @return void
51 | * @throws EntryNotFoundException
52 | */
53 | public function sendStartMessage(Bot $bot): void
54 | {
55 | $reply = view(
56 | 'tools.start',
57 | ['first_name' => $bot->telegram->FirstName()]
58 | );
59 | $bot->sendPhoto(
60 | __DIR__ . '/../../resources/images/start.png',
61 | ['caption' => $reply]
62 | );
63 | }
64 |
65 | /**
66 | * @return void
67 | * @throws EntryNotFoundException
68 | * @throws MessageIsEmptyException
69 | */
70 | public function handle(): void
71 | {
72 | $text = $this->bot->telegram->Text();
73 |
74 | switch ($text) {
75 | case '/start':
76 | $this->sendStartMessage($this->bot);
77 |
78 | break;
79 | case '/menu':
80 | $this->bot->sendMessage(
81 | view('tools.menu'),
82 | ['reply_markup' => $this->menuMarkup($this->bot->telegram)]
83 | );
84 |
85 | break;
86 | case '/token':
87 | case '/id':
88 | case '/usage':
89 | case '/server':
90 | $this->bot->sendMessage(view('tools.' . trim($text, '/')));
91 |
92 | break;
93 | case '/settings':
94 | $this->bot->settingHandle();
95 |
96 | break;
97 | case '/set_menu':
98 | $this->bot->setMyCommands(CommandService::MENU_COMMANDS);
99 |
100 | break;
101 | default:
102 | $this->bot->sendMessage('🤨 Invalid Request!');
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/Services/NotificationService.php:
--------------------------------------------------------------------------------
1 | request = Request::createFromGlobals();
28 | $this->notifier = $notifier;
29 | $this->chatIds = $this->notifier->parseNotifyChatIds();
30 |
31 | $this->setting = $setting;
32 | }
33 |
34 | /**
35 | * Handle to send notification from webhook event to telegram
36 | *
37 | * @return void
38 | * @throws InvalidViewTemplateException
39 | * @throws SendNotificationException
40 | * @throws MessageIsEmptyException
41 | */
42 | public function handle(): void
43 | {
44 | $eventName = $this->notifier->handleEventFromRequest($this->request);
45 | if (!empty($eventName)) {
46 | $this->sendNotification($eventName);
47 | }
48 | }
49 |
50 | /**
51 | * @param string $event
52 | *
53 | * @return void
54 | * @throws InvalidViewTemplateException
55 | * @throws SendNotificationException
56 | * @throws MessageIsEmptyException
57 | */
58 | private function sendNotification(string $event): void
59 | {
60 | if (!$this->validateAccessEvent($event)) {
61 | return;
62 | }
63 |
64 | foreach ($this->chatIds as $chatId => $thread) {
65 | if (empty($chatId)) {
66 | continue;
67 | }
68 |
69 | if (empty($thread)) {
70 | $this->notifier->sendNotify(null, ['chat_id' => $chatId]);
71 |
72 | continue;
73 | }
74 |
75 | foreach ($thread as $threadId) {
76 | $this->notifier->sendNotify(null, [
77 | 'chat_id' => $chatId, 'message_thread_id' => $threadId,
78 | ]);
79 | }
80 | }
81 | }
82 |
83 | /**
84 | * Validate access event
85 | *
86 | * @param string $event
87 | *
88 | * @return bool
89 | * @throws InvalidViewTemplateException|MessageIsEmptyException
90 | */
91 | private function validateAccessEvent(string $event): bool
92 | {
93 | $payload = $this->notifier->setPayload($this->request, $event);
94 | $validator = new Validator($this->setting, $this->notifier->event);
95 |
96 | if (empty($payload)
97 | || !$validator->isAccessEvent(
98 | $this->notifier->event->platform,
99 | $event,
100 | $payload
101 | )
102 | ) {
103 | return false;
104 | }
105 |
106 | return true;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/Services/CallbackService.php:
--------------------------------------------------------------------------------
1 | bot = $bot;
22 | }
23 |
24 | /**
25 | * Answer the back button
26 | *
27 | * @param string $callback
28 | *
29 | * @return void
30 | * @throws MessageIsEmptyException
31 | * @throws BotException
32 | * @throws CallbackException
33 | */
34 | public function answerBackButton(string $callback): void
35 | {
36 | $callback = str_replace(SettingConstant::SETTING_BACK, '', $callback);
37 |
38 | switch ($callback) {
39 | case 'settings':
40 | $view = view('tools.settings');
41 | $markup = $this->bot->settingMarkup();
42 |
43 | break;
44 | case 'settings.custom_events.github':
45 | $view = view('tools.custom_event', ['platform' => 'github']);
46 | $markup = $this->bot->eventMarkup();
47 |
48 | break;
49 | case 'settings.custom_events.gitlab':
50 | $view = view('tools.custom_event', ['platform' => 'gitlab']);
51 | $markup = $this->bot->eventMarkup(null, 'gitlab');
52 |
53 | break;
54 | case 'menu':
55 | $view = view('tools.menu');
56 | $markup = $this->menuMarkup($this->bot->telegram);
57 |
58 | break;
59 | default:
60 | $this->bot->answerCallbackQuery('Unknown callback');
61 |
62 | return;
63 | }
64 |
65 | $this->bot->editMessageText($view, [
66 | 'reply_markup' => $markup,
67 | ]);
68 | }
69 |
70 | /**
71 | * @return void
72 | * @throws MessageIsEmptyException
73 | * @throws InvalidViewTemplateException
74 | * @throws BotException|CallbackException
75 | */
76 | public function handle(): void
77 | {
78 | $callback = $this->bot->telegram->Callback_Data();
79 |
80 | if (str_contains($callback, SettingConstant::SETTING_CUSTOM_EVENTS)) {
81 | $this->bot->eventHandle($callback);
82 |
83 | return;
84 | }
85 |
86 | if (str_contains($callback, SettingConstant::SETTING_BACK)) {
87 | $this->answerBackButton($callback);
88 |
89 | return;
90 | }
91 |
92 | $callback = str_replace(SettingConstant::SETTING_PREFIX, '', $callback);
93 |
94 | $settings = $this->bot->setting->getSettings();
95 | if (array_key_exists($callback, $settings)
96 | && $this->bot->setting->updateSetting(
97 | $callback,
98 | !$settings[$callback]
99 | )
100 | ) {
101 | $this->bot->editMessageReplyMarkup([
102 | 'reply_markup' => $this->bot->settingMarkup(),
103 | ]);
104 | } else {
105 | $this->bot->answerCallbackQuery('Something went wrong!');
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | Here you can see the full list of changes between each Telegram Git Notifier PHP release.
4 |
5 | ## v1.3.1 - 2023-11-08
6 |
7 | ### 📝 Small Changed
8 |
9 | - Change paths and add exceptions for webhook actions.
10 | - Update the license.
11 | - Update some workflow for analytic and format code.
12 |
13 | View all at #104
14 |
15 | ## v1.3.0 - 2023-11-03
16 |
17 | ### ✨ New Release: Enhanced Features and Optimizations!
18 |
19 | We are thrilled to announce the latest release with several new features and improvements:
20 |
21 | - Codebase refactoring for cleaner, more intuitive structures. #103
22 | - Incorporated extensive testing for multiple PHP versions, ensuring increased robustness and optimal compatibility across different PHP editions. [106fffb](https://github.com/cslant/telegram-git-notifier-app/commit/106fffbbaf2055262c72bb4daaa32036c5b1466f)
23 | - Update namespaces recent branding changes #102, [UPGRADING.md](https://github.com/cslant/telegram-git-notifier-app/blob/v1.3.0/UPGRADING.md)
24 |
25 | ## v1.2.0 - 2023-10-21
26 |
27 | 🎉 Introducing the New Telegram Git Notifier App!
28 |
29 | Building upon our core's [v1.2.0 release](https://github.com/lbiltech/telegram-git-notifier/releases/tag/v1.2.0), the Telegram Git Notifier App offers an enhanced experience for receiving GitHub notifications directly on Telegram, making it more efficient and user-friendly than ever.
30 |
31 | 🔗 [Check out the details and download here](https://github.com/lbiltech/telegram-git-notifier-app)
32 |
33 | ### ✨ New Features
34 |
35 | - Sending notifications in topics (threads in supergroups).
36 | - Enhanced capability to send notifications across multiple topics simultaneously.
37 | - Sending notifications to multiple groups simultaneously.
38 |
39 | ### 🛠 Improvements and Updates:
40 |
41 | - Refactored the source code for better efficiency and readability.
42 |
43 | Thank you for your continued support. We hope you enjoy these new features and improvements!
44 |
45 | ## v1.1.0 - 2023-08-26
46 |
47 | ### Telegram Bot GitHub & GitLab Notify - Enhanced Integration
48 |
49 | We are thrilled to announce the latest release of the **Telegram Bot GitHub & GitLab Notify**, featuring significant enhancements and updates.
50 |
51 | This version not only integrates both *GitHub and GitLab* platforms but also introduces customizable notifications for both platforms, offering you a more flexible project management experience than ever before.
52 |
53 | ### 🚀 New Features
54 |
55 | #### GitHub and GitLab Integration notification
56 |
57 | You can now effortlessly manage both GitHub and GitLab simultaneously through our bot.
58 |
59 | The bot will automatically track and send notifications about important events from both platforms to you via Telegram.
60 |
61 | #### Customizable enabling events
62 |
63 | We have introduced the ability to **customize notifications for each event on GitHub and GitLab**. You can decide to receive notifications for specific event types such as push, pull request, commit, issue, and various other events.
64 |
65 | Customize notification settings by editing the configuration file. This allows you to focus on the most important events for your project.
66 |
67 | ## v1.0.5 - 2023-08-16
68 |
69 | ### New Feature - Set My Commands (Menu Button)
70 |
71 | We're excited to introduce a new feature in this release that enhances the interaction with our Telegram bot. Say hello to the "Set My Commands" feature, which allows you to create a custom menu with buttons right within your chat window!
72 |
73 | #### 📌 Set My Commands - Menu Button:
74 |
75 | With the new "Set My Commands" feature, you can now create a menu of commands that users can easily access within their chat conversation. This streamlines the interaction process and makes it more intuitive for users to interact with your bot.
76 |
77 | To set up your custom menu, simply use the /set_menu command, and a list of buttons will be displayed in your chat window. Users can click on these buttons to trigger specific actions or commands, making the bot experience more user-friendly and efficient.
78 |
79 | Happy bot building!
80 |
81 | ## v1.0.4 - 2023-08-15
82 |
83 | ### What's Changed
84 |
85 | #### Add Docker Installation Option
86 |
87 | We've added an installation option through Docker, making it easy for you to deploy our bot in any environment quickly and efficiently. Docker helps package the application along with the required environment, ensuring consistency and easy management.
88 |
89 | #### Code Refactoring and Optimization
90 |
91 | We've undertaken code restructuring and optimization to enhance performance and scalability. This results in smoother operation and easier maintenance of our bot, both now and in the future.
92 |
93 | #### Bug Fixes
94 |
95 | This new version improves your experience and ensures the bot operates more smoothly and reliably.
96 |
97 | Be sure to update your bot to the latest version to experience the fantastic enhancements we've brought.
98 |
99 | ## v1.0.3 - 2023-08-11
100 |
101 | ### New Feature: Custom Events for Notification
102 |
103 | We're excited to introduce a new feature that allows you to enable custom events for notifications. With this enhancement, you'll have the flexibility to choose specific events that trigger notifications, giving you more control over the information you receive. This feature is particularly useful if you want to focus on certain types of activities or events within your repositories.
104 |
105 | #### Key Highlights
106 |
107 | - **Granular Control:** You can now choose which events you want to be notified about. Whether it's pull requests, issues, comments, or other actions, you can tailor your notifications to match your workflow.
108 |
109 | - **Enhanced Productivity:** By enabling custom events, you can cut down on the noise and only receive notifications for activities that matter most to you.
110 |
111 | - **How to Use:** In your notification settings, you'll find a new option to customize individual events. Simply select the events you want to be notified about, and you're all set.
112 |
113 |
114 | We're excited to empower you with this new feature and provide you with even more ways to stay informed and engaged with your repositories.
115 |
116 | Feel free to explore this feature and let us know if you have any feedback or suggestions. Your input is invaluable as we continue to improve and refine our platform.
117 |
118 | Thank you for being a part of our community!
119 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | > [!WARNING]
2 | > ## ⚠️ This Project is Deprecated – Use the New Laravel Package
3 | > * This project is outdated as it is built on a pure PHP source code.
4 | > * Instead, we highly recommend using our latest **Laravel package**, which offers:
5 | > - **Better security** with built-in authentication and protection mechanisms.
6 | > - **More features** for modern web development.
7 | > - **Active maintenance** and community support.
8 | > * 👉 [Click here to explore the new **Laravel Telegram Git Notifier** package](https://github.com/cslant/laravel-telegram-git-notifier)
9 |
10 | ---
11 |
12 | # Welcome to Telegram Bot GitHub/GitLab Notify 👋
13 |
14 | This package provides the ability to integrate the Telegram messaging service and GitHub/GitLab.
15 | With this package,
16 | you can create a Telegram bot to receive notifications from GitHub or GitLab events
17 | and manage customization through messages and buttons on Telegram.
18 |
19 |
20 |
21 |
41 |
42 |
58 |
59 |
389 |
390 |
401 |
402 |
420 |
421 |