Skip to main content

PlatformEvent

Defined in the protocols module.
AI Agent A normalised inbound platform event that is not a text/media message. Reactions, edits, deletions, membership changes and thread lifecycle are delivered by the platform SDK but are not messages. This is the single shared, protocol-only contract every adapter emits into and every hook or plugin consumes — the inbound counterpart to the outbound ReactionResult / message-action surface the bot already ships. Adapters build one of these from the native event and emit it via MessageHookMixin.fire_platform_event (praisonai-bot), which routes it to the matching :class:~praisonaiagents.hooks.types.HookEvent (REACTION_RECEIVED/MESSAGE_EDITED/MESSAGE_DELETED/ MEMBER_JOINED/MEMBER_LEFT/THREAD_CREATED). Platforms that cannot deliver a given event simply never build one — graceful, capability-gated, exactly like the outbound capabilities["reactions"] gate. Attributes: kind: Which normalised event this is (see :data:PlatformEventKind). platform: Emitting platform name ("telegram"/"discord"/…). chat_id: Channel/chat the event occurred in. user_id: The user who caused the event (reactor, editor, joiner, …). message_id: The message the event targets (reactions/edits/deletes). emoji: The reaction emoji, for reaction add/remove. new_text: The new content, for an edit. thread_id: The thread identifier, for thread creation / threaded events. raw: Escape hatch to the native SDK payload for adapter-specific needs.

Properties

PlatformEventKind
No description available.
str
No description available.
str
No description available.
str
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional
No description available.
  • to_dict: Convert to dictionary (native raw payload intentionally omitted).

Source

View on GitHub

praisonaiagents/bots/protocols.py at line 711