PHP code example of leocata / m1-bot
1. Go to this page and download the library: Download leocata/m1-bot 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/ */
leocata / m1-bot example snippets
use leocata\m1Bot\Bot\BaseBot;
class ExampleBot extends BaseBot
{
public $pass = 'password';
public $username = 'username';
public function contactRequested(\GearmanJob $job)
{
$message = json_decode($job->workload());
$this->getApiWrapper()->contactAccept($message->userid, '', 1);
$job->sendComplete(true);
}
public function message(\GearmanJob $job)
{
$this->getApiWrapper()->messageDelivered($message->sessionid, $message->id);
$this->getApiWrapper()->messageTyped($message->sessionid, $message->orig);
$job->sendComplete(true);
}
}