Skip to content

Commit 8655160

Browse files
authored
Merge branch 'master' into partial-autocomplete
Signed-off-by: Paillat <[email protected]>
2 parents f1acd32 + c0c0b7c commit 8655160

File tree

472 files changed

+15431
-6874
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

472 files changed

+15431
-6874
lines changed

.github/workflows/docs-localization-download.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
working-directory: ./docs
4141
- name: "Crowdin"
4242
id: crowdin
43-
uses: crowdin/github-action@v2.6.1
43+
uses: crowdin/github-action@v2.7.0
4444
with:
4545
upload_sources: false
4646
upload_translations: false

.github/workflows/docs-localization-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
4545
working-directory: ./docs
4646
- name: "Crowdin"
47-
uses: crowdin/github-action@v2.6.1
47+
uses: crowdin/github-action@v2.7.0
4848
with:
4949
upload_sources: true
5050
upload_translations: false

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
- id: pyupgrade
2727
exclude: \.(po|pot|yml|yaml)$
2828
- repo: https://github.com/PyCQA/isort
29-
rev: 6.0.0
29+
rev: 6.0.1
3030
hooks:
3131
- id: isort
3232
exclude: \.(po|pot|yml|yaml)$

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ These changes are available on the `master` branch, but have not yet been releas
5454
([#2669](https://github.com/Pycord-Development/pycord/pull/2669))
5555
- Added ability to change the API's base URL with `Route.API_BASE_URL`.
5656
([#2714](https://github.com/Pycord-Development/pycord/pull/2714))
57+
- Added the ability to pass a `datetime.time` object to `format_dt`
58+
([#2747](https://github.com/Pycord-Development/pycord/pull/2747))
5759

5860
### Fixed
5961

@@ -100,6 +102,12 @@ These changes are available on the `master` branch, but have not yet been releas
100102
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
101103
- Fixed `Subscription.renewal_sku_ids` not accepting `None` from the received payload.
102104
([#2709](https://github.com/Pycord-Development/pycord/pull/2709))
105+
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`
106+
([#2739](https://github.com/Pycord-Development/pycord/pull/2739))
107+
- Fixed missing `None` type hints in `Select.__init__`.
108+
([#2746])(https://github.com/Pycord-Development/pycord/pull/2746)
109+
- Updated `valid_locales` to support `in` and `es-419`.
110+
([#2767])(https://github.com/Pycord-Development/pycord/pull/2767)
103111

104112
### Changed
105113

discord/abc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,17 @@ async def _edit(
521521
)
522522
elif isinstance(default_reaction_emoji, str):
523523
default_reaction_emoji = PartialEmoji.from_str(default_reaction_emoji)
524+
elif default_reaction_emoji is None:
525+
pass
524526
else:
525527
raise InvalidArgument(
526-
"default_reaction_emoji must be of type: GuildEmoji | int | str"
528+
"default_reaction_emoji must be of type: GuildEmoji | int | str | None"
527529
)
528530

529531
options["default_reaction_emoji"] = (
530532
default_reaction_emoji._to_forum_reaction_payload()
533+
if default_reaction_emoji
534+
else None
531535
)
532536

533537
if options:

discord/cog.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,6 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
151151

152152
new_cls = super().__new__(cls, name, bases, attrs, **kwargs)
153153

154-
valid_commands = [
155-
(c for i, c in j.__dict__.items() if isinstance(c, _BaseCommand))
156-
for j in reversed(new_cls.__mro__)
157-
]
158-
if any(isinstance(i, ApplicationCommand) for i in valid_commands) and any(
159-
not isinstance(i, _BaseCommand) for i in valid_commands
160-
):
161-
_filter = ApplicationCommand
162-
else:
163-
_filter = _BaseCommand
164-
165154
for base in reversed(new_cls.__mro__):
166155
for elem, value in base.__dict__.items():
167156
if elem in commands:
@@ -178,7 +167,7 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
178167
is_static_method = isinstance(value, staticmethod)
179168
if is_static_method:
180169
value = value.__func__
181-
if isinstance(value, _filter):
170+
if isinstance(value, _BaseCommand):
182171
if is_static_method:
183172
raise TypeError(
184173
f"Command in method {base}.{elem!r} must not be"

discord/commands/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,11 +2042,13 @@ def command(**kwargs):
20422042

20432043
docs = "https://discord.com/developers/docs"
20442044
valid_locales = [
2045+
"id",
20452046
"da",
20462047
"de",
20472048
"en-GB",
20482049
"en-US",
20492050
"es-ES",
2051+
"es-419",
20502052
"fr",
20512053
"hr",
20522054
"it",

discord/ui/select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ def __init__(
130130
placeholder: str | None = None,
131131
min_values: int = 1,
132132
max_values: int = 1,
133-
options: list[SelectOption] = None,
134-
channel_types: list[ChannelType] = None,
133+
options: list[SelectOption] | None = None,
134+
channel_types: list[ChannelType] | None = None,
135135
disabled: bool = False,
136136
row: int | None = None,
137137
) -> None:

discord/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,9 @@ def resolve_annotation(
12361236
TimestampStyle = Literal["f", "F", "d", "D", "t", "T", "R"]
12371237

12381238

1239-
def format_dt(dt: datetime.datetime, /, style: TimestampStyle | None = None) -> str:
1239+
def format_dt(
1240+
dt: datetime.datetime | datetime.time, /, style: TimestampStyle | None = None
1241+
) -> str:
12401242
"""A helper function to format a :class:`datetime.datetime` for presentation within Discord.
12411243
12421244
This allows for a locale-independent way of presenting data using Discord specific Markdown.
@@ -1266,7 +1268,7 @@ def format_dt(dt: datetime.datetime, /, style: TimestampStyle | None = None) ->
12661268
12671269
Parameters
12681270
----------
1269-
dt: :class:`datetime.datetime`
1271+
dt: Union[:class:`datetime.datetime`, :class:`datetime.time`]
12701272
The datetime to format.
12711273
style: :class:`str`
12721274
The style to format the datetime with.
@@ -1276,6 +1278,8 @@ def format_dt(dt: datetime.datetime, /, style: TimestampStyle | None = None) ->
12761278
:class:`str`
12771279
The formatted string.
12781280
"""
1281+
if isinstance(dt, datetime.time):
1282+
dt = datetime.datetime.combine(datetime.datetime.now(), dt)
12791283
if style is None:
12801284
return f"<t:{int(dt.timestamp())}>"
12811285
return f"<t:{int(dt.timestamp())}:{style}>"
17.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)