From 2c7b4c79a1a9bf78d0bc08d9eff8a87c7af1d4a5 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 13 Jan 2023 14:18:05 +0800 Subject: [PATCH] set container allows extended BotContext --- src/ZM/Container/ContainerRegistrant.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZM/Container/ContainerRegistrant.php b/src/ZM/Container/ContainerRegistrant.php index 1d30e1ab..5b62e26e 100644 --- a/src/ZM/Container/ContainerRegistrant.php +++ b/src/ZM/Container/ContainerRegistrant.php @@ -19,7 +19,7 @@ class ContainerRegistrant /** * 应在收到 OneBot 事件时调用 */ - public static function registerOBEventServices(OneBotEvent $event): void + public static function registerOBEventServices(OneBotEvent $event, string $bot_context = BotContext::class): void { self::addServices([ OneBotEvent::class => $event, @@ -28,7 +28,7 @@ class ContainerRegistrant if (isset($event->self['platform'])) { self::addServices([ - BotContext::class => DI\autowire(BotContext::class)->constructor( + BotContext::class => DI\autowire($bot_context)->constructor( $event->self['user_id'] ?? '', $event->self['platform'], ),