diff --git a/discovery.json b/discovery.json index db7b393..f824228 100644 --- a/discovery.json +++ b/discovery.json @@ -9,5 +9,8 @@ "BotMan\\Drivers\\Telegram\\TelegramLocationDriver", "BotMan\\Drivers\\Telegram\\TelegramPhotoDriver", "BotMan\\Drivers\\Telegram\\TelegramVideoDriver" + ], + "botman/commands": [ + "BotMan\\Drivers\\Telegram\\Console\\Commands\\TelegramRegisterCommand" ] } \ No newline at end of file diff --git a/src/Console/Commands/TelegramRegisterCommand.php b/src/Console/Commands/TelegramRegisterCommand.php new file mode 100644 index 0000000..af92e61 --- /dev/null +++ b/src/Console/Commands/TelegramRegisterCommand.php @@ -0,0 +1,49 @@ +ask('What is the target url for the telegram bot?'); + + $this->info('Using '.$url); + + $this->info('Pinging Telegram...'); + + $output = json_decode(file_get_contents($url)); + + if ($output->ok == true && $output->result == true) { + $this->info('Your bot is now set up with Telegram\'s webhook!'); + } + + if ($this->option('output')) { + dump($output); + } + } +} \ No newline at end of file