diff options
| author | 2024-03-25 15:02:09 +0100 | |
|---|---|---|
| committer | 2024-03-25 15:02:09 +0100 | |
| commit | 0e45dbf726e1e7d5d09547b1f65796cff37c689f (patch) | |
| tree | fb60cd4a614ec2b37454ca6700559c66c84cd22a | |
| parent | Removed inactive users from `CODEOWNERS` (#1485) (diff) | |
| parent | Support issues closed as not-planned in GitHub Issue linking (diff) | |
Merge pull request #1487 from python-discord/feat/issue-state-icon
Support issues closed as not-planned in GitHub Issue linking
| -rw-r--r-- | bot/constants.py | 3 | ||||
| -rw-r--r-- | bot/exts/utilities/githubinfo.py | 9 | 
2 files changed, 7 insertions, 5 deletions
diff --git a/bot/constants.py b/bot/constants.py index 492ac918..707f99d2 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -166,7 +166,8 @@ class Emojis:      # These icons are from Github's repo https://github.com/primer/octicons/      issue_open = "<:IssueOpen:852596024777506817>" -    issue_closed = "<:IssueClosed:927326162861039626>" +    issue_completed = "<:IssueClosed:927326162861039626>" +    issue_not_planned = "<:IssueNotPlanned:1221642127595929610>"      issue_draft = "<:IssueDraft:852596025147523102>"  # Not currently used by Github, but here for future.      pull_request_open = "<:PROpen:852596471505223781>"      pull_request_closed = "<:PRClosed:852596024732286976>" 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  |