From 913a3c0a8f12230a78f72fc16c9e596feb634366 Mon Sep 17 00:00:00 2001 From: hedy Date: Mon, 25 Mar 2024 12:39:21 +0800 Subject: Support issues closed as not-planned in GitHub Issue linking - Issue closed emoji is renamed to `issue_completed` to better reflect the `state_reason` key provided by the GitHub API that determines the usage of this emoji. --- bot/exts/utilities/githubinfo.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bot/exts/utilities/githubinfo.py') diff --git a/bot/exts/utilities/githubinfo.py b/bot/exts/utilities/githubinfo.py index f567f836..48474511 100644 --- a/bot/exts/utilities/githubinfo.py +++ b/bot/exts/utilities/githubinfo.py @@ -114,10 +114,11 @@ class GithubInfo(commands.Cog): # from issues: if the 'issues' key is present in the response then we can pull the data we # need from the initial API call. if "issues" in json_data["html_url"]: - if json_data.get("state") == "open": - emoji = Emojis.issue_open - else: - emoji = Emojis.issue_closed + emoji = Emojis.issue_open + if json_data.get("state") == "closed": + emoji = Emojis.issue_completed + if json_data.get("state_reason") == "not_planned": + emoji = Emojis.issue_not_planned # If the 'issues' key is not contained in the API response and there is no error code, then # we know that a PR has been requested and a call to the pulls API endpoint is necessary -- cgit v1.2.3