cslant/laravel-telegram-git-notifier

View on GitHub
src/Commands/SetWebhook.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace CSlant\LaravelTelegramGitNotifier\Commands;

use CSlant\LaravelTelegramGitNotifier\Services\WebhookService;
use CSlant\TelegramGitNotifier\Exceptions\WebhookException;
use Illuminate\Console\Command;

class SetWebhook extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'tg-notifier:webhook:set';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Set webhook';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle(): void
    {
        try {
            $webhookService = new WebhookService();

            $this->info($webhookService->setWebhook());
        } catch (WebhookException $e) {
            $this->error($e->getMessage());
        }
    }
}