diff --git a/mallard/client.py b/mallard/client.py index 82accde..f47b2b7 100644 --- a/mallard/client.py +++ b/mallard/client.py @@ -133,6 +133,9 @@ async def on_ready(self): logger.info("Ready! \U0001f986") def _clean(self, message) -> Optional[str]: + """ + Filter mention from query + """ if message.author == self.user: return None if not message.content: diff --git a/mallard/config.py b/mallard/config.py index 4a1ec21..674423d 100644 --- a/mallard/config.py +++ b/mallard/config.py @@ -13,7 +13,7 @@ import yaml -def load_config(path): +def load_config(path) -> dict: with open(path, "r") as fh: obj = yaml.safe_load(fh) diff --git a/mallard/util.py b/mallard/util.py index 2e959fd..5e3a2c9 100644 --- a/mallard/util.py +++ b/mallard/util.py @@ -10,12 +10,21 @@ # WITHOUT ANY WARRANTY. See the LICENSE file for more details. # +import logging -def plural(n) -> str: +logger = logging.getLogger("mallard") + + +def plural(n: int) -> Optional[str]: if n == 1: return "" - else: + elif n > 0: return "s" + else: + logger.error("plural() passed value: %d, n should be a positive integer", n) + raise ValueError( + "n must be a positive integer" + ) # this will actuall never happen class DummyGuild: