Commit 93ede0cc authored by Jack'lul's avatar Jack'lul Committed by Armando Lüscher

Check for bot username on before trying to handle getUpdates or webhook

parent 0ea78351
...@@ -320,6 +320,10 @@ class Telegram ...@@ -320,6 +320,10 @@ class Telegram
*/ */
public function handleGetUpdates($limit = null, $timeout = null) public function handleGetUpdates($limit = null, $timeout = null)
{ {
if (empty($this->bot_username)) {
throw new TelegramException('Bot Username is not defined!');
}
if (!DB::isDbConnected()) { if (!DB::isDbConnected()) {
return new ServerResponse( return new ServerResponse(
[ [
...@@ -365,6 +369,10 @@ class Telegram ...@@ -365,6 +369,10 @@ class Telegram
*/ */
public function handle() public function handle()
{ {
if (empty($this->bot_username)) {
throw new TelegramException('Bot Username is not defined!');
}
$this->input = Request::getInput(); $this->input = Request::getInput();
if (empty($this->input)) { if (empty($this->input)) {
...@@ -407,10 +415,6 @@ class Telegram ...@@ -407,10 +415,6 @@ class Telegram
{ {
$this->update = $update; $this->update = $update;
if (empty($this->bot_username)) {
throw new TelegramException('Bot Username is not defined!');
}
//If all else fails, it's a generic message. //If all else fails, it's a generic message.
$command = 'genericmessage'; $command = 'genericmessage';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment