Created
January 19, 2017 14:50
-
-
Save Hanson/acb16dc4461b6e7491f13263f135aa3b to your computer and use it in GitHub Desktop.
text test for vbot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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