You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.4 KiB

1 year ago
  1. <?php
  2. /**
  3. * This file is part of the PHP Telegram Bot example-bot package.
  4. * https://github.com/php-telegram-bot/example-bot/
  5. *
  6. * (c) PHP Telegram Bot Team
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. /**
  12. * User "/markdown" command
  13. *
  14. * Print some text formatted with markdown.
  15. */
  16. namespace Longman\TelegramBot\Commands\UserCommands;
  17. use Longman\TelegramBot\Commands\UserCommand;
  18. use Longman\TelegramBot\Entities\ReplyKeyboardMarkup;
  19. use Longman\TelegramBot\Entities\ServerResponse;
  20. use Longman\TelegramBot\Exception\TelegramException;
  21. class MarkdownCommand extends UserCommand
  22. {
  23. /**
  24. * @var string
  25. */
  26. protected $name = 'markdown';
  27. /**
  28. * @var string
  29. */
  30. protected $description = 'Print Markdown Text';
  31. /**
  32. * @var string
  33. */
  34. protected $usage = '/markdown';
  35. /**
  36. * @var string
  37. */
  38. protected $version = '1.1.0';
  39. /**
  40. * Main command execution
  41. *
  42. * @return ServerResponse
  43. * @throws TelegramException
  44. */
  45. public function execute(): ServerResponse
  46. {
  47. return $this->replyToChat('
  48. *bold* _italic_ `inline fixed width code`
  49. ```
  50. preformatted code block
  51. code block
  52. ```
  53. [Best Telegram bot api!!](https://github.com/php-telegram-bot/core)', [
  54. 'parse_mode' => 'markdown',
  55. ]);
  56. }
  57. }