| 123456789101112131415161718192021222324252627282930313233343536 |
- import logging
- import slackclient
- import base
- import conf
- class SlackBot(base.Base):
- def __init__(self):
- self.client = slackclient.SlackClient(conf.SLACK_BOT_API_KEY)
- def _send(self, text):
- res = self.client.api_call(
- 'chat.postMessage',
- channel='voice_control',
- text=text
- )
- def success(self):
- self._send('Ok.')
-
- def failure(self, s=None):
- if s:
- self._send(s)
- else:
- self._send('Error.')
- def cancelled(self):
- self._send('Cancelled.')
-
- def tts(self, s):
- self._send(s)
- def text(self, s):
- self._send(s)
- def debug(self, s):
- self._send(s)
|