aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-05-14 08:45:16 +0300
committerGravatar ks129 <[email protected]>2020-05-14 08:45:16 +0300
commitd560b8315f46b7598c0ef7b7b5c75b3c035796da (patch)
tree481220f766d4d2b4a486775141bb403be8e367d1
parentPEP Improvisations: Implemented stats to PEP command (diff)
PEP Improvisations: Moved `get_pep_zero_embed` to outside of Cog
-rw-r--r--bot/cogs/utils.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index bb655085d..15a3e9e8c 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -45,6 +45,20 @@ Namespaces are one honking great idea -- let's do more of those!
ICON_URL = "https://www.python.org/static/opengraph-icon-200x200.png"
+def get_pep_zero_embed() -> Embed:
+ """Send information about PEP 0."""
+ pep_embed = Embed(
+ title=f"**PEP 0 - Index of Python Enhancement Proposals (PEPs)**",
+ description=f"[Link](https://www.python.org/dev/peps/)"
+ )
+ pep_embed.set_thumbnail(url=ICON_URL)
+ pep_embed.add_field(name="Status", value="Active")
+ pep_embed.add_field(name="Created", value="13-Jul-2000")
+ pep_embed.add_field(name="Type", value="Informational")
+
+ return pep_embed
+
+
class Utils(Cog):
"""A selection of utilities which don't have a clear category."""
@@ -264,7 +278,7 @@ class Utils(Cog):
# Handle PEP 0 directly because it's not in .rst or .txt so it can't be accessed like other PEPs.
if pep_number == 0:
- pep_embed = await self.get_pep_zero_embed()
+ pep_embed = get_pep_zero_embed()
success = True
else:
pep_embed, success = await self.get_pep_embed(pep_number)
@@ -274,19 +288,6 @@ class Utils(Cog):
log.trace(f"PEP {pep_number} getting and sending finished successfully. Increasing stat.")
self.bot.stats.incr(f"pep_fetches.{pep_number}")
- async def get_pep_zero_embed(self) -> Embed:
- """Send information about PEP 0."""
- pep_embed = Embed(
- title=f"**PEP 0 - Index of Python Enhancement Proposals (PEPs)**",
- description=f"[Link](https://www.python.org/dev/peps/)"
- )
- pep_embed.set_thumbnail(url=ICON_URL)
- pep_embed.add_field(name="Status", value="Active")
- pep_embed.add_field(name="Created", value="13-Jul-2000")
- pep_embed.add_field(name="Type", value="Informational")
-
- return pep_embed
-
@async_cache(arg_offset=1)
async def get_pep_embed(self, pep_nr: int) -> Tuple[Embed, bool]:
"""Fetch, generate and return PEP embed. Implement `async_cache`."""