Skip to content

Instantly share code, notes, and snippets.

@Hanson
Created January 19, 2017 14:50
Show Gist options
  • Save Hanson/acb16dc4461b6e7491f13263f135aa3b to your computer and use it in GitHub Desktop.
Save Hanson/acb16dc4461b6e7491f13263f135aa3b to your computer and use it in GitHub Desktop.
text test for vbot
<?php
/**
* Created by PhpStorm.
* User: HanSon
* Date: 2016/12/7
* Time: 16:33
*/
require_once __DIR__ . './../vendor/autoload.php';
use Hanson\Vbot\Foundation\Vbot;
use Hanson\Vbot\Message\Entity\Text;
$robot = new Vbot([
'tmp' => __DIR__ . '/./../tmp/',
'debug' => true
]);
$robot->server->setMessageHandler(function ($message) {
if ($message instanceof Text) {
/** @var $message Text */
if($message->fromType === 'Contact'){
return 'hi';
}elseif($message->fromType === 'Group' && $message->isAt){
return 'hey';
}
}
});
$robot->server->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment