mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 00:25:35 +08:00
set container allows extended BotContext
This commit is contained in:
@@ -19,7 +19,7 @@ class ContainerRegistrant
|
|||||||
/**
|
/**
|
||||||
* 应在收到 OneBot 事件时调用
|
* 应在收到 OneBot 事件时调用
|
||||||
*/
|
*/
|
||||||
public static function registerOBEventServices(OneBotEvent $event): void
|
public static function registerOBEventServices(OneBotEvent $event, string $bot_context = BotContext::class): void
|
||||||
{
|
{
|
||||||
self::addServices([
|
self::addServices([
|
||||||
OneBotEvent::class => $event,
|
OneBotEvent::class => $event,
|
||||||
@@ -28,7 +28,7 @@ class ContainerRegistrant
|
|||||||
|
|
||||||
if (isset($event->self['platform'])) {
|
if (isset($event->self['platform'])) {
|
||||||
self::addServices([
|
self::addServices([
|
||||||
BotContext::class => DI\autowire(BotContext::class)->constructor(
|
BotContext::class => DI\autowire($bot_context)->constructor(
|
||||||
$event->self['user_id'] ?? '',
|
$event->self['user_id'] ?? '',
|
||||||
$event->self['platform'],
|
$event->self['platform'],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user