PHP code example of hitmare / unlockptb

1. Go to this page and download the library: Download hitmare/unlockptb library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hitmare / unlockptb example snippets


    $unlockptb = array('private','group','supergroup');
    $telegram->setCommandConfig('lockstatus', ['lockChat' => $unlockptb]);
    $telegram->setCommandConfig('lock', ['lockChat' => $unlockptb]);
    $telegram->setCommandConfig('unlock', ['lockChat' => $unlockptb]);

    $telegram->setCommandConfig('lockedcommand', ['lockChat' => $unlockptb]);

    use Hitmare\UnlockPTB\Unlock;

    $message    = $this->getMessage();
    $chat_id    = $message->getChat()->getId();
    $isUnlocked = Unlock::isUnlocked($chat_id);

    $lockChat = $this->getConfig('lockChat');
    $thisChat = $message->getChat()->getType();
    //Check if the lock applys to this Chat Type
    if (in_array($thisChat,$lockChat)) {
      //Check if Command is unlocked
      if (!$isUnlocked) {
        $data = ['chat_id' => $chat_id, 'text' => 'This Command is locked inside this Chat'];
        return Request::sendMessage($data);
      }
    }

    // Your Code down here

    $unlockptb = array('private','group','supergroup');