diff options
author | 2021-01-26 16:36:24 +0530 | |
---|---|---|
committer | 2021-01-26 16:36:24 +0530 | |
commit | 2dcdec0defb0f75478cd344cabd431d02b506741 (patch) | |
tree | 1c825fb9cf63fd7b144fb9b0c07366bccb91ee25 | |
parent | Merge branch 'feature/link_issues' of https://github.com/Shivansh-007/sir-lan... (diff) |
Remove debug code and add docstrings.
-rw-r--r-- | bot/exts/evergreen/issues.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bot/exts/evergreen/issues.py b/bot/exts/evergreen/issues.py index 1924d822..ba8a70cf 100644 --- a/bot/exts/evergreen/issues.py +++ b/bot/exts/evergreen/issues.py @@ -22,6 +22,7 @@ PYDIS_REPOS = "https://api.github.com/orgs/python-discord/repos" if GITHUB_TOKEN := Tokens.github: REQUEST_HEADERS["Authorization"] = f"token {GITHUB_TOKEN}" + class Issues(commands.Cog): """Cog that allows users to retrieve issues from GitHub.""" @@ -32,6 +33,7 @@ class Issues(commands.Cog): @tasks.loop(minutes=30) async def get_pydis_repos(self) -> None: + """Get all python-discord repositories on github.""" async with self.bot.http_session.get(PYDIS_REPOS) as resp: if resp.status == 200: data = await resp.json() @@ -42,6 +44,7 @@ class Issues(commands.Cog): @staticmethod def check_in_block(message: discord.Message, repo_issue: str) -> bool: + """Check whether the <repo>#<issue> is in codeblocks.""" block = ( re.findall(r"```([\s\S]*)?```", message.content) or re.findall(r"```*\n([\s\S]*)?\n```", message.content) @@ -49,7 +52,6 @@ class Issues(commands.Cog): or re.findall(r"```*\n([\s\S]*)?```", message.content) or re.findall(r"`([\s\S]*)?`", message.content) ) - print(block) if "#".join(repo_issue.split(" ")) in "".join([*block]): return True @@ -163,7 +165,6 @@ class Issues(commands.Cog): if message_repo_issue_map: for repo_issue in message_repo_issue_map: if self.check_in_block(message, " ".join([*repo_issue])): - print("in") continue else: result = await self.fetch_issues({repo_issue[1]}, repo_issue[0], "python-discord") |