def __init__(self, token, channels=[], events=[FAILURE], max_events=5, username='******', as_user=False, use_private_channels=True, task_representation=str, print_env=[]): if not isinstance(events, list): raise ValueError('events must be a list, {} given'.format( type(events))) if not channels: log.info('SlackBot(channels=[]): notifications are not sent') self.events = events self._events_to_handle = self.events + [SUCCESS, START] self.client = SlackAPI(token, username, as_user, use_private_channels=use_private_channels) self.channels = channels self.max_events = max_events self.event_queue = defaultdict(list) self.task_repr = task_representation self._print_env = print_env