aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/seasons/evergreen/issues.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py
index a6fe7b57..d41467e8 100644
--- a/bot/seasons/evergreen/issues.py
+++ b/bot/seasons/evergreen/issues.py
@@ -11,7 +11,7 @@ icons = {"issue": "https://i.imgur.com/HFV0nv9.png",
"pull-request-closed": "https://i.imgur.com/JYmTn5P.png",
"merge": "https://i.imgur.com/xzQZxXe.png"}
-respValue = {404: "Issue/pull request not located! Please enter a valid number!",
+RESP_VALUE = {404: "Issue/pull request not located! Please enter a valid number!",
403: "rate limit has been hit! Please try again later!"}
@@ -22,7 +22,8 @@ class Issues(commands.Cog):
self.bot = bot
@commands.command(aliases=("pr",))
- async def issues(self, ctx: commands.Context, number: int, repository: str = "seasonalbot",
+ @override_in_channel()
+ async def issue(self, ctx: commands.Context, number: int, repository: str = "seasonalbot",
user: str = "python-discord") -> None:
"""Command to get issues/pull request from GitHub."""
url = f"https://api.github.com/repos/{user}/{repository}/issues/{str(number)}"
@@ -31,8 +32,8 @@ class Issues(commands.Cog):
async with self.bot.http_session.get(url) as r:
json_data = await r.json()
- if r.status in respValue:
- return await ctx.send(f"[{str(r.status)}] {respValue.get(r.status)}")
+ if r.status in RESP_VALUE:
+ return await ctx.send(f"[{str(r.status)}] {RESP_VALUE.get(r.status)}")
if "issues" in json_data.get("html_url"):
if json_data.get("state") == "open":
@@ -43,8 +44,10 @@ class Issues(commands.Cog):
async with self.bot.http_session.get(mergeURL) as m:
if json_data.get("state") == "open":
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")
+ # else by the process of elimination, the pull request has been closed
else:
iconURL = icons.get("pull-request-closed")