diff options
| author | 2020-04-21 19:29:11 +0300 | |
|---|---|---|
| committer | 2020-04-21 19:29:11 +0300 | |
| commit | 1447327e337e0565a25ff83476d285c8fe4b1e72 (patch) | |
| tree | b90393d9852b37ecea318248e43adacfae2764b0 | |
| parent | Merge pull request #875 from python-discord/bug/info/869/tag-encoding (diff) | |
Improve `!pep` command
- Made `pep_number` type hint to `int` to avoid unnecessary manual converting.
- Added `ctx.trigger_typing` calling to show user that bot is responding.
| -rw-r--r-- | bot/cogs/utils.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py index 3ed471bbf..bf8887538 100644 --- a/bot/cogs/utils.py +++ b/bot/cogs/utils.py @@ -53,13 +53,10 @@ class Utils(Cog): self.base_github_pep_url = "https://raw.githubusercontent.com/python/peps/master/pep-" @command(name='pep', aliases=('get_pep', 'p')) - async def pep_command(self, ctx: Context, pep_number: str) -> None: + async def pep_command(self, ctx: Context, pep_number: int) -> None: """Fetches information about a PEP and sends it to the channel.""" - if pep_number.isdigit(): - pep_number = int(pep_number) - else: - await ctx.invoke(self.bot.get_command("help"), "pep") - return + # Trigger typing in chat to show users that bot is responding + await ctx.trigger_typing() # 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: |