aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/events/hacktoberfest
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/events/hacktoberfest')
-rw-r--r--bot/exts/events/hacktoberfest/hacktober-issue-finder.py9
-rw-r--r--bot/exts/events/hacktoberfest/hacktoberstats.py4
-rw-r--r--bot/exts/events/hacktoberfest/timeleft.py4
3 files changed, 9 insertions, 8 deletions
diff --git a/bot/exts/events/hacktoberfest/hacktober-issue-finder.py b/bot/exts/events/hacktoberfest/hacktober-issue-finder.py
index 1774564b..aeffc8d7 100644
--- a/bot/exts/events/hacktoberfest/hacktober-issue-finder.py
+++ b/bot/exts/events/hacktoberfest/hacktober-issue-finder.py
@@ -100,8 +100,9 @@ class HacktoberIssues(commands.Cog):
"""Format the issue data into a embed."""
title = issue["title"]
issue_url = issue["url"].replace("api.", "").replace("/repos/", "/")
- # issues can have empty bodies, which in that case GitHub doesn't include the key in the API response
- body = issue.get("body", "")
+ # Issues can have empty bodies, resulting in the value being a literal `null` (parsed as `None`).
+ # For this reason, we can't use the default arg of `dict.get`, and so instead use `or` logic.
+ body = issue.get("body") or ""
labels = [label["name"] for label in issue["labels"]]
embed = discord.Embed(title=title)
@@ -113,6 +114,6 @@ class HacktoberIssues(commands.Cog):
return embed
-def setup(bot: Bot) -> None:
+async def setup(bot: Bot) -> None:
"""Load the HacktoberIssue finder."""
- bot.add_cog(HacktoberIssues(bot))
+ await bot.add_cog(HacktoberIssues(bot))
diff --git a/bot/exts/events/hacktoberfest/hacktoberstats.py b/bot/exts/events/hacktoberfest/hacktoberstats.py
index 72067dbe..c29e24b0 100644
--- a/bot/exts/events/hacktoberfest/hacktoberstats.py
+++ b/bot/exts/events/hacktoberfest/hacktoberstats.py
@@ -432,6 +432,6 @@ class HacktoberStats(commands.Cog):
return author_id, author_mention
-def setup(bot: Bot) -> None:
+async def setup(bot: Bot) -> None:
"""Load the Hacktober Stats Cog."""
- bot.add_cog(HacktoberStats(bot))
+ await bot.add_cog(HacktoberStats(bot))
diff --git a/bot/exts/events/hacktoberfest/timeleft.py b/bot/exts/events/hacktoberfest/timeleft.py
index 55109599..f470e932 100644
--- a/bot/exts/events/hacktoberfest/timeleft.py
+++ b/bot/exts/events/hacktoberfest/timeleft.py
@@ -62,6 +62,6 @@ class TimeLeft(commands.Cog):
)
-def setup(bot: Bot) -> None:
+async def setup(bot: Bot) -> None:
"""Load the Time Left Cog."""
- bot.add_cog(TimeLeft())
+ await bot.add_cog(TimeLeft())