From cdcd6a793191b8abfb8fb11dcbdc05cd3840ebf3 Mon Sep 17 00:00:00 2001 From: mercury Date: Sat, 2 Mar 2024 15:05:21 +0400 Subject: [PATCH] check webhook --- app/bot.php | 7 ++++++- scripts/check_file.sh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/bot.php b/app/bot.php index a077733..25f2ef6 100644 --- a/app/bot.php +++ b/app/bot.php @@ -4065,10 +4065,15 @@ DNS-over-HTTPS with IP: die('нет айпи'); } echo "$ip\n"; - var_dump($this->request('setWebhook', [ + var_dump($r = $this->request('setWebhook', [ 'url' => "https://$ip/tlgrm?k={$this->key}", 'certificate' => curl_file_create('/certs/self_public'), ])); + if (!empty($r['result']) && $r['result'] == true) { + file_put_contents('/start', 1); + } else { + die('set webhook fail'); + } } public function setcommands() diff --git a/scripts/check_file.sh b/scripts/check_file.sh index a3487ec..d58ebb6 100644 --- a/scripts/check_file.sh +++ b/scripts/check_file.sh @@ -1,4 +1,4 @@ -if [[ -f "/ssh/key.pub" && -s "/ssh/key.pub" ]]; then +if [[ -f "/start" && -f "/ssh/key.pub" && -s "/ssh/key.pub" ]]; then exit 0; else exit 1;