Created
March 13, 2017 09:36
-
-
Save BoShurik/05b609c248d77150af39f0620c8f4b4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Telegram\Command; | |
use BoShurik\TelegramBotBundle\Telegram\Command\AbstractCommand; | |
use TelegramBot\Api\BotApi; | |
use TelegramBot\Api\Types\Message; | |
class HelloWorldCommand extends AbstractCommand | |
{ | |
/** | |
* @inheritDoc | |
*/ | |
public function getName() | |
{ | |
return '/hello'; | |
} | |
/** | |
* @inheritDoc | |
*/ | |
public function getDescription() | |
{ | |
return '"Hello world" example'; | |
} | |
/** | |
* @inheritDoc | |
*/ | |
public function execute(BotApi $api, Message $message) | |
{ | |
$api->sendMessage($message->getChat()->getId(), 'Hello world!'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
app.telegram.command.help: | |
class: AppBundle\Telegram\Command\HelloWorldCommand | |
tags: | |
- { name: bo_shurik_telegram_bot.command } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment