Event reference
sechat.events.EventType
Bases: IntEnum
The possible events that chat can send, as listed in master-chat.js.
Attributes:
| Name | Type | Description |
|---|---|---|
MessagePosted |
A message was sent. |
|
MessageEdited |
A message was edited. |
|
UserEntered |
A user joined the room. |
|
UserLeft |
A user left the room. |
|
RoomNameChanged |
The room's visibility, name, tags, or description were changed. This event does not appear to actually fire. |
|
MessageStarred |
A user starred a message. |
|
DebugMessage |
Unknown. |
|
UserMentioned |
A message was sent which mentions the current account by username. |
|
MessageFlagged |
A spam flag was raised. Only received by users with 10k or more reputation. |
|
MessageDeleted |
A message was deleted. |
|
FileAdded |
Unknown. There is unused code in |
|
ModeratorFlag |
A moderator flag was raised. Details unknown since normal users don't receive this. |
|
UserSettingsChanged |
This account's chat settings (such as muted users) were changed. |
|
GlobalNotification |
One of several events happened which shows a notification in the client. |
|
AccessLevelChanged |
This account's access level was changed. |
|
UserNotification |
One of several events happened which shows a notification in the client. |
|
Invitation |
Someone invited this account to a room. |
|
MessageReply |
Someone replied to a message sent by this account. |
|
MessageMovedOut |
A message was moved out of this room. |
|
MessageMovedIn |
A message was moved into this room. |
|
TimeBreak |
Unknown. |
|
FeedTicker |
An RSS feed in ticker mode received a new event. |
|
UserSuspended |
This account was suspended. |
|
UserMerged |
User accounts were merged? Details unknown. |
|
UserNameOrAvatarChanged |
A user's name or avatar was changed. |
sechat.events.AccessLevelChangedEvent
Bases: UserEvent
A user or room's access level was changed.
user_id and user_name will be the user id and username of the user which performed the change;
target_user_id will be the user id of the user whose access level was changed.
Known values for content:
Access now read-write: The user was explicitly given write access. In gallery rooms, this allows the user to chat. This level does nothing in public rooms, unless the user has less than 20 network-wide reputation, in which case they may be granted this level by a moderator to override the reputation requirement.Access now read-only: The user was explicitly given read access. This level does nothing in public or gallery rooms, but allows the user to see private rooms (which can only be created by a moderator).Access now owner: The user was made a room owner.Access now request: The user requested access to a gallery room.priv <number> created: The user was kicked from the room. This may fire under other conditions as well; TODO investigate this more.priv <number> deleted: The user's kickmute expired.None(not the string "None"): The room's access level was changed.target_user_idwill beNone.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
Optional[str]
|
A short string describing what change occured, which appears under certain conditions in
chat's UI. TODO: Investigate what those conditions are, see also https://meta.stackexchange.com/q/402787/1116284
If the room's access level was changed (such as from public to gallery), this will be |
sechat.events.BaseMessageEvent
Bases: RoomEvent
An action taken on a message.
Attributes:
| Name | Type | Description |
|---|---|---|
message_id |
int
|
The id of the message. |
parent_id |
Optional[int]
|
Either the id of the message this message is replying to, or the id of the last message sent by the
user this message mentions. This will be |
show_parent |
Optional[bool]
|
The exact behavior of this property is unknown. It seems to be |
message_stars |
int
|
The number of stars this message has. This will be 0 if the message is not starred. |
message_owner_stars |
int
|
The number of pins this message has. This will be 0 if the message is not pinned. |
message_edits |
int
|
The number of times this message has been edited. |
sechat.events.DeleteEvent
sechat.events.EditEvent
sechat.events.Event
Bases: BaseModel
An event received from chat.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
The unique id of this event. |
sechat.events.GlobalNotificationEvent
Bases: UserEvent
One of several events occured which chat displays notifications for.
This event seems similar to []UserNotification][sechat.events.UserNotification], and the default client
handles them identically; the distinction, if any, is unknown.
Known actions which can fire this event:
- A scheduled event starting soon.
- A chat developer manually sending a notification.
user_id will always be -2 (Feeds); target_user_id will be the id of this account.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
str
|
A snippet of HTML containing the human-readable invite message which would be shown as a notification in the chat client. |
sechat.events.InvitationEvent
Bases: UserEvent
Someone invited this account to a room.
room_id and room_namewill be the id and name of the room this account was invited to join.
user_idand user_name will be the user id and username of the user which sent the invite.
target_user_id will be the user id of this account.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
str
|
A snippet of HTML containing the human-readable invite message which would be shown as a notification in the chat client. |
sechat.events.MentionEvent
Bases: MessageEvent
The bot was mentioned in a message.
This event will be sent along with a MessageEvent if someone mentioned the bot in a message.
sechat.events.MessageEvent
Bases: BaseMessageEvent, UserEvent
A message was sent.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
str
|
The content of the message, as a snippet of HTML. |
sechat.events.MessageStarredEvent
Bases: BaseMessageEvent
Someone starred or pinned a message.
message_stars and message_owner_stars will reflect the new star count and pin state of this message.
This event no longer includes information about who starred or pinned the message;
see https://meta.stackexchange.com/q/229913/1116284.
sechat.events.ReplyEvent
Bases: MessageEvent
This account was replied to.
This event will be sent along with a MessageEvent if someone replied to a message sent by the bot.
sechat.events.RoomEvent
Bases: Event
An event pertaining to a specific room.
Attributes:
| Name | Type | Description |
|---|---|---|
room_id |
int
|
The id of the room this event was received from. |
room_name |
str
|
The name of the room this event was received from. |
sechat.events.RoomNameChangedEvent
Bases: UserEvent
This room's name, description, or tags were changed.
The room_name property will reflect the new name of this room, if its name was changed. user_id and user_name
will be the id and name of the user who performed the change.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
str
|
The new name and description of the room, separated by |
sechat.events.UnknownEvent
sechat.events.UserEnteredEvent
sechat.events.UserEvent
Bases: RoomEvent
An event with user information.
Attributes:
| Name | Type | Description |
|---|---|---|
user_id |
int
|
The id of the user who triggered this event. |
user_name |
str
|
The username of the user who sent the message. |
target_user_id |
Optional[int]
|
The id of the user targeted by this event. |
sechat.events.UserLeftEvent
sechat.events.UserNameOrAvatarChangedEvent
Bases: UserEvent
Someone's user details changed.
user_id will be -2 (Feeds); target_user_id will be the id of the user whose details changed.
sechat.events.UserNotificationEvent
Bases: UserEvent
One of several events occured which chat displays notifications for.
Known actions which can fire this event:
- A user requesting access to a gallery room which this account owns. The triggering user will be the user which requested access.
- A user being kicked from a room which this account owns. The triggering user will be Feeds (user -2).
user_id and user_name will be the user id and username of the user which _triggered_ the event;target_user_id` will be the user id of this account.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
str
|
A snippet of HTML containing the human-readable invite message which would be shown as a notification in the chat client. |
sechat.events.UserSuspendedEvent
Bases: UserEvent
This account was suspended from chat.
This is usually not a good event to receive. user_id and user_name will be the user id and username
of the moderator which created the suspension; target_user_id will be the user id of this account.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
str
|
A string containing an unknown number, then a space, then a JSON object with two keys: |