def close_incident(incident: Incident, user_id: str, message: str): comms_channel = CommsChannel.objects.get(incident=incident) action_list = Action.objects.filter(incident=incident) if incident.is_closed(): comms_channel.post_in_channel( f"This incident was already closed at {incident.end_time.strftime('%Y-%m-%d %H:%M:%S')}" ) return True, None incident.end_time = datetime.now() incident.save() comms_channel.post_in_channel( f"This incident has been closed! 📖 -> 📕") if action_list.exists(): get_action(incident, user_id, message) else: comms_channel.post_in_channel( f"There are no actions for this incident.\n You can still add one by using `@Incident Bot action ...`" ) comms_channel.archive_button(comms_channel.channel_id) return True, None
def close_incident(incident: Incident, user_id: str, message: str): comms_channel = CommsChannel.objects.get(incident=incident) if incident.is_closed(): comms_channel.post_in_channel( f"This incident was already closed at {incident.end_time.strftime('%Y-%m-%d %H:%M:%S')}" ) return True, None incident.end_time = datetime.now() incident.save() comms_channel.post_in_channel( f"This incident has been closed! 📖 -> 📕") return True, None