chat.slack

Platypush documentation

chat.slack#

class platypush.message.event.chat.slack.SlackAppMentionReceivedEvent(name, bases, namespace, /, **kwargs)[source]#

Bases: SlackMessageEvent

Event triggered when a message that mentions the app is received on a monitored resource.

__init__(*args, text: str, user: str, channel: str | None = None, team: str | None = None, icons: dict = None, blocks: Iterable[dict] = None, **kwargs)#
Parameters:
  • text – Message text.

  • user – ID of the sender.

  • channel – ID of the channel.

  • team – ID of the team.

  • icons – Mapping of the icons for this message.

  • blocks – Extra blocks in the message.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

mro()#

Return a type’s method resolution order.

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

register(subclass)#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.chat.slack.SlackEvent(name, bases, namespace, /, **kwargs)[source]#

Bases: Event, ABCMeta

Base class for Slack events.

__init__(*args, timestamp: int | float | datetime | None = None, **kwargs)[source]#
Parameters:

timestamp – Event timestamp.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

mro()#

Return a type’s method resolution order.

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

register(subclass)#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.chat.slack.SlackMessageDeletedEvent(name, bases, namespace, /, **kwargs)[source]#

Bases: SlackMessageEvent

Event triggered when a message is deleted from a monitored resource.

__init__(*args, text: str, user: str, channel: str | None = None, team: str | None = None, icons: dict = None, blocks: Iterable[dict] = None, **kwargs)#
Parameters:
  • text – Message text.

  • user – ID of the sender.

  • channel – ID of the channel.

  • team – ID of the team.

  • icons – Mapping of the icons for this message.

  • blocks – Extra blocks in the message.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

mro()#

Return a type’s method resolution order.

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

register(subclass)#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.chat.slack.SlackMessageEditedEvent(name, bases, namespace, /, **kwargs)[source]#

Bases: SlackMessageEvent

Event triggered when a message is edited on a monitored resource.

__init__(*args, text: str, user: str, channel: str | None = None, team: str | None = None, icons: dict = None, blocks: Iterable[dict] = None, **kwargs)#
Parameters:
  • text – Message text.

  • user – ID of the sender.

  • channel – ID of the channel.

  • team – ID of the team.

  • icons – Mapping of the icons for this message.

  • blocks – Extra blocks in the message.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

mro()#

Return a type’s method resolution order.

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

register(subclass)#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.chat.slack.SlackMessageEvent(name, bases, namespace, /, **kwargs)[source]#

Bases: SlackEvent, ABCMeta

Base class for message-related events.

__init__(*args, text: str, user: str, channel: str | None = None, team: str | None = None, icons: dict = None, blocks: Iterable[dict] = None, **kwargs)[source]#
Parameters:
  • text – Message text.

  • user – ID of the sender.

  • channel – ID of the channel.

  • team – ID of the team.

  • icons – Mapping of the icons for this message.

  • blocks – Extra blocks in the message.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

mro()#

Return a type’s method resolution order.

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

register(subclass)#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.chat.slack.SlackMessageReceivedEvent(name, bases, namespace, /, **kwargs)[source]#

Bases: SlackMessageEvent

Event triggered when a message is received on a monitored resource.

__init__(*args, text: str, user: str, channel: str | None = None, team: str | None = None, icons: dict = None, blocks: Iterable[dict] = None, **kwargs)#
Parameters:
  • text – Message text.

  • user – ID of the sender.

  • channel – ID of the channel.

  • team – ID of the team.

  • icons – Mapping of the icons for this message.

  • blocks – Extra blocks in the message.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

mro()#

Return a type’s method resolution order.

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

register(subclass)#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object