def setup(self):
try:
config = self.container.config[constants.CONFIG_KEY]
except KeyError:
raise ConfigurationError(
'`{}` config key not found'.format(constants.CONFIG_KEY))
token = config.get('TOKEN')
clients = config.get('BOTS')
if token:
self.clients[constants.DEFAULT_BOT_NAME] = SlackClient(token)
if clients:
for bot_name, token in clients.items():
self.clients[bot_name] = SlackClient(token)
if not self.clients:
raise ConfigurationError(
'At least one token must be provided in `{}` config'
.format(constants.CONFIG_KEY))
评论列表
文章目录