Rename the method and use request class from container

parent e3f13a1c
...@@ -83,7 +83,7 @@ class ChatsCommand extends AdminCommand ...@@ -83,7 +83,7 @@ class ChatsCommand extends AdminCommand
$chat = new Chat($result); $chat = new Chat($result);
$whois = $chat->getId(); $whois = $chat->getId();
if ($this->telegram->getCommandObject('whois')) { if ($this->telegram->createCommandObject('whois')) {
// We can't use '-' in command because part of it will become unclickable // We can't use '-' in command because part of it will become unclickable
$whois = '/whois' . str_replace('-', 'g', $chat->getId()); $whois = '/whois' . str_replace('-', 'g', $chat->getId());
} }
......
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
namespace Longman\TelegramBot\Commands\AdminCommands; namespace Longman\TelegramBot\Commands\AdminCommands;
use Exception;
use Longman\TelegramBot\Commands\AdminCommand; use Longman\TelegramBot\Commands\AdminCommand;
use Longman\TelegramBot\DB; use Longman\TelegramBot\DB;
use Longman\TelegramBot\Http\Client; use Longman\TelegramBot\Http\Client;
use Longman\TelegramBot\Http\Request;
/** /**
* Admin "/debug" command * Admin "/debug" command
...@@ -94,8 +96,11 @@ class DebugCommand extends AdminCommand ...@@ -94,8 +96,11 @@ class DebugCommand extends AdminCommand
$webhook_info_title = '*Webhook Info:*'; $webhook_info_title = '*Webhook Info:*';
try { try {
/** @var \Longman\TelegramBot\Http\Request $request */
$request = $this->getTelegram()->getContainer()->make(Request::class);
// Check if we're actually using the Webhook method. // Check if we're actually using the Webhook method.
if (Client::getInput() === '') { if (empty($request->json()->all())) {
$debug_info[] = $webhook_info_title . ' `Using getUpdates method, not Webhook.`'; $debug_info[] = $webhook_info_title . ' `Using getUpdates method, not Webhook.`';
} else { } else {
$webhook_info_result = json_decode(Client::getWebhookInfo(), true)['result']; $webhook_info_result = json_decode(Client::getWebhookInfo(), true)['result'];
...@@ -111,7 +116,7 @@ class DebugCommand extends AdminCommand ...@@ -111,7 +116,7 @@ class DebugCommand extends AdminCommand
$webhook_info_result_str $webhook_info_result_str
); );
} }
} catch (\Exception $e) { } catch (Exception $e) {
$debug_info[] = $webhook_info_title . sprintf(' `Failed to get webhook info! (%s)`', $e->getMessage()); $debug_info[] = $webhook_info_title . sprintf(' `Failed to get webhook info! (%s)`', $e->getMessage());
} }
......
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