API Reference¶
Slack Plugin¶
-
class
sirbot.plugins.slack.SlackPlugin(*, token=None, verify=None, bot_id=None, bot_user_id=None, admins=None)[source]¶ Slack plugin.
Handle communication from / to slack
Parameters: - token – slack authentication token (environment variable: SLACK_TOKEN).
- verify – slack verification token (environment variable: SLACK_VERIFY).
- bot_id – bot id (environment variable: SLACK_BOT_ID).
- bot_user_id – user id of the bot (environment variable: SLACK_BOT_USER_ID).
- admins – list of slack admins user id (environment variable: SLACK_ADMINS).
-
on_action(action, handler, name='*', wait=True)[source]¶ Register handler for an action
Parameters: - action – callback_id of the incoming action
- handler – Handler to call
- name – Choice name of the action
- wait – Wait for handler execution before responding to the slack API.
-
on_command(command, handler, wait=True)[source]¶ Register handler for a command
Parameters: - command – Incoming command
- handler – Handler to call
- wait – Wait for handler execution before responding to the slack API.
-
on_event(event_type, handler, wait=True)[source]¶ Register handler for an event
Parameters: - event_type – Incoming event type
- handler – Handler to call
- wait – Wait for handler execution before responding to the slack API.
-
on_message(pattern, handler, mention=False, admin=False, wait=True, **kwargs)[source]¶ Register handler for a message
Parameters: - pattern – Pattern on which to match incoming message.
- handler – Handler to call
- mention – Only trigger handler when the bot is mentioned
- admin – Only trigger handler if posted by an admin
- wait – Wait for handler execution before responding to the slack API.