diff options
Diffstat (limited to 'bot/seasons/evergreen')
| -rw-r--r-- | bot/seasons/evergreen/issues.py | 23 | 
1 files changed, 13 insertions, 10 deletions
| diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index e836ead9..9713cfbd 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -8,7 +8,7 @@ from bot.decorators import override_in_channel  log = logging.getLogger(__name__) -icons = {"ISSUE": Emojis.issue, +ICONS = {"ISSUE": Emojis.issue,           "ISSUE_CLOSED": Emojis.issue_closed,           "PULL_REQUEST": Emojis.pull_request,           "PULL_REQUEST_CLOSED": Emojis.pull_request_closed, @@ -43,27 +43,30 @@ class Issues(commands.Cog):          # return data received from the API          if "issues" in json_data.get("html_url"):              if json_data.get("state") == "open": -                iconURL = icons.get("ISSUE") +                iconURL = ICONS.get("ISSUE")              else: -                iconURL = icons.get("ISSUE_CLOSED") +                iconURL = ICONS.get("ISSUE_CLOSED")          # if the word 'issues' is not contained within the returned data and there is no error code then we know that          # the requested data is a pr, hence to get the specifics on it we have to call the PR API endpoint allowing us          # to get the specific information in relation to the PR that is not provided via the issues endpoint          else:              async with self.bot.http_session.get(mergeURL) as m:                  if json_data.get("state") == "open": -                    iconURL = icons.get("PULL_REQUEST") +                    iconURL = ICONS.get("PULL_REQUEST")                  # when the status is 204 this means that the state of the PR is merged                  elif m.status == 204: -                    iconURL = icons.get("MERGE") +                    iconURL = ICONS.get("MERGE")                  # else by the process of elimination, the pull request has been closed                  else: -                    iconURL = icons.get("PULL_REQUEST_CLOSED") +                    iconURL = ICONS.get("PULL_REQUEST_CLOSED") -        resp = discord.Embed(colour=Colours.bright_green) -        resp.set_author( -            name=f"{iconURL} | [{repository}] #{number} {json_data.get('title')}", -            url=json_data.get("html_url")) +        issue_url = json_data.get("html_url") +        description_text = f"[{repository}] #{number} {json_data.get('title')}" +        resp = discord.Embed( +            colour=Colours.bright_green, +            description=f"{iconURL} [{description_text}]({issue_url})" +        ) +        resp.set_author(name="GitHub", url=issue_url)          await ctx.send(embed=resp) | 
