diff --git a/config/telegram-git-notifier.php b/config/telegram-git-notifier.php index 6df0765..d0619f1 100644 --- a/config/telegram-git-notifier.php +++ b/config/telegram-git-notifier.php @@ -2,39 +2,81 @@ return [ 'app' => [ - 'name' => env('APP_NAME', 'Laravel Telegram Git Notify'), - 'url' => env('APP_URL', 'http://localhost:8000'), + 'name' => env('TGN_APP_NAME', 'Laravel Telegram Git Notifier'), + + // Required for the bot to work properly + 'url' => env('TGN_APP_URL', 'http://localhost:8000'), 'timezone' => env('TIMEZONE', 'Asia/Ho_Chi_Minh'), ], 'bot' => [ 'token' => env('TELEGRAM_BOT_TOKEN', ''), 'chat_id' => env('TELEGRAM_BOT_CHAT_ID', ''), - 'notify_chat_ids' => explode( - ',', - env('TELEGRAM_NOTIFY_CHAT_IDS', '') - ), + + /** + * Set the chat IDs that will receive notifications + * You can add the owner bot ID, group ID, ... + * ------------------------------------------------------- + * Note: + * Please use semicolon ";" to separate chat ids + * And use a colon ":" to separate chat ID and thread ID + * And use comma "," if you want to add multiple thread IDs + * ------------------------------------------------------- + * The environment variable is expected to be in the format: + * "chat_id1;chat_id2:thread_id2;chat_id3:thread_id3_1,thread_id3_2;...". + */ + 'notify_chat_ids' => env('TELEGRAM_NOTIFY_CHAT_IDS', ''), ], 'author' => [ - 'discussion' => env('TGN_AUTHOR_CONTACT', 'https://t.me/tannp27'), + 'discussion' => env( + 'TGN_AUTHOR_DISCUSSION', + 'https://github.com/lbiltech/laravel-telegram-git-notifier/discussions' + ), 'source_code' => env( 'TGN_AUTHOR_SOURCE_CODE', 'https://github.com/lbiltech/laravel-telegram-git-notifier' ), ], + /** Set the path to the data file */ + 'data_file' => [ + 'setting' => env( + 'TGN_PATH_SETTING', + storage_path('/app/json/tgn/tgn-settings.json') + ), + + 'platform' => [ + 'gitlab' => env( + 'TGN_PATH_PLATFORM_GITLAB', + storage_path('/app/json/tgn/gitlab-events.json') + ), + 'github' => env( + 'TGN_PATH_PLATFORM_GITHUB', + storage_path('/app/json/tgn/github-events.json') + ), + ], + ], + + /** Set the path to the view file */ 'view' => [ - 'event' => [ + 'default' => env( + 'TGN_VIEW_DEFAULT', + base_path('resources/views/vendor/telegram-git-notifier') + ), + + 'event' => [ 'default' => env('TGN_VIEW_EVENT_DEFAULT', 'default'), ], + 'globals' => [ 'access_denied' => env( 'TGN_VIEW_GLOBALS_ACCESS_DENIED', 'globals.access_denied' ), ], - 'tools' => [ + + 'tools' => [ 'settings' => env( 'TGN_VIEW_TOOL_SETTING', 'tools.settings' @@ -53,4 +95,5 @@ ), ], ], + ]; diff --git a/src/Providers/TelegramGitNotifierServiceProvider.php b/src/Providers/TelegramGitNotifierServiceProvider.php index 8114e04..6cf4a37 100644 --- a/src/Providers/TelegramGitNotifierServiceProvider.php +++ b/src/Providers/TelegramGitNotifierServiceProvider.php @@ -23,11 +23,15 @@ public function boot(): void $this->loadRoutesFrom($routePath); } - $helperPath = __DIR__.'/../../common/helpers.php'; - if (file_exists($helperPath)) { - require_once $helperPath; + $viewPath = __DIR__.'/../../resources/views'; + if (file_exists($viewPath)) { + $this->loadViewsFrom($viewPath, 'telegram-git-notifier'); } + $this->publishes([ + __DIR__.'/../../resources/views' => base_path('resources/views/vendor/telegram-git-notifier'), + ], 'views'); + $this->loadTranslationsFrom(__DIR__.'/../../lang', 'telegram-git-notifier'); $this->publishes([