-
Notifications
You must be signed in to change notification settings - Fork 0
Events
Events, like Attachments, can be chained. Some, like poll.creation
, always occur simultaneously with Attachments. Events primarily handle Poll actions and user/group changes (nicknames, entering/leaving the chat, etc.).
This is the autogenerated system Event for when a user changes their nickname. It only occurs as an Event to the system message that announces the name change.
type: "membership.nickname_changed"
data: {
user: {
id: (id num)
nickname: (string) # user's original nickname
}
name: (string) # user's new nickname
}
This is the autogenerated system Event for when a user joins the chat. This is not to be confused for when a user is added to the chat; the user must join the chat through some external method. It only occurs as an Event to the system message that announces the join. I'm not sure if there can be multiple joining users in this event, but I've only encountered it as singles.
type: "membership.announce.joined"
data: {
user: {
id: (id num)
nickname: (string) # user's original nickname
}
}
This is the autogenerated system Event for when a user is added the chat. This is not to be confused for when a user joined the chat; a user already in the chat must add the added user. It only occurs as an Event to the system message that announces the added user(s). This can occur with a single added user, or multiple. The maximum number of added users per added
message I've found is 4.
type: "membership.announce.added"
data: {
added_users: {
{
id: (id num)
nickname: (string) # added user's nickname
}...
},
adder_user: {
id: (id num)
nickname: (string) # adding user's nickname
}
}
This is the autogenerated system Event for when a user exits the chat. This is not to be confused with when a user is removed from the chat; the user must leave the chat of their own accord. It only occurs as an Event to the system message that announces the exited user. I'm not sure if there can be multiple exiting users in this event, but I've only encountered it as singles.
type: "membership.notifications.exited"
data: {
removed_user: {
id: (id num)
nickname: (string) # exited user nickname
}
}
This is the autogenerated system Event for when a user is kicked from the chat. This is not to be confused with when a user exited the chat; the user must be removed by another user in the chat. It only occurs as an Event to the system message that announces the removed user(s). I'm not sure if this can occur with multiple users in one message.
type: "membership.notifications.removed"
data: {
remover_user: {
id: (id num)
nickname: (string) # removing user nickname
},
removed_user: {
id: (id num)
nickname: (string) # removed user nickname
}
}
This is the autogenerated system Event for when a user is autokicked from the chat. It only occurs as an Event to the system message that announces the removed user(s). I don't know the exact conditions in which this occurs, but I think the user must have been added by another user and not fulfilled an activity condition (maybe entering the chat on their device?) within a certain period of time.
type: "membership.notifications.autokicked"
data: {
user: {
id: (id num)
nickname: (string) # kicked user's nickname
}
}
This is the autogenerated system Event for when a user changes the group avatar. It only occurs as an Event to the system message that announces the avatar change.
type: "group.avatar_change"
data: {
user: {
id: (id num)
nickname: (string) # avatar changing user's nickname
},
avatar_url: (url string) (image url to the new avatar)
}
This is the autogenerated system Event for when a user changes the group like icon. It only occurs as an Event to the system message that announces the icon change. The pack_id
and pack_index
seem to be analogous to the charmap pac_id
and charmap offset
of the Emoji Attachment. I have no idea what [like_icon][type]
could be. Maybe a remnant of a plan to let users upload their own like icons?
type: "group.like_icon_set"
data: {
user: {
id: (id num)
nickname: (string) # icon changing user's nickname
},
like_icon: {
pack_id: (int)
pack_index: (int)
type: (string) # only encountered "emoji"
}
This is the autogenerated system Event for when a user changes the group name. It only occurs as an Event to the system message that announces the name change.
type: "group.name_change"
data: {
user: {
id: (id num)
nickname: (string) # name changing user's nickname
},
name: (string) # new group name
}
This is the Event for when a user creates a poll. It occurs simultaneously with the Poll Attachment. I'm not sure what conversation
refers to. The [poll][id]
is referred to in the following poll.reminder
and poll.expired
Events. If you're wanting to see the poll choices and votes, see poll.finished.
type: "poll.created"
data: {
conversation: {
id: (id num)
nickname: (string) # name changing user's nickname
},
poll: {
id: (id num)
subject: (string) # poll title
},
user: {
id: (id num)
nickname: (string) # poll creating user's nickname
}
}
This is the Event for the reminder to vote on a poll. It only occurs as an Event to the reminder system message. I'm not sure what conversation
refers to. The expiration
value is an integer that refers to the expiration of the poll in Epoch Time. An easy 2-way Epoch Time converter can be found here. I use the datetime
package to do the conversion in my code.
type: "poll.reminder"
data: {
conversation: {
id: (id num)
},
poll: {
expiration: (epoch time int)
id: (id num)
subject: (string) # poll title
}
}
This is the Event for when a poll expires. It only occurs as an Event to the expiration system message. I'm not sure what conversation
refers to. Under options
, every poll option has a group of 4 values. So if there were 3 options, there would be 3 id
s and 3 title
s. If an option received no votes, the votes
and voter_ids
values will not exist.
type: "poll.finished"
data: {
conversation: {
id: (id num)
},
options: {
{
id: (int) # starting at 1, increasing by 1 for each poll option)
title: (string) # name of poll option
votes: (int)
voter_ids: [(id num)...]
}...
}
}
This is the Event for the reminder to vote on a poll. It only occurs as an Event to the reminder system message. I'm not sure what conversation
refers to. The expiration
value is an integer that refers to the expiration of the poll in Epoch Time. An easy 2-way Epoch Time converter can be found here. I use the datetime
package to do the conversion in my code.
type: "message.deleted"
data: {
message_id: (id num)
deleted_at: (epoch time int) # see the Poll Reminder section for more info)
deletion_actor: (string) # I've only encountered "sender" (self-deleted), but if someone deleted another person's message it could be different
deleter_id: (id num)
}