def __init__(self, token, ping_interval=3, client=None, **kwargs):
"""
:param token: The slack API token.
:param ping_interval: The interval in seconds we should ping Slack
server to keep the connection alive.
:param client: By default, BigSlacker uses Slack official Python
client, but you can pass any other client here, provided it has
the same interface.
:param process_plugin_return: Defaults to True.
This process the output (return) of a plugin function we call as a
message to send. Therefore making it easy to "reply" to events.
If the plugin method returns None we do nothing.
Returning [(channel, message)] will make us send it. You can return one
or more messages.
:param sleeping_time: Every time we read data from the WebSocket we
sleep 1 second by default. If you have a different need, you can
override this setting.
"""
self.client = client or SlackClient(token)
self.ping_interval = ping_interval
self.process_plugin_return = kwargs.get('process_plugin_return', True)
self._injected_plugins = []
self._last_call = None
self._sleeping_time = kwargs.get('sleeping_time', 1)
self._custom_callbacks = {}
self._load_plugins()
评论列表
文章目录