Skip to content

Commit e53daf2

Browse files
authored
Merge branch 'master' into soundboard
2 parents 48507c3 + 1f30a35 commit e53daf2

File tree

467 files changed

+15422
-6869
lines changed

Some content is hidden

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

467 files changed

+15422
-6869
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ These changes are available on the `master` branch, but have not yet been releas
5858
([#2623](https://github.com/Pycord-Development/pycord/pull/2623))
5959
- Added new `Subscription` object and related methods/events.
6060
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
61-
- Added ability to change the API's base URL with `Route.API_BASE_URL`.
61+
- Added the ability to change the API's base URL with `Route.API_BASE_URL`.
6262
([#2714](https://github.com/Pycord-Development/pycord/pull/2714))
63+
- Added the ability to pass a `datetime.time` object to `format_dt`
64+
([#2747](https://github.com/Pycord-Development/pycord/pull/2747))
6365

6466
### Fixed
6567

@@ -106,6 +108,10 @@ These changes are available on the `master` branch, but have not yet been releas
106108
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
107109
- Fixed `Subscription.renewal_sku_ids` not accepting `None` from the received payload.
108110
([#2709](https://github.com/Pycord-Development/pycord/pull/2709))
111+
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`
112+
([#2739](https://github.com/Pycord-Development/pycord/pull/2739))
113+
- Fixed missing `None` type hints in `Select.__init__`.
114+
([#2746])(https://github.com/Pycord-Development/pycord/pull/2746)
109115

110116
### Changed
111117

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/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
@@ -1238,7 +1238,9 @@ def resolve_annotation(
12381238
TimestampStyle = Literal["f", "F", "d", "D", "t", "T", "R"]
12391239

12401240

1241-
def format_dt(dt: datetime.datetime, /, style: TimestampStyle | None = None) -> str:
1241+
def format_dt(
1242+
dt: datetime.datetime | datetime.time, /, style: TimestampStyle | None = None
1243+
) -> str:
12421244
"""A helper function to format a :class:`datetime.datetime` for presentation within Discord.
12431245
12441246
This allows for a locale-independent way of presenting data using Discord specific Markdown.
@@ -1268,7 +1270,7 @@ def format_dt(dt: datetime.datetime, /, style: TimestampStyle | None = None) ->
12681270
12691271
Parameters
12701272
----------
1271-
dt: :class:`datetime.datetime`
1273+
dt: Union[:class:`datetime.datetime`, :class:`datetime.time`]
12721274
The datetime to format.
12731275
style: :class:`str`
12741276
The style to format the datetime with.
@@ -1278,6 +1280,8 @@ def format_dt(dt: datetime.datetime, /, style: TimestampStyle | None = None) ->
12781280
:class:`str`
12791281
The formatted string.
12801282
"""
1283+
if isinstance(dt, datetime.time):
1284+
dt = datetime.datetime.combine(datetime.datetime.now(), dt)
12811285
if style is None:
12821286
return f"<t:{int(dt.timestamp())}>"
12831287
return f"<t:{int(dt.timestamp())}:{style}>"
17.1 KB
Binary file not shown.
73.3 KB
Binary file not shown.
2.43 KB
Binary file not shown.
16.7 KB
Binary file not shown.
4.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)