diff options
| author | 2020-05-17 10:37:55 +0300 | |
|---|---|---|
| committer | 2020-05-17 10:37:55 +0300 | |
| commit | 50ee35da9cf759094bd73d9c17a77283c1dd7547 (patch) | |
| tree | 8b3e24f6c3a648cc93bd35f57b0acaadf2c593c0 | |
| parent | PEP Improvisations: Remove response from logging to avoid newline (diff) | |
PEP Improvisations: Move error embed to variables instead creating on `ctx.send`
| -rw-r--r-- | bot/cogs/utils.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py index fac2af721..303a8c1fb 100644 --- a/bot/cogs/utils.py +++ b/bot/cogs/utils.py @@ -250,10 +250,10 @@ class Utils(Cog): if pep_nr not in self.peps: log.trace(f"PEP {pep_nr} was not found") not_found = f"PEP {pep_nr} does not exist." - await ctx.send( - embed=Embed(title="PEP not found", description=not_found, colour=Colour.red()) - ) + embed = Embed(title="PEP not found", description=not_found, colour=Colour.red()) + await ctx.send(embed=embed) return + response = await self.bot.http_session.get(self.peps[pep_nr]) if response.status == 200: @@ -285,9 +285,8 @@ class Utils(Cog): ) error_message = "Unexpected HTTP error during PEP search. Please let us know." - await ctx.send( - embed=Embed(title="Unexpected error", description=error_message, colour=Colour.red()) - ) + embed = Embed(title="Unexpected error", description=error_message, colour=Colour.red()) + await ctx.send(embed=embed) return |