From 3177f6ae35c4f60134a02248a07c3f590298e85e Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Wed, 2 Oct 2019 20:59:25 +0100 Subject: New more succinct output. --- bot/seasons/evergreen/issues.py | 85 ++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 40 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 438ab475..a0969e50 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,55 +3,60 @@ import logging import discord from discord.ext import commands -from bot.constants import Colours -from bot.decorators import override_in_channel - log = logging.getLogger(__name__) +icons = {"issue": "https://i.imgur.com/HFV0nv9.png", + "issue-closed": "https://i.imgur.com/uZSX7as.png", + "pull-request": "https://i.imgur.com/zHhnALX.png", + "pull-request-closed": "https://i.imgur.com/JYmTn5P.png", + "merge": "https://i.imgur.com/xzQZxXe.png"} -class Issues(commands.Cog): - """Cog that allows users to retrieve issues from GitHub.""" +respValue = {404: "Issue/pull request not located! Please enter a valid number!", + 403: "rate limit has been hit! Please try again later!"} - def __init__(self, bot: commands.Bot): - self.bot = bot - - @commands.command(aliases=("issues",)) - @override_in_channel() - async def issue( - self, ctx: commands.Context, number: int, repository: str = "seasonalbot", user: str = "python-discord" - ) -> None: - """Command to retrieve issues from a GitHub repository.""" - api_url = f"https://api.github.com/repos/{user}/{repository}/issues/{number}" - failed_status = { - 404: f"Issue #{number} doesn't exist in the repository {user}/{repository}.", - 403: f"Rate limit exceeded. Please wait a while before trying again!" - } - - async with self.bot.http_session.get(api_url) as r: - json_data = await r.json() - response_code = r.status - if response_code in failed_status: - return await ctx.send(failed_status[response_code]) - - repo_url = f"https://github.com/{user}/{repository}" - issue_embed = discord.Embed(colour=Colours.bright_green) - issue_embed.add_field(name="Repository", value=f"[{user}/{repository}]({repo_url})", inline=False) - issue_embed.add_field(name="Issue Number", value=f"#{number}", inline=False) - issue_embed.add_field(name="Status", value=json_data["state"].title()) - issue_embed.add_field(name="Link", value=json_data["html_url"], inline=False) +class Issues(commands.Cog): + """Cog that allows users to retrieve issues from GitHub""" - description = json_data["body"] - if len(description) > 1024: - placeholder = " [...]" - description = f"{description[:1024 - len(placeholder)]}{placeholder}" + def __init__(self, bot): + self.bot = bot - issue_embed.add_field(name="Description", value=description, inline=False) + @commands.command(aliases=("pr",)) + async def issues(self, ctx, number: int, repository: str = "seasonalbot", user: str = "python-discord"): + """Command to get issues/pull request from GitHub""" + url = f"https://api.github.com/repos/{user}/{repository}/issues/{str(number)}" + mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{str(number)}/merge" - await ctx.send(embed=issue_embed) + 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 "issues" in json_data.get("html_url"): + if json_data.get("state") == "open": + iconURL = icons.get("issue") + else: + iconURL = icons.get("issue_closed") + else: + async with self.bot.http_session.get(mergeURL) as m: + if json_data.get("state") == "open": + iconURL = icons.get("pull-request") + elif m.status == 204: + iconURL = icons.get("merge") + else: + iconURL = icons.get("pull-request-closed") + + resp = discord.Embed(colour=0x6CC644) + resp.set_author( + name=f"[{repository}] #{number} {json_data.get('title')}", + url=json_data.get("html_url"), + icon_url=iconURL) + await ctx.send(embed=resp) + + +def setup(bot): + """Cog Retrieves Issues From Github""" -def setup(bot: commands.Bot) -> None: - """Github Issues Cog Load.""" bot.add_cog(Issues(bot)) log.info("Issues cog loaded") -- cgit v1.2.3 From ecc2e3b1bbcda1c841b9cb2d0e96809cefe66261 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Wed, 2 Oct 2019 21:10:15 +0100 Subject: Linting --- bot/seasons/evergreen/issues.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index a0969e50..5f46e1e6 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -22,7 +22,7 @@ class Issues(commands.Cog): self.bot = bot @commands.command(aliases=("pr",)) - async def issues(self, ctx, number: int, repository: str = "seasonalbot", user: str = "python-discord"): + async def issues(self, ctx, 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)}" mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{str(number)}/merge" @@ -55,8 +55,7 @@ class Issues(commands.Cog): await ctx.send(embed=resp) -def setup(bot): +def setup(bot) -> None: """Cog Retrieves Issues From Github""" - bot.add_cog(Issues(bot)) log.info("Issues cog loaded") -- cgit v1.2.3 From 9376aeafd94c5c26d0f80ad995fe0487e027d97e Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Wed, 2 Oct 2019 21:15:34 +0100 Subject: Final Linting --- bot/seasons/evergreen/issues.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 5f46e1e6..ddcdb265 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -18,12 +18,13 @@ respValue = {404: "Issue/pull request not located! Please enter a valid number!" class Issues(commands.Cog): """Cog that allows users to retrieve issues from GitHub""" - def __init__(self, bot): + def __init__(self, bot: commands.Bot): self.bot = bot @commands.command(aliases=("pr",)) - async def issues(self, ctx, number: int, repository: str = "seasonalbot", user: str = "python-discord") -> None: - """Command to get issues/pull request from GitHub""" + async def issues(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)}" mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{str(number)}/merge" @@ -56,6 +57,6 @@ class Issues(commands.Cog): def setup(bot) -> None: - """Cog Retrieves Issues From Github""" - bot.add_cog(Issues(bot)) + """Cog Retrieves Issues From Github.""" + bot.add_cog(Issues(bot: commands.Bot)) log.info("Issues cog loaded") -- cgit v1.2.3 From 618b9d512b6772dcd6e106972623f840a9833f29 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Wed, 2 Oct 2019 21:17:58 +0100 Subject: Syntax Error Fix --- bot/seasons/evergreen/issues.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index ddcdb265..07f1a508 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -56,7 +56,7 @@ class Issues(commands.Cog): await ctx.send(embed=resp) -def setup(bot) -> None: +def setup(bot: commands.Bot) -> None: """Cog Retrieves Issues From Github.""" - bot.add_cog(Issues(bot: commands.Bot)) + bot.add_cog(Issues(bot)) log.info("Issues cog loaded") -- cgit v1.2.3 From cda6fe789f411cf18e4d468dcbfbf0b2b1f1bbca Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Wed, 2 Oct 2019 21:27:01 +0100 Subject: Final Final Linting Error D415 --- bot/seasons/evergreen/issues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 07f1a508..a6fe7b57 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -16,7 +16,7 @@ respValue = {404: "Issue/pull request not located! Please enter a valid number!" class Issues(commands.Cog): - """Cog that allows users to retrieve issues from GitHub""" + """Cog that allows users to retrieve issues from GitHub.""" def __init__(self, bot: commands.Bot): self.bot = bot -- cgit v1.2.3 From 2e89209053713af46bfae832ce4d5f74188683e0 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Thu, 3 Oct 2019 17:58:47 +0100 Subject: Resloved requested changes --- bot/seasons/evergreen/issues.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bot') 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") -- cgit v1.2.3 From fb15e331d794c204db74f506f91828699c4f5968 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Thu, 3 Oct 2019 18:22:33 +0100 Subject: Flake8 Fixing --- bot/seasons/evergreen/issues.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index d41467e8..708f5d15 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,6 +3,8 @@ import logging import discord from discord.ext import commands +from bot.decorators import override_in_channel + log = logging.getLogger(__name__) icons = {"issue": "https://i.imgur.com/HFV0nv9.png", @@ -12,7 +14,7 @@ icons = {"issue": "https://i.imgur.com/HFV0nv9.png", "merge": "https://i.imgur.com/xzQZxXe.png"} RESP_VALUE = {404: "Issue/pull request not located! Please enter a valid number!", - 403: "rate limit has been hit! Please try again later!"} + 403: "rate limit has been hit! Please try again later!"} class Issues(commands.Cog): @@ -24,7 +26,7 @@ class Issues(commands.Cog): @commands.command(aliases=("pr",)) @override_in_channel() async def issue(self, ctx: commands.Context, number: int, repository: str = "seasonalbot", - user: str = "python-discord") -> None: + 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)}" mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{str(number)}/merge" -- cgit v1.2.3 From c2df3759d697db782f9553b7fdef646291f427e9 Mon Sep 17 00:00:00 2001 From: Numerlor Date: Thu, 3 Oct 2019 20:11:59 +0200 Subject: limit issue command to global whitelist and seasonalbot_chat --- bot/seasons/evergreen/issues.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 438ab475..08d78e30 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,10 +3,11 @@ import logging import discord from discord.ext import commands -from bot.constants import Colours +from bot.constants import Channels, Colours, WHITELISTED_CHANNELS from bot.decorators import override_in_channel log = logging.getLogger(__name__) +ISSUE_WHITELIST = WHITELISTED_CHANNELS + (Channels.seasonalbot_chat,) class Issues(commands.Cog): @@ -16,7 +17,7 @@ class Issues(commands.Cog): self.bot = bot @commands.command(aliases=("issues",)) - @override_in_channel() + @override_in_channel(ISSUE_WHITELIST) async def issue( self, ctx: commands.Context, number: int, repository: str = "seasonalbot", user: str = "python-discord" ) -> None: -- cgit v1.2.3 From eaf49758e7a175aeeeeafdb66c3c1a5fc96a4b10 Mon Sep 17 00:00:00 2001 From: Numerlor Date: Thu, 3 Oct 2019 20:21:39 +0200 Subject: add the adventofcode channel to Channels constant --- bot/constants.py | 1 + 1 file changed, 1 insertion(+) (limited to 'bot') diff --git a/bot/constants.py b/bot/constants.py index 0d4321c8..c1722158 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -22,6 +22,7 @@ class AdventOfCode: class Channels(NamedTuple): admins = 365960823622991872 + advent_of_code = 517745814039166986 announcements = int(environ.get("CHANNEL_ANNOUNCEMENTS", 354619224620138496)) big_brother_logs = 468507907357409333 bot = 267659945086812160 -- cgit v1.2.3 From 9d6ea0f020a448cb1498f0c4eeb560858c510a69 Mon Sep 17 00:00:00 2001 From: Numerlor Date: Thu, 3 Oct 2019 20:27:09 +0200 Subject: limit Advent Of Code commands to global whitelist and the AoC channel --- bot/seasons/christmas/adventofcode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py index 513c1020..a88e5ac3 100644 --- a/bot/seasons/christmas/adventofcode.py +++ b/bot/seasons/christmas/adventofcode.py @@ -13,7 +13,7 @@ from bs4 import BeautifulSoup from discord.ext import commands from pytz import timezone -from bot.constants import AdventOfCode as AocConfig, Channels, Colours, Emojis, Tokens +from bot.constants import AdventOfCode as AocConfig, Channels, Colours, Emojis, Tokens, WHITELISTED_CHANNELS from bot.decorators import override_in_channel log = logging.getLogger(__name__) @@ -24,6 +24,8 @@ AOC_SESSION_COOKIE = {"session": Tokens.aoc_session_cookie} EST = timezone("EST") COUNTDOWN_STEP = 60 * 5 +AOC_WHITELIST = WHITELISTED_CHANNELS + (Channels.advent_of_code,) + def is_in_advent() -> bool: """Utility function to check if we are between December 1st and December 25th.""" @@ -126,7 +128,7 @@ class AdventOfCode(commands.Cog): self.status_task = asyncio.ensure_future(self.bot.loop.create_task(status_coro)) @commands.group(name="adventofcode", aliases=("aoc",), invoke_without_command=True) - @override_in_channel() + @override_in_channel(AOC_WHITELIST) async def adventofcode_group(self, ctx: commands.Context) -> None: """All of the Advent of Code commands.""" await ctx.send_help(ctx.command) -- cgit v1.2.3 From bc866f5e5bdfe49318601a12c5bac8134d5c06be Mon Sep 17 00:00:00 2001 From: Numerlor Date: Fri, 4 Oct 2019 21:06:32 +0200 Subject: override global whitelist on all hacktober subcommands --- bot/seasons/halloween/hacktoberstats.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bot') diff --git a/bot/seasons/halloween/hacktoberstats.py b/bot/seasons/halloween/hacktoberstats.py index 9ad44e3f..ab8d865c 100644 --- a/bot/seasons/halloween/hacktoberstats.py +++ b/bot/seasons/halloween/hacktoberstats.py @@ -58,6 +58,7 @@ class HacktoberStats(commands.Cog): await self.get_stats(ctx, github_username) @hacktoberstats_group.command(name="link") + @override_in_channel(HACKTOBER_WHITELIST) async def link_user(self, ctx: commands.Context, github_username: str = None) -> None: """ Link the invoking user's Github github_username to their Discord ID. @@ -91,6 +92,7 @@ class HacktoberStats(commands.Cog): await ctx.send(f"{author_mention}, a GitHub username is required to link your account") @hacktoberstats_group.command(name="unlink") + @override_in_channel(HACKTOBER_WHITELIST) async def unlink_user(self, ctx: commands.Context) -> None: """Remove the invoking user's account link from the log.""" author_id, author_mention = HacktoberStats._author_mention_from_context(ctx) -- cgit v1.2.3 From 9f176ee92273251177894335444efe7a6f103e3a Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Sun, 6 Oct 2019 18:15:47 +0100 Subject: Updated the explination of API calls --- bot/seasons/evergreen/issues.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 708f5d15..6c84ae2d 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -36,12 +36,19 @@ class Issues(commands.Cog): if r.status in RESP_VALUE: return await ctx.send(f"[{str(r.status)}] {RESP_VALUE.get(r.status)}") - + + # the original call is made to the issues API endpoint + # if a issue or PR exists then there will be something returned + # if the word 'issues' is present within the response then we can simply pull the data we need from the + # return data received from the API if "issues" in json_data.get("html_url"): if json_data.get("state") == "open": iconURL = icons.get("issue") else: 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": -- cgit v1.2.3 From bf265601ffd95d1f42b63c086b51b3ec519da344 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Sun, 6 Oct 2019 18:21:26 +0100 Subject: Lint error --- bot/seasons/evergreen/issues.py | 1 - 1 file changed, 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 6c84ae2d..6438c363 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -36,7 +36,6 @@ class Issues(commands.Cog): if r.status in RESP_VALUE: return await ctx.send(f"[{str(r.status)}] {RESP_VALUE.get(r.status)}") - # the original call is made to the issues API endpoint # if a issue or PR exists then there will be something returned # if the word 'issues' is present within the response then we can simply pull the data we need from the -- cgit v1.2.3 From 1f30799e0d6f27fe1f62a047a4b46a6fba8e9694 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Sun, 6 Oct 2019 18:32:10 +0100 Subject: Updated location of emojis --- bot/seasons/evergreen/issues.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 6438c363..fdf95d7e 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -7,11 +7,11 @@ from bot.decorators import override_in_channel log = logging.getLogger(__name__) -icons = {"issue": "https://i.imgur.com/HFV0nv9.png", - "issue-closed": "https://i.imgur.com/uZSX7as.png", - "pull-request": "https://i.imgur.com/zHhnALX.png", - "pull-request-closed": "https://i.imgur.com/JYmTn5P.png", - "merge": "https://i.imgur.com/xzQZxXe.png"} +icons = {"issue": "<:IssueOpen:629695470327037963>", + "issue-closed": "<:IssueClosed:629695470570307614>", + "pull-request": "<:PROpen:629695470175780875>", + "pull-request-closed": "<:PRClosed:629695470519713818>", + "merge": "<:PRMerged:629695470570176522>"} RESP_VALUE = {404: "Issue/pull request not located! Please enter a valid number!", 403: "rate limit has been hit! Please try again later!"} @@ -61,9 +61,8 @@ class Issues(commands.Cog): resp = discord.Embed(colour=0x6CC644) resp.set_author( - name=f"[{repository}] #{number} {json_data.get('title')}", - url=json_data.get("html_url"), - icon_url=iconURL) + name=f"{iconURL} | [{repository}] #{number} {json_data.get('title')}", + url=json_data.get("html_url")) await ctx.send(embed=resp) -- cgit v1.2.3 From fd01d17a5c29f626c5dc37bfcf5df0a1bd6a17d1 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 7 Oct 2019 16:42:57 +0100 Subject: Made use of constants file instead of hard coding --- bot/seasons/evergreen/issues.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index fdf95d7e..c764cd57 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,15 +3,16 @@ import logging import discord from discord.ext import commands +from bot.constants import Emojis from bot.decorators import override_in_channel log = logging.getLogger(__name__) -icons = {"issue": "<:IssueOpen:629695470327037963>", - "issue-closed": "<:IssueClosed:629695470570307614>", - "pull-request": "<:PROpen:629695470175780875>", - "pull-request-closed": "<:PRClosed:629695470519713818>", - "merge": "<:PRMerged:629695470570176522>"} +icons = {"issue": Emojis.issue, + "issue-closed": Emojis.issue_closed, + "pull-request": Emojis.pull_request, + "pull-request-closed": Emojis.pull_request_closed, + "merge": Emojis.merge} RESP_VALUE = {404: "Issue/pull request not located! Please enter a valid number!", 403: "rate limit has been hit! Please try again later!"} -- cgit v1.2.3 From 960ed42684c2d5a49464c4bc68c52ad5d94edc28 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 7 Oct 2019 16:43:21 +0100 Subject: Added GitHub emojis to constants file --- bot/constants.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bot') diff --git a/bot/constants.py b/bot/constants.py index 0d4321c8..124c48ae 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -86,6 +86,12 @@ class Emojis: terning5 = "<:terning5:431249716328792064>" terning6 = "<:terning6:431249726705369098>" + issue = "<:IssueOpen:629695470327037963>", + issue_closed = "<:IssueClosed:629695470570307614>", + pull_request = "<:PROpen:629695470175780875>", + pull_request_closed = "<:PRClosed:629695470519713818>", + merge = "<:PRMerged:629695470570176522>" + class Lovefest: role_id = int(environ.get("LOVEFEST_ROLE_ID", 542431903886606399)) -- cgit v1.2.3 From 11c4ceac19e2f82becc9d206f164a5b2914f2169 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 7 Oct 2019 16:46:13 +0100 Subject: Made use of constants for colours --- bot/seasons/evergreen/issues.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index c764cd57..5f1dcfb6 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,6 +3,7 @@ import logging import discord from discord.ext import commands +from bot.constants import Colours from bot.constants import Emojis from bot.decorators import override_in_channel @@ -60,7 +61,7 @@ class Issues(commands.Cog): else: iconURL = icons.get("pull-request-closed") - resp = discord.Embed(colour=0x6CC644) + 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")) -- cgit v1.2.3 From fc6dc955cf41c3f0b18927b22d8d46fd18a847d6 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 7 Oct 2019 22:52:33 +0100 Subject: Trailing Commas Removed --- bot/constants.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bot') diff --git a/bot/constants.py b/bot/constants.py index 124c48ae..e0195961 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -86,10 +86,10 @@ class Emojis: terning5 = "<:terning5:431249716328792064>" terning6 = "<:terning6:431249726705369098>" - issue = "<:IssueOpen:629695470327037963>", - issue_closed = "<:IssueClosed:629695470570307614>", - pull_request = "<:PROpen:629695470175780875>", - pull_request_closed = "<:PRClosed:629695470519713818>", + issue = "<:IssueOpen:629695470327037963>" + issue_closed = "<:IssueClosed:629695470570307614>" + pull_request = "<:PROpen:629695470175780875>" + pull_request_closed = "<:PRClosed:629695470519713818>" merge = "<:PRMerged:629695470570176522>" -- cgit v1.2.3 From 6f3a6241d1e5931cdbc3fb1d35a19d3885431ca9 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 7 Oct 2019 22:57:10 +0100 Subject: Constants match pep8 formatting --- bot/seasons/evergreen/issues.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 5f1dcfb6..0a9e1e09 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -9,11 +9,11 @@ from bot.decorators import override_in_channel log = logging.getLogger(__name__) -icons = {"issue": Emojis.issue, - "issue-closed": Emojis.issue_closed, - "pull-request": Emojis.pull_request, - "pull-request-closed": Emojis.pull_request_closed, - "merge": Emojis.merge} +icons = {"ISSUE": Emojis.issue, + "ISSUE_CLOSED": Emojis.issue_closed, + "PULL_REQUEST": Emojis.pull_request, + "PULL_REQUEST_CLOSED": Emojis.pull_request_closed, + "MERGE": Emojis.merge} RESP_VALUE = {404: "Issue/pull request not located! Please enter a valid number!", 403: "rate limit has been hit! Please try again later!"} @@ -44,22 +44,22 @@ 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( -- cgit v1.2.3 From db87246ebd8958479d8a29fb6cd21fec0af1cde7 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 7 Oct 2019 22:58:54 +0100 Subject: Condensed imports --- bot/seasons/evergreen/issues.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 0a9e1e09..e836ead9 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,8 +3,7 @@ import logging import discord from discord.ext import commands -from bot.constants import Colours -from bot.constants import Emojis +from bot.constants import Colours, Emojis from bot.decorators import override_in_channel log = logging.getLogger(__name__) -- cgit v1.2.3 From f6e9d15ec2ad648ea8c992f9574740ec9137becf Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Wed, 9 Oct 2019 18:22:27 +0100 Subject: Fixed emoji error in embed --- bot/seasons/evergreen/issues.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'bot') 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) -- cgit v1.2.3 From 3afb3ce056d225464333b8f633ec3dac40024da8 Mon Sep 17 00:00:00 2001 From: Numerlor Date: Sat, 12 Oct 2019 22:24:00 +0200 Subject: allow all AoC commands in whitelisted channels --- bot/seasons/christmas/adventofcode.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bot') diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py index a88e5ac3..007e4783 100644 --- a/bot/seasons/christmas/adventofcode.py +++ b/bot/seasons/christmas/adventofcode.py @@ -138,6 +138,7 @@ class AdventOfCode(commands.Cog): aliases=("sub", "notifications", "notify", "notifs"), brief="Notifications for new days" ) + @override_in_channel(AOC_WHITELIST) async def aoc_subscribe(self, ctx: commands.Context) -> None: """Assign the role for notifications about new days being ready.""" role = ctx.guild.get_role(AocConfig.role_id) @@ -152,6 +153,7 @@ class AdventOfCode(commands.Cog): f"If you don't want them any more, run `{unsubscribe_command}` instead.") @adventofcode_group.command(name="unsubscribe", aliases=("unsub",), brief="Notifications for new days") + @override_in_channel(AOC_WHITELIST) async def aoc_unsubscribe(self, ctx: commands.Context) -> None: """Remove the role for notifications about new days being ready.""" role = ctx.guild.get_role(AocConfig.role_id) @@ -163,6 +165,7 @@ class AdventOfCode(commands.Cog): await ctx.send("Hey, you don't even get any notifications about new Advent of Code tasks currently anyway.") @adventofcode_group.command(name="countdown", aliases=("count", "c"), brief="Return time left until next day") + @override_in_channel(AOC_WHITELIST) async def aoc_countdown(self, ctx: commands.Context) -> None: """Return time left until next day.""" if not is_in_advent(): @@ -180,11 +183,13 @@ class AdventOfCode(commands.Cog): await ctx.send(f"There are {hours} hours and {minutes} minutes left until day {tomorrow.day}.") @adventofcode_group.command(name="about", aliases=("ab", "info"), brief="Learn about Advent of Code") + @override_in_channel(AOC_WHITELIST) async def about_aoc(self, ctx: commands.Context) -> None: """Respond with an explanation of all things Advent of Code.""" await ctx.send("", embed=self.cached_about_aoc) @adventofcode_group.command(name="join", aliases=("j",), brief="Learn how to join PyDis' private AoC leaderboard") + @override_in_channel(AOC_WHITELIST) async def join_leaderboard(self, ctx: commands.Context) -> None: """DM the user the information for joining the PyDis AoC private leaderboard.""" author = ctx.message.author @@ -205,6 +210,7 @@ class AdventOfCode(commands.Cog): aliases=("board", "lb"), brief="Get a snapshot of the PyDis private AoC leaderboard", ) + @override_in_channel(AOC_WHITELIST) async def aoc_leaderboard(self, ctx: commands.Context, number_of_people_to_display: int = 10) -> None: """ Pull the top number_of_people_to_display members from the PyDis leaderboard and post an embed. @@ -246,6 +252,7 @@ class AdventOfCode(commands.Cog): aliases=("dailystats", "ds"), brief="Get daily statistics for the PyDis private leaderboard" ) + @override_in_channel(AOC_WHITELIST) async def private_leaderboard_daily_stats(self, ctx: commands.Context) -> None: """ Respond with a table of the daily completion statistics for the PyDis private leaderboard. @@ -289,6 +296,7 @@ class AdventOfCode(commands.Cog): aliases=("globalboard", "gb"), brief="Get a snapshot of the global AoC leaderboard", ) + @override_in_channel(AOC_WHITELIST) async def global_leaderboard(self, ctx: commands.Context, number_of_people_to_display: int = 10) -> None: """ Pull the top number_of_people_to_display members from the global AoC leaderboard and post an embed. -- cgit v1.2.3 From 055db29965e05cf175417ccb7b0bf737647d3db1 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Sun, 13 Oct 2019 17:54:50 +0100 Subject: Update bot/seasons/evergreen/issues.py Co-Authored-By: Kieran Siek --- bot/seasons/evergreen/issues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 9713cfbd..8c449c49 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -39,7 +39,7 @@ class Issues(commands.Cog): return await ctx.send(f"[{str(r.status)}] {RESP_VALUE.get(r.status)}") # the original call is made to the issues API endpoint # if a issue or PR exists then there will be something returned - # if the word 'issues' is present within the response then we can simply pull the data we need from the + # if the word 'issues' is present within the response then we can simply pull the data we need from the # return data received from the API if "issues" in json_data.get("html_url"): if json_data.get("state") == "open": -- cgit v1.2.3 From 55d57ff80ca18c12bf5f3dca08aa59e9c57c92bc Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 14 Oct 2019 08:38:13 +0100 Subject: Caps fix --- bot/seasons/evergreen/issues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 8c449c49..db94a3f4 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -15,7 +15,7 @@ ICONS = {"ISSUE": Emojis.issue, "MERGE": Emojis.merge} RESP_VALUE = {404: "Issue/pull request not located! Please enter a valid number!", - 403: "rate limit has been hit! Please try again later!"} + 403: "Rate limit has been hit! Please try again later!"} class Issues(commands.Cog): -- cgit v1.2.3 From 8da3d05486d8a47da48a3ae13c59e16c346c4d63 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 14 Oct 2019 08:39:58 +0100 Subject: Remove str() within f-string Co-Authored-By: Kieran Siek --- bot/seasons/evergreen/issues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index db94a3f4..4c7966ff 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -29,7 +29,7 @@ class Issues(commands.Cog): 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)}" + url = f"https://api.github.com/repos/{user}/{repository}/issues/{number}" mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{str(number)}/merge" async with self.bot.http_session.get(url) as r: -- cgit v1.2.3 From a3b10c15eae968ffdc5959eb7529ed0aaab17d1a Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 14 Oct 2019 08:40:29 +0100 Subject: Remove str() in f-string Co-Authored-By: Kieran Siek --- bot/seasons/evergreen/issues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index 4c7966ff..b32b8548 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -30,7 +30,7 @@ class Issues(commands.Cog): user: str = "python-discord") -> None: """Command to get issues/pull request from GitHub.""" url = f"https://api.github.com/repos/{user}/{repository}/issues/{number}" - mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{str(number)}/merge" + mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{number}/merge" async with self.bot.http_session.get(url) as r: json_data = await r.json() -- cgit v1.2.3 From 20d96fbae9e92a4ff8c75ef7cf5118998c6c74e0 Mon Sep 17 00:00:00 2001 From: RohanRadia Date: Mon, 14 Oct 2019 08:42:12 +0100 Subject: Made the icon_URL variable conform to PEP8 --- bot/seasons/evergreen/issues.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index b32b8548..22f7c6dc 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -43,28 +43,28 @@ 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") + icon_URL = ICONS.get("ISSUE") else: - iconURL = ICONS.get("ISSUE_CLOSED") + icon_URL = 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") + icon_URL = 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") + icon_URL = ICONS.get("MERGE") # else by the process of elimination, the pull request has been closed else: - iconURL = ICONS.get("PULL_REQUEST_CLOSED") + icon_URL = ICONS.get("PULL_REQUEST_CLOSED") 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})" + description=f"{icon_URL} [{description_text}]({issue_url})" ) resp.set_author(name="GitHub", url=issue_url) await ctx.send(embed=resp) -- cgit v1.2.3 From 9c1a0a4b172f092ca3c11b36dd10d5cb4fd5f2d7 Mon Sep 17 00:00:00 2001 From: "S. Co1" Date: Mon, 14 Oct 2019 13:42:21 -0400 Subject: Syntax cleanup, remove unnecessary emoji dict --- bot/seasons/evergreen/issues.py | 55 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'bot') diff --git a/bot/seasons/evergreen/issues.py b/bot/seasons/evergreen/issues.py index af33b2be..c7501a5d 100644 --- a/bot/seasons/evergreen/issues.py +++ b/bot/seasons/evergreen/issues.py @@ -3,21 +3,16 @@ import logging import discord from discord.ext import commands - from bot.constants import Channels, Colours, Emojis, WHITELISTED_CHANNELS from bot.decorators import override_in_channel log = logging.getLogger(__name__) ISSUE_WHITELIST = WHITELISTED_CHANNELS + (Channels.seasonalbot_chat,) -ICONS = {"ISSUE": Emojis.issue, - "ISSUE_CLOSED": Emojis.issue_closed, - "PULL_REQUEST": Emojis.pull_request, - "PULL_REQUEST_CLOSED": Emojis.pull_request_closed, - "MERGE": Emojis.merge} - -RESP_VALUE = {404: "Issue/pull request not located! Please enter a valid number!", - 403: "Rate limit has been hit! Please try again later!"} +BAD_RESPONSE = { + 404: "Issue/pull request not located! Please enter a valid number!", + 403: "Rate limit has been hit! Please try again later!" +} class Issues(commands.Cog): @@ -33,41 +28,45 @@ class Issues(commands.Cog): ) -> None: """Command to retrieve issues from a GitHub repository.""" url = f"https://api.github.com/repos/{user}/{repository}/issues/{number}" - mergeURL = f"https://api.github.com/repos/{user}/{repository}/pulls/{number}/merge" + merge_url = f"https://api.github.com/repos/{user}/{repository}/pulls/{number}/merge" + log.trace(f"Querying GH issues API: {url}") async with self.bot.http_session.get(url) as r: json_data = await r.json() - if r.status in RESP_VALUE: - return await ctx.send(f"[{str(r.status)}] {RESP_VALUE.get(r.status)}") - # the original call is made to the issues API endpoint - # if a issue or PR exists then there will be something returned - # if the word 'issues' is present within the response then we can simply pull the data we need from the - # return data received from the API + if r.status in BAD_RESPONSE: + log.warning(f"Received response {r.status} from: {url}") + return await ctx.send(f"[{str(r.status)}] {BAD_RESPONSE.get(r.status)}") + + # The initial API request is made to the issues API endpoint, which will return information + # if the issue or PR is present. However, the scope of information returned for PRs differs + # 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.get("html_url"): if json_data.get("state") == "open": - icon_URL = ICONS.get("ISSUE") + icon_url = Emojis.issue else: - icon_URL = 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 + icon_url = Emojis.issue_closed + + # 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 + # to get the desired information for the PR. else: - async with self.bot.http_session.get(mergeURL) as m: + log.trace(f"PR provided, querying GH pulls API for additional information: {merge_url}") + async with self.bot.http_session.get(merge_url) as m: if json_data.get("state") == "open": - icon_URL = ICONS.get("PULL_REQUEST") - # when the status is 204 this means that the state of the PR is merged + icon_url = Emojis.pull_request + # When the status is 204 this means that the state of the PR is merged elif m.status == 204: - icon_URL = ICONS.get("MERGE") - # else by the process of elimination, the pull request has been closed + icon_url = Emojis.merge else: - icon_URL = ICONS.get("PULL_REQUEST_CLOSED") + icon_url = Emojis.pull_request_closed 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"{icon_URL} [{description_text}]({issue_url})" + description=f"{icon_url} [{description_text}]({issue_url})" ) resp.set_author(name="GitHub", url=issue_url) await ctx.send(embed=resp) -- cgit v1.2.3