teamwire_api.events

Events

class Events(Enum)

Chat Event

NEW_MESSAGE

Event triggered when a new message arrives to a chat that the bot is subscribed to. The event handler is called with a Message object as extra parameter.

MESSAGE_READ

Event triggered when someone has read the latest messages in a chat. The extra argument will contain a MessageReadInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • user: User object. The user who read the message
  • message_id: unicode. The id of the last read message
  • read_date: datetime. When the message has been read

MESSAGE_DELETED

Event triggered when a message gets deleted by the sender. The extra argument will contain a MessageDeletedInfo object with the following attributes:

  • chat: Chat object. The chat this event refers to
  • message_id: unicode. The id of the deleted message

CHAT_CREATED

Event triggered when a new chat is created. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat (the Chat object representing the new chat)
  • title (string - the title of the new chat)

CHAT_JOINED

Event triggered when another user joins the chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat (the Chat object)
  • users (list of users that joined the chat)
  • editor (User object representing the user who invited the other user(s) to the chat)

CHAT_LEFT

Event triggered when some user leaves the chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat (the Chat object)
  • users (list of users that left the chat)
  • editor (User object representing the user who removed the other user(s) from the chat)

CHAT_DELETED

Event triggered when the bot is removed from a chat. The extra argument will contain a ChatMemberChangeInfo object with the following attributes:

  • chat (the Chat object)
  • users (list of users (including the bot's user) that were removed from the chat)
  • editor (User object representing the user who removed the other user(s) from the chat)

CHAT_TITLE_CHANGED

Event triggered when the title of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat (the Chat object)
  • title (the new title of the chat)
  • editor (User object representing the user who performed the operation)

CHAT_ADMINS_CHANGED

Event triggered when the administrators list of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat (the Chat object)
  • added_admins (list of users that were made chat administrators)
  • removed_admins (list of users that were removed from the administrators)
  • editor (User object representing the user who performed the operation)

CHAT_ALLOW_SENDING_CHANGED

Event triggered when the allow_sending property of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat (the Chat object)
  • allow_sending (boolean. Whether other members of the chat can send messages)
  • editor (User object representing the user who performed the operation)

CHAT_ALLOW_MUTE_NOTIFICATIONS_CHANGED

Event triggered when the allow_mute_notifications property of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat (the Chat object)
  • allow_mute_notifications (boolean. Whether members of the chat can mute notifications)
  • editor (User object representing the user who performed the operation)

CHAT_IS_CLOSED_CHANGED

Event triggered when the is_closed property of the chat has been changed. The extra argument will contain a ChatChangeInfo object with the following attributes:

  • chat (the Chat object)
  • is_closed (boolean. Whether the chat has been closed)
  • editor (User object representing the user who performed the operation)

ConnectionEvents

class ConnectionEvents(Enum)

Backend connectivity Event

BACKEND_CONNECTED

Event triggered when the bot is connected to the backend notifications service

BACKEND_DISCONNECTED

Event triggered when the bot has been disconnected from the backend notifications service (e.g. for network connectivity issues)