platform#

class besser.bot.platforms.platform.Platform[source]#

Bases: ABC

The platform abstract class.

A platform defines the methods the bot can use to interact with a particular communication channel (e.g. Telegram, Slack…) for instance, sending and receiving messages.

This class serves as a template to implement platforms.

Attributes:

running (bool): Whether the platform is running or not

_abc_impl = <_abc._abc_data object>#
abstract _send(session_id, payload)[source]#

Send a payload message to a specific user.

Parameters:
  • session_id (str) – the user to send the response to

  • payload (Payload) – the payload message to send to the user

abstract initialize()[source]#

Initialize the platform. This function is called right before starting the platform.

abstract reply(session, message)[source]#

Send a bot reply, i.e. a text message, to a specific user.

Parameters:
  • session (Session) – the user session

  • message (str) – the message to send to the user

run()[source]#

Run the platform.

abstract start()[source]#

Start the platform.

abstract stop()[source]#

Terminate the platform execution.