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.

61 lines
1.2 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. * Generic message command
  13. *
  14. * Gets executed when any type of message is sent.
  15. *
  16. * In this message-related context, we can handle any kind of message.
  17. */
  18. namespace Longman\TelegramBot\Commands\SystemCommands;
  19. use Longman\TelegramBot\Commands\SystemCommand;
  20. use Longman\TelegramBot\Entities\ServerResponse;
  21. use Longman\TelegramBot\Request;
  22. class GenericmessageCommand extends SystemCommand
  23. {
  24. /**
  25. * @var string
  26. */
  27. protected $name = 'genericmessage';
  28. /**
  29. * @var string
  30. */
  31. protected $description = 'Handle generic message';
  32. /**
  33. * @var string
  34. */
  35. protected $version = '1.0.0';
  36. /**
  37. * Main command execution
  38. *
  39. * @return ServerResponse
  40. */
  41. public function execute(): ServerResponse
  42. {
  43. $message = $this->getMessage();
  44. /**
  45. * Handle any kind of message here
  46. */
  47. $message_text = $message->getText(true);
  48. return Request::emptyResponse();
  49. }
  50. }