diff options
author | 2022-02-22 19:30:20 -0500 | |
---|---|---|
committer | 2022-02-22 19:30:20 -0500 | |
commit | 75b3a515910f04f295e0b70c208e8383b1783b7d (patch) | |
tree | 37b0303dec24c89e528f7a23c6d1364e2edc99bb | |
parent | 💡 Update docstrings to reflect changes (diff) |
👌 Fix indentation and update grammar for when only 1 channel remains
-rw-r--r-- | bot/exts/help_channels/_message.py | 17 | ||||
-rw-r--r-- | config-default.yml | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/bot/exts/help_channels/_message.py b/bot/exts/help_channels/_message.py index f8f10f774..39132b0f1 100644 --- a/bot/exts/help_channels/_message.py +++ b/bot/exts/help_channels/_message.py @@ -128,8 +128,8 @@ async def notify_none_remaining(last_notification: Arrow) -> t.Optional[Arrow]: """ Send a pinging message in `channel` notifying about there being no dormant channels remaining. - If a notification was sent, return the time at which the message was sent. - Otherwise, return None. + If a notification was sent, return the time at which the message was sent. + Otherwise, return None. Configuration: * `HelpChannels.notify_minutes` - minimum interval between notifications @@ -175,7 +175,7 @@ async def notify_running_low(number_of_channels_left: int, last_notification: Ar This will include the number of dormant channels left `number_of_channels_left` If a notification was sent, return the time at which the message was sent. - Otherwise, return None. + Otherwise, return None. Configuration: * `HelpChannels.notify_minutes` - minimum interval between notifications @@ -200,10 +200,13 @@ async def notify_running_low(number_of_channels_left: int, last_notification: Ar log.trace("Did not send notify_running notification as the notification channel couldn't be gathered.") try: - await channel.send( - f"There are only {number_of_channels_left} dormant channels left. " - "Consider participating in some help channels so that we don't run out." - ) + if number_of_channels_left == 1: + message = f"There is only {number_of_channels_left} dormant channel left. " + else: + message = f"There are only {number_of_channels_left} dormant channels left. " + message += "Consider participating in some help channels so that we don't run out." + await channel.send(message) + except Exception: # Handle it here cause this feature isn't critical for the functionality of the system. log.exception("Failed to send notification about running low of dormant channels!") diff --git a/config-default.yml b/config-default.yml index 6ad471cbd..dae923158 100644 --- a/config-default.yml +++ b/config-default.yml @@ -517,7 +517,7 @@ help_channels: notify_minutes: 15 # Minimum interval between none_remaining or running_low notifications notify_none_remaining: true # Pinging notification for the Helper role when no dormant channels remain - notify_none_remaining_roles: # Mention these roles in the non_remaining notification + notify_none_remaining_roles: # Mention these roles in the none_remaining notification - *HELPERS_ROLE notify_running_low: true # Non-pinging notification which is triggered when the channel count is equal or less than the threshold |