From f51072e555a02c96370a061f69ff9ca72292c745 Mon Sep 17 00:00:00 2001 From: mirmuxsin Date: Fri, 11 Nov 2022 15:37:04 +0500 Subject: [PATCH] added function setUrl and access url --- src/Laragram.php | 6 ++++++ src/app/Console/Commands/longpolling.php | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Laragram.php b/src/Laragram.php index 117b725..8953243 100644 --- a/src/Laragram.php +++ b/src/Laragram.php @@ -29,6 +29,8 @@ */ class Laragram { + public static string $url; + /** * @throws Exception|GuzzleException */ @@ -56,4 +58,8 @@ public static function request (string $method, array $array) { "query" => $array[0] ])->getBody()->getContents(); } + + public static function setUrl ($url) { + return self::$url = $url; + } } diff --git a/src/app/Console/Commands/longpolling.php b/src/app/Console/Commands/longpolling.php index fb2321c..614d6cf 100644 --- a/src/app/Console/Commands/longpolling.php +++ b/src/app/Console/Commands/longpolling.php @@ -41,6 +41,7 @@ public function handle() $this->info('Webhook address: ' . $url.config('laragram.url')); file_get_contents("https://api.telegram.org/bot" . $token . "/setWebhook?url=" . $url.config('laragram.url')); + $setUrl = \Milly\Laragram\Laragram::setUrl($url.config('laragram.url')); $this->info('Webhook was successfully set'); $this->call('serve'); }