don't send message for nothing

This commit is contained in:
HgO 2022-07-11 23:43:27 +02:00
parent bb14e9dda8
commit 19d42fc1af

View file

@ -126,11 +126,12 @@ class Command:
f"Sorry, I couldn't find {count_alert_not_found} alerts, and thus I couldn't acknowledge them.",
)
await send_text_to_room(
self.client,
self.room.room_id,
f"Created {count_created_silences} silences with a duration of {duration}.",
)
if count_created_silences > 0:
await send_text_to_room(
self.client,
self.room.room_id,
f"Created {count_created_silences} silences with a duration of {duration}.",
)
async def _unack(self) -> None:
"""Delete an alert's acknowledgement of an alert and remove corresponding silence in Alertmanager"""
@ -179,11 +180,12 @@ class Command:
f"Sorry, I couldn't find {count_alert_not_found} alerts, and thus I couldn't unacknowledge them.",
)
await send_text_to_room(
self.client,
self.room.room_id,
f"Removed {count_removed_silences} silences.",
)
if count_removed_silences > 0:
await send_text_to_room(
self.client,
self.room.room_id,
f"Removed {count_removed_silences} silences.",
)
async def _show_help(self) -> None:
"""Show the help text"""