Finished single websocket framework. It works.

完成了全反向websocket框架,全面支持多机器人
This commit is contained in:
jerry
2018-06-15 09:18:53 +08:00
parent ab6408e0eb
commit 2de4337600
17 changed files with 601 additions and 441 deletions

View File

@@ -10,10 +10,12 @@ class Group
{
private $group_id;
private $group_name;
private $self_id;
//private $prefix;
private $members = [];
public function __construct($group_id, $info) {
public function __construct($group_id, $info, $self_id) {
$this->self_id = $self_id;
$this->group_id = $group_id;
$this->group_name = $info["group_name"];
//$this->prefix = $info["prefix"];
@@ -82,9 +84,17 @@ class Group
* @param bool $with_members
*/
public function updateData($with_members = false) {
CQUtil::sendAPI(["action" => "get_group_list"], ["update_group_info", $this->getGroupId()]);
$connection = CQUtil::getApiConnectionByQQ($this->getSelfId());
CQUtil::sendAPI($connection->fd, ["action" => "get_group_list"], ["update_group_info", $this->getGroupId()]);
if ($with_members) {
CQUtil::sendAPI(["action" => "get_group_member_list", "params" => ["group_id" => $this->getGroupId()]], ["update_group_member_list", strval($this->getGroupId())]);
CQUtil::sendAPI($connection->fd, ["action" => "get_group_member_list", "params" => ["group_id" => $this->getGroupId()]], ["update_group_member_list", strval($this->getGroupId())]);
}
}
/**
* @return mixed
*/
public function getSelfId() {
return $this->self_id;
}
}