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