def _scrub_dead_channels_and_users(self): Channel.delete().where( ~(Channel.slack_id << self.known_slack_channel_ids)) User.delete().where(~(User.slack_id << self.known_slack_user_ids))
def remove_channels(update, context): remove = context.user_data['remove_channels'][:] for channel in remove: Channel.delete(channel) context.user_data['remove_channels'].remove(channel) return channels(update, context)