From bd6a9f011b57711757ae85958f6f2417e2c0dbf4 Mon Sep 17 00:00:00 2001 From: mercury Date: Mon, 5 Jun 2023 13:50:16 +0400 Subject: [PATCH] period check version 1 hour --- app/bot.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/bot.php b/app/bot.php index c44716c..ad95bba 100644 --- a/app/bot.php +++ b/app/bot.php @@ -551,9 +551,10 @@ class Bot { try { require __DIR__ . '/config.php'; - if (!empty($c['admin'])) { - $current = file_get_contents('/version'); - $last = file_get_contents('https://raw.githubusercontent.com/mercurykd/vpnbot/master/version'); + if (!empty($c['admin']) && (empty($this->time) || ((time() - $this->time) > 3600))) { + $this->time = time(); + $current = file_get_contents('/version'); + $last = file_get_contents('https://raw.githubusercontent.com/mercurykd/vpnbot/master/version'); if (!empty($last) && $last != $this->last && $last != $current) { $this->last = $last; $diff = implode("\n", array_diff(explode("\n", $last), explode("\n", $current)));