fix bot context not sync

This commit is contained in:
sunxyw
2022-12-29 14:58:18 +08:00
parent c65694402f
commit 9cf905421e
2 changed files with 11 additions and 6 deletions

View File

@@ -26,8 +26,16 @@ class ContainerRegistrant
self::addServices([
OneBotEvent::class => $event,
'bot.event' => DI\get(OneBotEvent::class),
BotContext::class => fn () => bot(),
]);
if (isset($event->self['platform'])) {
self::addServices([
BotContext::class => DI\autowire(BotContext::class)->constructor(
$event->self['user_id'] ?? '',
$event->self['platform'],
),
]);
}
}
/**