Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mallard/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion mallard/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 11 additions & 2 deletions mallard/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down