diff options
Diffstat (limited to '')
| -rw-r--r-- | Dockerfile | 2 | ||||
| -rw-r--r-- | bot/exts/help_channels/_cog.py | 10 | ||||
| -rw-r--r-- | bot/exts/help_channels/_message.py | 8 | ||||
| -rw-r--r-- | bot/exts/utils/reminders.py | 2 | ||||
| -rw-r--r-- | bot/pagination.py | 2 | ||||
| -rw-r--r-- | bot/resources/tags/blocking.md | 5 | 
6 files changed, 16 insertions, 13 deletions
diff --git a/Dockerfile b/Dockerfile index c285898dc..4d8592590 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9.5-slim +FROM python:3.9-slim  # Set pip to have no saved cache  ENV PIP_NO_CACHE_DIR=false \ diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py index 35658d117..afaf9b0bd 100644 --- a/bot/exts/help_channels/_cog.py +++ b/bot/exts/help_channels/_cog.py @@ -387,7 +387,15 @@ class HelpChannels(commands.Cog):          )          log.trace(f"Sending dormant message for #{channel} ({channel.id}).") -        embed = discord.Embed(description=_message.DORMANT_MSG) +        dormant_category = await channel_utils.try_get_channel(constants.Categories.help_dormant) +        available_category = await channel_utils.try_get_channel(constants.Categories.help_available) +        embed = discord.Embed( +            description=_message.DORMANT_MSG.format( +                dormant=dormant_category.name, +                available=available_category.name, +                asking_guide=_message.ASKING_GUIDE_URL +            ) +        )          await channel.send(embed=embed)          log.trace(f"Pushing #{channel} ({channel.id}) into the channel queue.") diff --git a/bot/exts/help_channels/_message.py b/bot/exts/help_channels/_message.py index befacd263..cf070be83 100644 --- a/bot/exts/help_channels/_message.py +++ b/bot/exts/help_channels/_message.py @@ -29,15 +29,15 @@ AVAILABLE_TITLE = "Available help channel"  AVAILABLE_FOOTER = "Closes after a period of inactivity, or when you send !close." -DORMANT_MSG = f""" -This help channel has been marked as **dormant**, and has been moved into the **Help: Dormant** \ +DORMANT_MSG = """ +This help channel has been marked as **dormant**, and has been moved into the **{dormant}** \  category at the bottom of the channel list. It is no longer possible to send messages in this \  channel until it becomes available again.  If your question wasn't answered yet, you can claim a new help channel from the \ -**Help: Available** category by simply asking your question again. Consider rephrasing the \ +**{available}** category by simply asking your question again. Consider rephrasing the \  question to maximize your chance of getting a good answer. If you're not sure how, have a look \ -through our guide for **[asking a good question]({ASKING_GUIDE_URL})**. +through our guide for **[asking a good question]({asking_guide})**.  """ diff --git a/bot/exts/utils/reminders.py b/bot/exts/utils/reminders.py index 7b8c5c4b3..441b0353f 100644 --- a/bot/exts/utils/reminders.py +++ b/bot/exts/utils/reminders.py @@ -181,7 +181,7 @@ class Reminders(Cog):          )          # Let's not use a codeblock to keep emojis and mentions working. Embeds are safe anyway. -        embed.description = f"Here's your reminder: {reminder['content']}." +        embed.description = f"Here's your reminder: {reminder['content']}"          if reminder.get("jump_url"):  # keep backward compatibility              embed.description += f"\n[Jump back to when you created the reminder]({reminder['jump_url']})" diff --git a/bot/pagination.py b/bot/pagination.py index 90d7c84ee..26caa7db0 100644 --- a/bot/pagination.py +++ b/bot/pagination.py @@ -75,7 +75,7 @@ class LinePaginator(Paginator):              raise ValueError(f"scale_to_size must be >= max_size. ({scale_to_size} < {max_size})")          if scale_to_size > 4000: -            raise ValueError(f"scale_to_size must be <= 2,000 characters. ({scale_to_size} > 4000)") +            raise ValueError(f"scale_to_size must be <= 4,000 characters. ({scale_to_size} > 4000)")          self.scale_to_size = scale_to_size - len(suffix)          self.max_lines = max_lines diff --git a/bot/resources/tags/blocking.md b/bot/resources/tags/blocking.md index 31d91294c..5554d7eba 100644 --- a/bot/resources/tags/blocking.md +++ b/bot/resources/tags/blocking.md @@ -1,9 +1,7 @@  **Why do we need asynchronous programming?** -  Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do **not** use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.  **What is asynchronous programming?** -  An asynchronous program utilises the `async` and `await` keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an `async` context manager or function marked with the `await` keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:  ```py @@ -14,13 +12,10 @@ import discord  async def ping(ctx):      await ctx.send("Pong!")  ``` -  **What does the term "blocking" mean?** -  A blocking operation is wherever you do something without `await`ing it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.  **`async` libraries** -  The standard async library - `asyncio`  Asynchronous web requests - `aiohttp`  Talking to PostgreSQL asynchronously - `asyncpg`  |