mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 00:25:35 +08:00
add all bots proxy for ZMRobot
This commit is contained in:
@@ -4,6 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace ZM\API;
|
||||
|
||||
use ZM\API\Proxies\Bot as Proxies;
|
||||
use ZM\Console\Console;
|
||||
|
||||
/**
|
||||
* Class ZMRobot
|
||||
* @since 1.2
|
||||
@@ -11,4 +14,25 @@ namespace ZM\API;
|
||||
*/
|
||||
class ZMRobot extends OneBotV11
|
||||
{
|
||||
/**
|
||||
* 获取一个会在所有机器人实例上执行的代理
|
||||
*/
|
||||
public function all(Proxies\AbstractBotProxy $proxy = null): Proxies\AllBotsProxy
|
||||
{
|
||||
$bot = $proxy ?: $this;
|
||||
$bot_id = implode_when_necessary($bot->getSelfId());
|
||||
Console::debug("Constructing AllBotsProxy for ZMRobot({$bot_id})");
|
||||
return new Proxies\AllBotsProxy($bot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个会在所有群上执行的代理
|
||||
*/
|
||||
public function allGroups(Proxies\AbstractBotProxy $proxy = null): Proxies\AllGroupsProxy
|
||||
{
|
||||
$bot = $proxy ?: $this;
|
||||
$bot_id = implode_when_necessary($bot->getSelfId());
|
||||
Console::debug("Constructing AllGroupsProxy for ZMRobot({$bot_id})");
|
||||
return new Proxies\AllGroupsProxy($bot);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user