Skip to content

Commit 1408ba1

Browse files
committed
Make preExecute more logical regarding MySQL requirement.
Fix missing namespace use.
1 parent 4ed9660 commit 1408ba1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Commands/Command.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
namespace Longman\TelegramBot\Commands;
1212

1313
use Longman\TelegramBot\DB;
14+
use Longman\TelegramBot\Request;
1415
use Longman\TelegramBot\Telegram;
1516
use Longman\TelegramBot\Entities\Chat;
1617
use Longman\TelegramBot\Entities\Update;
@@ -126,10 +127,10 @@ public function setUpdate(Update $update = null)
126127
*/
127128
public function preExecute()
128129
{
129-
if (!$this->need_mysql || ($this->telegram->isDbEnabled() && DB::isDbConnected())) {
130-
return $this->execute();
130+
if ($this->need_mysql && !($this->telegram->isDbEnabled() && DB::isDbConnected())) {
131+
return $this->executeNoDB();
131132
}
132-
return $this->executeNoDB();
133+
return $this->execute();
133134
}
134135

135136
/**

0 commit comments

Comments
 (0)