diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/backend/branding/_cog.py | 6 | ||||
| -rw-r--r-- | bot/exts/filters/antispam.py | 2 | ||||
| -rw-r--r-- | bot/exts/info/doc/_parsing.py | 2 | ||||
| -rw-r--r-- | bot/exts/info/python_news.py | 2 | ||||
| -rw-r--r-- | bot/exts/moderation/infraction/_utils.py | 4 | ||||
| -rw-r--r-- | bot/exts/moderation/modlog.py | 4 | ||||
| -rw-r--r-- | bot/exts/moderation/watchchannels/_watchchannel.py | 2 | ||||
| -rw-r--r-- | bot/exts/recruitment/talentpool/_review.py | 4 | ||||
| -rw-r--r-- | bot/pagination.py | 18 | ||||
| -rw-r--r-- | tests/bot/exts/moderation/infraction/test_utils.py | 2 | ||||
| -rw-r--r-- | tests/bot/exts/moderation/test_modlog.py | 2 | 
11 files changed, 25 insertions, 23 deletions
| diff --git a/bot/exts/backend/branding/_cog.py b/bot/exts/backend/branding/_cog.py index 47c379a34..0ba146635 100644 --- a/bot/exts/backend/branding/_cog.py +++ b/bot/exts/backend/branding/_cog.py @@ -50,7 +50,7 @@ def make_embed(title: str, description: str, *, success: bool) -> discord.Embed:      For both `title` and `description`, empty string are valid values ~ fields will be empty.      """      colour = Colours.soft_green if success else Colours.soft_red -    return discord.Embed(title=title[:256], description=description[:2048], colour=colour) +    return discord.Embed(title=title[:256], description=description[:4096], colour=colour)  def extract_event_duration(event: Event) -> str: @@ -293,8 +293,8 @@ class Branding(commands.Cog):          else:              content = "Python Discord is entering a new event!" if is_notification else None -            embed = discord.Embed(description=description[:2048], colour=discord.Colour.blurple()) -            embed.set_footer(text=duration[:2048]) +            embed = discord.Embed(description=description[:4096], colour=discord.Colour.blurple()) +            embed.set_footer(text=duration[:4096])          await channel.send(content=content, embed=embed) diff --git a/bot/exts/filters/antispam.py b/bot/exts/filters/antispam.py index 7555e25a2..2f0771396 100644 --- a/bot/exts/filters/antispam.py +++ b/bot/exts/filters/antispam.py @@ -84,7 +84,7 @@ class DeletionContext:              mod_alert_message += "Message:\n"              [message] = self.messages.values()              content = message.clean_content -            remaining_chars = 2040 - len(mod_alert_message) +            remaining_chars = 4080 - len(mod_alert_message)              if len(content) > remaining_chars:                  content = content[:remaining_chars] + "..." diff --git a/bot/exts/info/doc/_parsing.py b/bot/exts/info/doc/_parsing.py index bf840b96f..1a0d42c47 100644 --- a/bot/exts/info/doc/_parsing.py +++ b/bot/exts/info/doc/_parsing.py @@ -34,7 +34,7 @@ _EMBED_CODE_BLOCK_LINE_LENGTH = 61  # _MAX_SIGNATURE_AMOUNT code block wrapped lines with py syntax highlight  _MAX_SIGNATURES_LENGTH = (_EMBED_CODE_BLOCK_LINE_LENGTH + 8) * MAX_SIGNATURE_AMOUNT  # Maximum embed description length - signatures on top -_MAX_DESCRIPTION_LENGTH = 2048 - _MAX_SIGNATURES_LENGTH +_MAX_DESCRIPTION_LENGTH = 4096 - _MAX_SIGNATURES_LENGTH  _TRUNCATE_STRIP_CHARACTERS = "!?:;." + string.whitespace  BracketPair = namedtuple("BracketPair", ["opening_bracket", "closing_bracket"]) diff --git a/bot/exts/info/python_news.py b/bot/exts/info/python_news.py index 0ab5738a4..a7837c93a 100644 --- a/bot/exts/info/python_news.py +++ b/bot/exts/info/python_news.py @@ -173,7 +173,7 @@ class PythonNews(Cog):                  # Build an embed and send a message to the webhook                  embed = discord.Embed(                      title=thread_information["subject"], -                    description=content[:500] + f"... [continue reading]({link})" if len(content) > 500 else content, +                    description=content[:1000] + f"... [continue reading]({link})" if len(content) > 1000 else content,                      timestamp=new_date,                      url=link,                      colour=constants.Colours.soft_green diff --git a/bot/exts/moderation/infraction/_utils.py b/bot/exts/moderation/infraction/_utils.py index e4eb7f79c..cfb238fa3 100644 --- a/bot/exts/moderation/infraction/_utils.py +++ b/bot/exts/moderation/infraction/_utils.py @@ -169,8 +169,8 @@ async def notify_infraction(      )      # For case when other fields than reason is too long and this reach limit, then force-shorten string -    if len(text) > 2048: -        text = f"{text[:2045]}..." +    if len(text) > 4096: +        text = f"{text[:4093]}..."      embed = discord.Embed(          description=text, diff --git a/bot/exts/moderation/modlog.py b/bot/exts/moderation/modlog.py index be65ade6e..be2245650 100644 --- a/bot/exts/moderation/modlog.py +++ b/bot/exts/moderation/modlog.py @@ -99,7 +99,7 @@ class ModLog(Cog, name="ModLog"):          """Generate log embed and send to logging channel."""          # Truncate string directly here to avoid removing newlines          embed = discord.Embed( -            description=text[:2045] + "..." if len(text) > 2048 else text +            description=text[:4093] + "..." if len(text) > 4096 else text          )          if title and icon_url: @@ -564,7 +564,7 @@ class ModLog(Cog, name="ModLog"):          # Shorten the message content if necessary          content = message.clean_content -        remaining_chars = 2040 - len(response) +        remaining_chars = 4090 - len(response)          if len(content) > remaining_chars:              botlog_url = await self.upload_log(messages=[message], actor_id=message.author.id) diff --git a/bot/exts/moderation/watchchannels/_watchchannel.py b/bot/exts/moderation/watchchannels/_watchchannel.py index 9f26c34f2..146426569 100644 --- a/bot/exts/moderation/watchchannels/_watchchannel.py +++ b/bot/exts/moderation/watchchannels/_watchchannel.py @@ -295,7 +295,7 @@ class WatchChannel(metaclass=CogABCMeta):          footer = f"Added {time_delta} by {actor} | Reason: {reason}"          embed = Embed(description=f"{msg.author.mention} {message_jump}") -        embed.set_footer(text=textwrap.shorten(footer, width=128, placeholder="...")) +        embed.set_footer(text=textwrap.shorten(footer, width=256, placeholder="..."))          await self.webhook_send(embed=embed, username=msg.author.display_name, avatar_url=msg.author.avatar_url) diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py index 0cb786e4b..c4c68dbc3 100644 --- a/bot/exts/recruitment/talentpool/_review.py +++ b/bot/exts/recruitment/talentpool/_review.py @@ -31,6 +31,8 @@ MAX_DAYS_IN_POOL = 30  # Maximum amount of characters allowed in a message  MAX_MESSAGE_SIZE = 2000 +# Maximum amount of characters allowed in an embed +MAX_EMBED_SIZE = 4000  # Regex finding the user ID of a user mention  MENTION_RE = re.compile(r"<@!?(\d+?)>") @@ -199,7 +201,7 @@ class Reviewer:          channel = self.bot.get_channel(Channels.nomination_archive)          for number, part in enumerate( -                textwrap.wrap(embed_content, width=MAX_MESSAGE_SIZE, replace_whitespace=False, placeholder="") +                textwrap.wrap(embed_content, width=MAX_EMBED_SIZE, replace_whitespace=False, placeholder="")          ):              await channel.send(embed=Embed(                  title=embed_title if number == 0 else None, diff --git a/bot/pagination.py b/bot/pagination.py index 1c5b94b07..865acce41 100644 --- a/bot/pagination.py +++ b/bot/pagination.py @@ -49,8 +49,8 @@ class LinePaginator(Paginator):          self,          prefix: str = '```',          suffix: str = '```', -        max_size: int = 2000, -        scale_to_size: int = 2000, +        max_size: int = 4000, +        scale_to_size: int = 4000,          max_lines: t.Optional[int] = None,          linesep: str = "\n"      ) -> None: @@ -59,10 +59,10 @@ class LinePaginator(Paginator):          It overrides in order to allow us to configure the maximum number of lines per page.          """ -        # Embeds that exceed 2048 characters will result in an HTTPException -        # (Discord API limit), so we've set a limit of 2000 -        if max_size > 2000: -            raise ValueError(f"max_size must be <= 2,000 characters. ({max_size} > 2000)") +        # Embeds that exceed 4096 characters will result in an HTTPException +        # (Discord API limit), so we've set a limit of 4000 +        if max_size > 4000: +            raise ValueError(f"max_size must be <= 4,000 characters. ({max_size} > 4000)")          super().__init__(              prefix, @@ -74,8 +74,8 @@ class LinePaginator(Paginator):          if scale_to_size < max_size:              raise ValueError(f"scale_to_size must be >= max_size. ({scale_to_size} < {max_size})") -        if scale_to_size > 2000: -            raise ValueError(f"scale_to_size must be <= 2,000 characters. ({scale_to_size} > 2000)") +        if scale_to_size > 4000: +            raise ValueError(f"scale_to_size must be <= 2,000 characters. ({scale_to_size} > 4000)")          self.scale_to_size = scale_to_size - len(suffix)          self.max_lines = max_lines @@ -197,7 +197,7 @@ class LinePaginator(Paginator):          suffix: str = "",          max_lines: t.Optional[int] = None,          max_size: int = 500, -        scale_to_size: int = 2000, +        scale_to_size: int = 4000,          empty: bool = True,          restrict_to_user: User = None,          timeout: int = 300, diff --git a/tests/bot/exts/moderation/infraction/test_utils.py b/tests/bot/exts/moderation/infraction/test_utils.py index 50a717bb5..c6ae76984 100644 --- a/tests/bot/exts/moderation/infraction/test_utils.py +++ b/tests/bot/exts/moderation/infraction/test_utils.py @@ -213,7 +213,7 @@ class ModerationUtilsTests(unittest.IsolatedAsyncioTestCase):                          type="Mute",                          expires="N/A",                          reason="foo bar" * 4000 -                    )[:2045] + "...", +                    )[:4093] + "...",                      colour=Colours.soft_red,                      url=utils.RULES_URL                  ).set_author( diff --git a/tests/bot/exts/moderation/test_modlog.py b/tests/bot/exts/moderation/test_modlog.py index f8f142484..79e04837d 100644 --- a/tests/bot/exts/moderation/test_modlog.py +++ b/tests/bot/exts/moderation/test_modlog.py @@ -25,5 +25,5 @@ class ModLogTests(unittest.IsolatedAsyncioTestCase):          )          embed = self.channel.send.call_args[1]["embed"]          self.assertEqual( -            embed.description, ("foo bar" * 3000)[:2045] + "..." +            embed.description, ("foo bar" * 3000)[:4093] + "..."          ) | 
