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.

58 lines
1.3 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. * Left chat member command
  13. *
  14. * Gets executed when a member leaves the chat.
  15. *
  16. * NOTE: This command must be called from GenericmessageCommand.php!
  17. * It is only in a separate command file for easier code maintenance.
  18. */
  19. namespace Longman\TelegramBot\Commands\SystemCommands;
  20. use Longman\TelegramBot\Commands\SystemCommand;
  21. use Longman\TelegramBot\Entities\ServerResponse;
  22. use Longman\TelegramBot\Exception\TelegramException;
  23. class LeftchatmemberCommand extends SystemCommand
  24. {
  25. /**
  26. * @var string
  27. */
  28. protected $name = 'leftchatmember';
  29. /**
  30. * @var string
  31. */
  32. protected $description = 'Left Chat Member';
  33. /**
  34. * @var string
  35. */
  36. protected $version = '1.2.0';
  37. /**
  38. * Main command execution
  39. *
  40. * @return ServerResponse
  41. * @throws TelegramException
  42. */
  43. public function execute(): ServerResponse
  44. {
  45. $message = $this->getMessage();
  46. $member = $message->getLeftChatMember();
  47. return $this->replyToChat('Sorry to see you go, ' . $member->getFirstName());
  48. }
  49. }