示例#1
0
def remind_close_incident(incident: Incident):
    try:
        comms_channel = CommsChannel.objects.get(incident=incident)
        if not incident.is_closed():
            comms_channel.post_in_channel(
                ":timer_clock: This incident has been running a long time.  Can it be closed now?"
            )
        elif incident.is_closed():
            comms_channel.post_in_channel(
                ":timer_clock: This incident has been closed for a long time.  Can the channel be archived?"
            )
    except CommsChannel.DoesNotExist:
        pass
示例#2
0
def remind_close_incident(incident: Incident):
    try:
        comms_channel = CommsChannel.objects.get(incident=incident)
        if not incident.is_closed():
            comms_channel.post_in_channel(":timer_clock: This incident has been running a long time.  Can it be closed now?  Remember to pin important messages in order to create the timeline.")
    except CommsChannel.DoesNotExist:
        pass
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
示例#4
0
def remind_client_comms(incident: Incident):
    try:
        comms_channel = CommsChannel.objects.get(incident=incident)
        if not incident.is_closed() and incident.severity < "4":
            comms_channel.post_in_channel(
                "Has the client been updated? :shrug:")
    except CommsChannel.DoesNotExist:
        pass
示例#5
0
def remind_status_page(incident: Incident):
    try:
        comms_channel = CommsChannel.objects.get(incident=incident)
        if not incident.is_closed() and incident.severity < "4":
            comms_channel.post_in_channel(
                ":statuspage: Do we need to put up a statuspage? To do so, use the command `@Incident Bot statuspage`"
            )
    except CommsChannel.DoesNotExist:
        pass
示例#6
0
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