EventContext
in package
Readonly DTO carrying the user/chat/thread context extracted from any incoming update by `UserContextMiddleware` (mirror of `aiogram.dispatcher.middlewares.user_context.EventContext`).
Handlers and filters can declare an EventContext $eventContext parameter
and the CallableObject reflection step will bind it to the
event_context kwarg the middleware injects.
Legacy aliases event_from_user, event_chat, and event_thread_id are
written alongside the full context for backward compatibility — see
UserContextMiddleware::__invoke.
The businessConnectionId field is intentionally not exposed as a
top-level kwarg: upstream's deprecated event_business_connection_id
TypedDict key is documentation residue, not populated by the live
middleware. Callers must reach into $eventContext->businessConnectionId
to read it.
Table of Contents
Properties
Methods
- __construct() : mixed
- chatId() : int|null
- userId() : int|null
Properties
$businessConnectionId
public
string|null
$businessConnectionId
= null
$chat
public
Chat|null
$chat
= null
$threadId
public
int|null
$threadId
= null
$user
public
User|null
$user
= null
Methods
__construct()
public
__construct([Chat|null $chat = null ][, User|null $user = null ][, int|null $threadId = null ][, string|null $businessConnectionId = null ]) : mixed
Parameters
chatId()
public
chatId() : int|null
Return values
int|nulluserId()
public
userId() : int|null