123456789101112 |
- def archive_channel(self, channel, alert):
- """ Archive a channel, and send alert to slack admins. """
- api_endpoint = 'channels.archive'
- stdout_message = 'Archiving channel... %s' % channel['name']
- self.logger.info(stdout_message)
- if not self.settings.get('dry_run'):
- channel_message = alert.format(self.settings.get('days_inactive'))
- self.send_channel_message(channel['id'], channel_message)
- payload = {'channel': channel['id']}
- self.slack_api_http(api_endpoint=api_endpoint, payload=payload)
- self.logger.info(stdout_message)
|