Skip to content

Instantly share code, notes, and snippets.

@BoShurik
Created March 13, 2017 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoShurik/05b609c248d77150af39f0620c8f4b4e to your computer and use it in GitHub Desktop.
Save BoShurik/05b609c248d77150af39f0620c8f4b4e to your computer and use it in GitHub Desktop.
<?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!');
}
}
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