def __init__(self, *, token=None, verify=None, bot_id=None, bot_user_id=None, admins=None): self.api = None self.token = token or os.environ["SLACK_TOKEN"] self.admins = admins or os.environ.get("SLACK_ADMINS", []) self.verify = verify or os.environ["SLACK_VERIFY"] self.bot_id = bot_id or os.environ.get("SLACK_BOT_ID") self.bot_user_id = bot_user_id or os.environ.get("SLACK_BOT_USER_ID") self.handlers_option = {} if not self.bot_user_id: LOG.warning( "`SLACK_BOT_USER_ID` not set. It is required for `on mention` routing and discarding " "message coming from Sir Bot-a-lot to avoid loops.") self.routers = { "event": EventRouter(), "command": CommandRouter(), "message": MessageRouter(), "action": ActionRouter(), }
def __init__(self, *, token=None, verify=None, bot_id=None, bot_user_id=None, admins=None): self.api = None self.token = token or os.environ['SLACK_TOKEN'] self.admins = admins or os.environ.get('SLACK_ADMINS', []) self.verify = verify or os.environ['SLACK_VERIFY'] self.bot_id = bot_id or os.environ.get('SLACK_BOT_ID') self.bot_user_id = bot_user_id or os.environ.get('SLACK_BOT_USER_ID') self.handlers_option = {} if not self.bot_user_id: LOG.warning( '`SLACK_BOT_USER_ID` not set. It is required for `on mention` routing and discarding ' 'message coming from Sir Bot-a-lot to avoid loops.') self.routers = { 'event': EventRouter(), 'command': CommandRouter(), 'message': MessageRouter(), 'action': ActionRouter(), }
def event_router(): return EventRouter()