MOON
Server: Apache
System: Linux u18017238.onlinehome-server.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User: emblazeone (1003)
PHP: 7.3.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/emblazeone/public_html/master-template/vendor/wbp/telegramBot/Client.php
<?php

namespace wbp\telegramBot;

use Closure;
use TelegramBot\Api\Types\Update;

class Client extends \TelegramBot\Api\Client
{
    public function contactCommand(Closure $action)
    {
        return $this->on(self::getEvent($action), self::getContactChecker());
    }

    public function currentContactCommand(Closure $action)
    {
//        $this->sendMessage("153170246", self::getContactChecker(true));
        return $this->on(self::getEvent($action), self::getContactChecker(true));
    }

    protected static function getContactChecker($currentUser=false)
    {

        return function (Update $update) use ($currentUser){
            $message = $update->getMessage();
            if (is_null($message) || is_null($message->getContact()) || !strlen($message->getContact()->getUserId())) {
                return false;
            }

            if($currentUser && $message->getFrom()->getId()!=$message->getContact()->getUserId()) return false;

            return true;
        };
    }
}