Bump deps (including d.py 2.5 bump) (#6529)

Co-authored-by: Kowlin <10947836+Kowlin@users.noreply.github.com>
This commit is contained in:
Jakub Kuczys 2025-03-04 23:38:37 +01:00 committed by GitHub
parent 3bf7c64d01
commit 0f4c7b0fe6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 69 additions and 12 deletions

View File

@ -137,25 +137,27 @@ for name in names:
python_version_marker = (
# Requirement present on less Python versions than not.
" or ".join(
f"python_version == '{python_version}'" for python_version in python_versions
f"python_version == '{python_version}'"
for python_version in sorted(python_versions)
)
if len(python_versions) < len(all_python_versions - python_versions)
# Requirement present on more Python versions than not
# This may generate an empty string when Python version is irrelevant.
else " and ".join(
f"python_version != '{python_version}'"
for python_version in all_python_versions - python_versions
for python_version in sorted(all_python_versions - python_versions)
)
)
platform_marker = (
# Requirement present on less platforms than not.
" or ".join(f"sys_platform == '{platform}'" for platform in platforms)
" or ".join(f"sys_platform == '{platform}'" for platform in sorted(platforms))
if len(platforms) < len(all_platforms - platforms)
# Requirement present on more platforms than not
# This may generate an empty string when platform is irrelevant.
else " and ".join(
f"sys_platform != '{platform}'" for platform in all_platforms - platforms
f"sys_platform != '{platform}'"
for platform in sorted(all_platforms - platforms)
)
)
@ -169,12 +171,12 @@ for name in names:
# Requirement present on less envs than not.
" or ".join(
f"(sys_platform == '{platform}' and python_version == '{python_version}')"
for platform, python_version in iter_envs(envs)
for platform, python_version in iter_envs(sorted(envs))
)
if len(envs) < len(all_envs - envs.keys())
else " and ".join(
f"(sys_platform != '{platform}' and python_version != '{python_version}')"
for platform, python_version in iter_envs(all_envs - envs.keys())
for platform, python_version in iter_envs(sorted(all_envs - envs.keys()))
)
)

View File

@ -708,11 +708,19 @@ class Cleanup(commands.Cog):
def check(m):
if m.attachments:
return False
if m.components:
return False
if m.poll:
return False
if m.activity:
return False
ref = m.reference
c = (
m.author.id,
m.content,
[embed.to_dict() for embed in m.embeds],
[sticker.id for sticker in m.stickers],
ref and (ref.type, ref.message_id, ref.channel_id),
)
if c in msgs:
spam.append(m)

View File

@ -2,7 +2,7 @@ import asyncio
import discord
import re
from datetime import timezone
from typing import Union, Set, Literal, Optional
from typing import Union, Set, Literal, Optional, Iterable, Dict, Any
from redbot.core import Config, modlog, commands
from redbot.core.bot import Red
@ -515,6 +515,22 @@ class Filter(commands.Cog):
texts.append(answer.text or "")
for attachment in message.attachments:
texts.append(attachment.description or "")
if (
message.reference is not None
and message.reference.type is discord.MessageReferenceType.forward
):
# unlike user messages, forwards can include things that bots can send
# since you can forward a bot's message
for snapshot in message.message_snapshots:
texts.append(snapshot.content)
for attachment in snapshot.attachments:
texts.append(attachment.description or "")
for embed in snapshot.embeds:
texts.extend(_extract_string_values(embed.to_dict().values()))
for component in snapshot.components:
texts.extend(_extract_string_values_from_component(component))
hits = await self.filter_hits(message.channel, *texts)
if hits:
@ -624,3 +640,26 @@ class Filter(commands.Cog):
except discord.HTTPException:
pass
return
def _extract_string_values_from_component(
component: Union[discord.ActionRow, discord.Button, discord.SelectMenu],
) -> Iterable[str]:
if isinstance(component, discord.ActionRow):
for child in component.children:
yield from _extract_string_values_from_component(child)
elif isinstance(component, discord.Button):
yield component.url
yield component.label
elif isinstance(component, discord.SelectMenu):
yield component.placeholder
def _extract_string_values(data: Iterable[Any]) -> Iterable[str]:
for value in data:
if isinstance(value, str):
yield value
elif isinstance(value, list):
yield from _extract_string_values(value)
elif isinstance(value, dict):
yield from _extract_string_values(value.values())

View File

@ -206,6 +206,8 @@ from discord.ext.commands import (
RangeError as RangeError,
parameter as parameter,
HybridCommandError as HybridCommandError,
SoundboardSoundConverter as SoundboardSoundConverter,
SoundboardSoundNotFound as SoundboardSoundNotFound,
)
__all__ = (
@ -397,4 +399,6 @@ __all__ = (
"RangeError",
"parameter",
"HybridCommandError",
"SoundboardSoundConverter",
"SoundboardSoundNotFound",
)

View File

@ -162,7 +162,8 @@ class Tunnel(metaclass=TunnelMeta):
"""
files = []
max_size = 26214400
# DEP-WARN
max_size = discord.utils.DEFAULT_FILE_SIZE_LIMIT_BYTES
if m.attachments and sum(a.size for a in m.attachments) <= max_size:
for a in m.attachments:
if images_only and a.height is None:

View File

@ -19,5 +19,6 @@ rich
schema
typing_extensions
yarl
zstandard
distro; sys_platform == "linux"
uvloop; sys_platform != "win32" and platform_python_implementation == "CPython"

View File

@ -18,7 +18,7 @@ brotli==1.1.0
# via -r base.in
click==8.1.8
# via -r base.in
discord-py==2.4.0
discord-py==2.5.1
# via
# -r base.in
# red-lavalink
@ -46,7 +46,7 @@ platformdirs==4.3.6
# via -r base.in
propcache==0.2.0
# via yarl
psutil==6.1.1
psutil==7.0.0
# via -r base.in
pygments==2.19.1
# via rich
@ -77,17 +77,19 @@ yarl==1.15.2
# via
# -r base.in
# aiohttp
zstandard==0.23.0
# via -r base.in
async-timeout==4.0.3; python_version != "3.11"
# via aiohttp
colorama==0.4.6; sys_platform == "win32"
# via click
distro==1.9.0; sys_platform == "linux" and sys_platform == "linux"
# via -r base.in
importlib-metadata==8.5.0; python_version != "3.11" and python_version != "3.10"
importlib-metadata==8.5.0; python_version != "3.10" and python_version != "3.11"
# via markdown
pytz==2025.1; python_version == "3.8"
# via babel
uvloop==0.21.0; (sys_platform != "win32" and platform_python_implementation == "CPython") and sys_platform != "win32"
# via -r base.in
zipp==3.20.2; python_version != "3.11" and python_version != "3.10"
zipp==3.20.2; python_version != "3.10" and python_version != "3.11"
# via importlib-metadata