def start(token,
          control=False,
          trigger='!',
          groups=None,
          groups_pillar_name=None,
          fire_all=False,
          tag='salt/engines/slack'):
    '''
    Listen to slack events and forward them to salt, new version
    '''

    if (not token) or (not token.startswith('xoxb')):
        time.sleep(2)  # don't respawn too quickly
        log.error('Slack bot token not found, bailing...')
        raise UserWarning('Slack Engine bot token not configured')

    try:
        client = SlackClient(token=token)
        message_generator = client.generate_triggered_messages(token, trigger, groups, groups_pillar_name)
        client.run_commands_from_slack_async(message_generator, fire_all, tag, control)
    except Exception:
        raise Exception('{}'.format(traceback.format_exc()))
def start ( token , control = False , trigger = '!' , groups = None , groups_pillar_name = None , fire_all = False , tag = 'salt/engines/slack' ) : if ( not token ) or ( not token . startswith ( 'xoxb' ) ) : time . sleep ( 2 ) log . error ( 'Slack bot token not found, bailing...' ) raise UserWarning ( 'Slack Engine bot token not configured' ) try : client = SlackClient ( token = token ) message_generator = client . generate_triggered_messages ( token , trigger , groups , groups_pillar_name ) client . run_commands_from_slack_async ( message_generator , fire_all , tag , control ) except Exception : raise Exception ( '{}' . format ( traceback . format_exc ( ) ) )
Listen to slack events and forward them to salt, new version