Skip to main content
LangBot plugins can register and handle pipeline events. For usage instructions, see Component: Event Listener.

List of Events

Some events have settable attributes, which can be modified by plugin code and used in subsequent LangBot processing.

*MessageReceived

Triggered when any message is received in group chat or private chat.

*NormalMessageReceived

Triggered when a group chat or private chat message is received and determined to be a message that needs to be processed by LLM (non-command message).

*CommandSent

No longer recommended for use, please use Component: Command instead.
Triggered when a group chat or private chat command is received.

NormalMessageResponded

Triggered when a message receives an LLM response.

PromptPreProcessing

Triggered when building the LLM response context (prompt).

Event Context APIs

Event processing methods will be passed the EventContext object, which contains event context information, and the object has both Request API and event context specific APIs. The following is a list of event context specific APIs:

Get Original Event Attributes

event_context.event attribute is the original event object, which can get the attributes of the original event. The type is the type of the event being listened to. For example, when the event being listened to is GroupMessageReceived:

Prevent Default Behavior

Calling this method will prevent the default subsequent behavior of this event, and the pipeline will end directly.
Only the following events can prevent default behavior:
  • PersonMessageReceived
  • GroupMessageReceived
  • PersonNormalMessageReceived
  • GroupNormalMessageReceived
  • PersonCommandSent
  • GroupCommandSent
  • NormalMessageResponded

Prevent Postorder Execution

Calling this method will prevent the subsequent plugins from executing this time.