Longman\TelegramBot\Commands\SystemCommands\NewchatmemberCommand::execute PHP Method

execute() public method

Command execute method
public execute ( ) : mixed
return mixed
    public function execute()
    {
        $message = $this->getMessage();
        $chat_id = $message->getChat()->getId();
        $member = $message->getNewChatMember();
        $text = 'Hi there!';
        if (!$message->botAddedInChat()) {
            $text = 'Hi ' . $member->tryMention() . '!';
        }
        $data = ['chat_id' => $chat_id, 'text' => $text];
        return Request::sendMessage($data);
    }
NewchatmemberCommand