aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/events/hacktoberfest/hacktober-issue-finder.py
diff options
context:
space:
mode:
authorGravatar Xithrius <[email protected]>2022-11-02 02:07:29 -0700
committerGravatar GitHub <[email protected]>2022-11-02 02:07:29 -0700
commit43a2acf5ee4eb354ce3dfaeef9504eee9b9b46b4 (patch)
treecbdfeb08f8d582aa98acec6a529f0fa3dcd7933c /bot/exts/events/hacktoberfest/hacktober-issue-finder.py
parentAppeased the formatter (diff)
parentMerge pull request #1137 from DivyanshuBist/bug-issue1122-message-of-type-None (diff)
Merge branch 'main' into main
Diffstat (limited to 'bot/exts/events/hacktoberfest/hacktober-issue-finder.py')
-rw-r--r--bot/exts/events/hacktoberfest/hacktober-issue-finder.py9
1 files changed, 5 insertions, 4 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))