From bdba069af390363f47d4b59d3be74ce8fcad3c5a Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Thu, 10 Sep 2015 09:54:09 -0700 Subject: [PATCH] !stars: Fix plural if repository only has one stargazer --- commands/stars.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/stars.py b/commands/stars.py index a379f3b..74810dd 100644 --- a/commands/stars.py +++ b/commands/stars.py @@ -43,9 +43,11 @@ class Stars(Command): if info is None: self.reply(data, "Repository not found. Is it private?") else: - msg = "\x0303{0}\x0F has \x02{1}\x0F stargazers: {2}" + count = int(info["stargazers_count"]) + plural = "" if count == 1 else "s" + msg = "\x0303{0}\x0F has \x02{1}\x0F stargazer{2}: {3}" self.reply(data, msg.format( - info["full_name"], info["stargazers_count"], info["html_url"])) + info["full_name"], count, plural, info["html_url"])) def get_repo(self, repo): """Return the API JSON dump for a given repository.