Skip to content

Commit 2fa60be

Browse files
authored
Merge branch 'Pycord-Development:master' into master
2 parents 336e0ac + 2276914 commit 2fa60be

Some content is hidden

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

63 files changed

+243
-214
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: trailing-whitespace
1010
- id: end-of-file-fixer
1111
- repo: https://github.com/PyCQA/autoflake
12-
rev: v2.2.1
12+
rev: v2.3.0
1313
hooks:
1414
- id: autoflake
1515
# args:
@@ -19,7 +19,7 @@ repos:
1919
# - --remove-duplicate-keys
2020
# - --remove-unused-variables
2121
- repo: https://github.com/asottile/pyupgrade
22-
rev: v3.15.0
22+
rev: v3.15.1
2323
hooks:
2424
- id: pyupgrade
2525
args: [--py38-plus]
@@ -28,7 +28,7 @@ repos:
2828
hooks:
2929
- id: isort
3030
- repo: https://github.com/psf/black
31-
rev: 23.12.1
31+
rev: 24.2.0
3232
hooks:
3333
- id: black
3434
args: [--safe, --quiet]

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ These changes are available on the `master` branch, but have not yet been releas
9191
([#2273](https://github.com/Pycord-Development/pycord/pull/2273))
9292
- Added `AttachmentFlags` and attachment attributes `expires_at`, `issued_at` and `hm`.
9393
([#2342](https://github.com/Pycord-Development/pycord/pull/2342))
94+
- Added `invitable` and `slowmode_delay` to `Thread` creation methods.
95+
([#2350](https://github.com/Pycord-Development/pycord/pull/2350))
9496

9597
### Changed
9698

@@ -235,6 +237,12 @@ These changes are available on the `master` branch, but have not yet been releas
235237
- Fixed `AttributeError` due to `entitlements` not being included in
236238
`Interaction.__slots__`.
237239
([#2345](https://github.com/Pycord-Development/pycord/pull/2345))
240+
- Fixed `Thread.me` being out of date and added the thread owner to `Thread.members` on
241+
creation. ([#1296](https://github.com/Pycord-Development/pycord/issues/1296))
242+
- Fixed keyword argument wildcard of `bridge.has_permissions` having the wrong type
243+
hint. ([#2364](https://github.com/Pycord-Development/pycord/pull/2364))
244+
- Fixed enum to support stringified annotations.
245+
([#2367](https://github.com/Pycord-Development/pycord/pull/2367))
238246

239247
## [2.4.1] - 2023-03-20
240248

discord/_typed_dict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2222
DEALINGS IN THE SOFTWARE.
2323
"""
24+
2425
import sys
2526

2627
# PEP 655 Required and NotRequired were added in python 3.11. This file is simply a

discord/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2323
DEALINGS IN THE SOFTWARE.
2424
"""
25+
2526
from __future__ import annotations
2627

2728
import datetime

discord/abc.py

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ class GuildChannel:
341341

342342
def __init__(
343343
self, *, state: ConnectionState, guild: Guild, data: dict[str, Any]
344-
):
345-
...
344+
): ...
346345

347346
def __str__(self) -> str:
348347
return self.name
@@ -526,9 +525,9 @@ async def _edit(
526525
"default_reaction_emoji must be of type: Emoji | int | str"
527526
)
528527

529-
options[
530-
"default_reaction_emoji"
531-
] = default_reaction_emoji._to_forum_reaction_payload()
528+
options["default_reaction_emoji"] = (
529+
default_reaction_emoji._to_forum_reaction_payload()
530+
)
532531

533532
if options:
534533
return await self._state.http.edit_channel(
@@ -853,8 +852,7 @@ async def set_permissions(
853852
*,
854853
overwrite: PermissionOverwrite | None = ...,
855854
reason: str | None = ...,
856-
) -> None:
857-
...
855+
) -> None: ...
858856

859857
@overload
860858
async def set_permissions(
@@ -863,8 +861,7 @@ async def set_permissions(
863861
*,
864862
reason: str | None = ...,
865863
**permissions: bool,
866-
) -> None:
867-
...
864+
) -> None: ...
868865

869866
async def set_permissions(
870867
self, target, *, overwrite=MISSING, reason=None, **permissions
@@ -1033,8 +1030,7 @@ async def move(
10331030
category: Snowflake | None = MISSING,
10341031
sync_permissions: bool = MISSING,
10351032
reason: str | None = MISSING,
1036-
) -> None:
1037-
...
1033+
) -> None: ...
10381034

10391035
@overload
10401036
async def move(
@@ -1045,8 +1041,7 @@ async def move(
10451041
category: Snowflake | None = MISSING,
10461042
sync_permissions: bool = MISSING,
10471043
reason: str = MISSING,
1048-
) -> None:
1049-
...
1044+
) -> None: ...
10501045

10511046
@overload
10521047
async def move(
@@ -1057,8 +1052,7 @@ async def move(
10571052
category: Snowflake | None = MISSING,
10581053
sync_permissions: bool = MISSING,
10591054
reason: str = MISSING,
1060-
) -> None:
1061-
...
1055+
) -> None: ...
10621056

10631057
@overload
10641058
async def move(
@@ -1069,8 +1063,7 @@ async def move(
10691063
category: Snowflake | None = MISSING,
10701064
sync_permissions: bool = MISSING,
10711065
reason: str = MISSING,
1072-
) -> None:
1073-
...
1066+
) -> None: ...
10741067

10751068
async def move(self, **kwargs) -> None:
10761069
"""|coro|
@@ -1359,8 +1352,7 @@ async def send(
13591352
view: View = ...,
13601353
suppress: bool = ...,
13611354
silent: bool = ...,
1362-
) -> Message:
1363-
...
1355+
) -> Message: ...
13641356

13651357
@overload
13661358
async def send(
@@ -1379,8 +1371,7 @@ async def send(
13791371
view: View = ...,
13801372
suppress: bool = ...,
13811373
silent: bool = ...,
1382-
) -> Message:
1383-
...
1374+
) -> Message: ...
13841375

13851376
@overload
13861377
async def send(
@@ -1399,8 +1390,7 @@ async def send(
13991390
view: View = ...,
14001391
suppress: bool = ...,
14011392
silent: bool = ...,
1402-
) -> Message:
1403-
...
1393+
) -> Message: ...
14041394

14051395
@overload
14061396
async def send(
@@ -1419,8 +1409,7 @@ async def send(
14191409
view: View = ...,
14201410
suppress: bool = ...,
14211411
silent: bool = ...,
1422-
) -> Message:
1423-
...
1412+
) -> Message: ...
14241413

14251414
async def send(
14261415
self,

discord/activity.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,13 +843,11 @@ def __repr__(self) -> str:
843843

844844

845845
@overload
846-
def create_activity(data: ActivityPayload) -> ActivityTypes:
847-
...
846+
def create_activity(data: ActivityPayload) -> ActivityTypes: ...
848847

849848

850849
@overload
851-
def create_activity(data: None) -> None:
852-
...
850+
def create_activity(data: None) -> None: ...
853851

854852

855853
def create_activity(data: ActivityPayload | None) -> ActivityTypes | None:

discord/audit_logs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,9 @@ def __repr__(self) -> str:
222222

223223
if TYPE_CHECKING:
224224

225-
def __getattr__(self, item: str) -> Any:
226-
...
225+
def __getattr__(self, item: str) -> Any: ...
227226

228-
def __setattr__(self, key: str, value: Any) -> Any:
229-
...
227+
def __setattr__(self, key: str, value: Any) -> Any: ...
230228

231229

232230
Transformer = Callable[["AuditLogEntry", Any], Any]

discord/backoff.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,13 @@ def __init__(self, base: int = 1, *, integral: T = False):
7171
self._randfunc: Callable[..., int | float] = rand.randrange if integral else rand.uniform # type: ignore
7272

7373
@overload
74-
def delay(self: ExponentialBackoff[Literal[False]]) -> float:
75-
...
74+
def delay(self: ExponentialBackoff[Literal[False]]) -> float: ...
7675

7776
@overload
78-
def delay(self: ExponentialBackoff[Literal[True]]) -> int:
79-
...
77+
def delay(self: ExponentialBackoff[Literal[True]]) -> int: ...
8078

8179
@overload
82-
def delay(self: ExponentialBackoff[bool]) -> int | float:
83-
...
80+
def delay(self: ExponentialBackoff[bool]) -> int | float: ...
8481

8582
def delay(self) -> int | float:
8683
"""Compute the next delay

discord/bot.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,7 @@ async def invoke_application_command(self, ctx: ApplicationContext) -> None:
11371137

11381138
@property
11391139
@abstractmethod
1140-
def _bot(self) -> Bot | AutoShardedBot:
1141-
...
1140+
def _bot(self) -> Bot | AutoShardedBot: ...
11421141

11431142

11441143
class BotBase(ApplicationCommandMixin, CogMixin, ABC):

discord/channel.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,10 @@ async def edit(
780780
default_thread_slowmode_delay: int = ...,
781781
type: ChannelType = ...,
782782
overwrites: Mapping[Role | Member | Snowflake, PermissionOverwrite] = ...,
783-
) -> TextChannel | None:
784-
...
783+
) -> TextChannel | None: ...
785784

786785
@overload
787-
async def edit(self) -> TextChannel | None:
788-
...
786+
async def edit(self) -> TextChannel | None: ...
789787

790788
async def edit(self, *, reason=None, **options):
791789
"""|coro|
@@ -868,6 +866,8 @@ async def create_thread(
868866
message: Snowflake | None = None,
869867
auto_archive_duration: ThreadArchiveDuration = MISSING,
870868
type: ChannelType | None = None,
869+
slowmode_delay: int | None = None,
870+
invitable: bool | None = None,
871871
reason: str | None = None,
872872
) -> Thread:
873873
"""|coro|
@@ -894,6 +894,12 @@ async def create_thread(
894894
The type of thread to create. If a ``message`` is passed then this parameter
895895
is ignored, as a thread created with a message is always a public thread.
896896
By default, this creates a private thread if this is ``None``.
897+
slowmode_delay: Optional[:class:`int`]
898+
Specifies the slowmode rate limit for users in this thread, in seconds.
899+
A value of ``0`` disables slowmode. The maximum value possible is ``21600``.
900+
invitable: Optional[:class:`bool`]
901+
Whether non-moderators can add other non-moderators to this thread.
902+
Only available for private threads, where it defaults to True.
897903
reason: :class:`str`
898904
The reason for creating a new thread. Shows up on the audit log.
899905
@@ -920,6 +926,8 @@ async def create_thread(
920926
auto_archive_duration=auto_archive_duration
921927
or self.default_auto_archive_duration,
922928
type=type.value,
929+
rate_limit_per_user=slowmode_delay or 0,
930+
invitable=invitable,
923931
reason=reason,
924932
)
925933
else:
@@ -929,6 +937,7 @@ async def create_thread(
929937
name=name,
930938
auto_archive_duration=auto_archive_duration
931939
or self.default_auto_archive_duration,
940+
rate_limit_per_user=slowmode_delay or 0,
932941
reason=reason,
933942
)
934943

@@ -1079,12 +1088,10 @@ async def edit(
10791088
available_tags: list[ForumTag] = ...,
10801089
require_tag: bool = ...,
10811090
overwrites: Mapping[Role | Member | Snowflake, PermissionOverwrite] = ...,
1082-
) -> ForumChannel | None:
1083-
...
1091+
) -> ForumChannel | None: ...
10841092

10851093
@overload
1086-
async def edit(self) -> ForumChannel | None:
1087-
...
1094+
async def edit(self) -> ForumChannel | None: ...
10881095

10891096
async def edit(self, *, reason=None, **options):
10901097
"""|coro|
@@ -1823,12 +1830,10 @@ async def edit(
18231830
video_quality_mode: VideoQualityMode = ...,
18241831
slowmode_delay: int = ...,
18251832
reason: str | None = ...,
1826-
) -> VoiceChannel | None:
1827-
...
1833+
) -> VoiceChannel | None: ...
18281834

18291835
@overload
1830-
async def edit(self) -> VoiceChannel | None:
1831-
...
1836+
async def edit(self) -> VoiceChannel | None: ...
18321837

18331838
async def edit(self, *, reason=None, **options):
18341839
"""|coro|
@@ -2448,12 +2453,10 @@ async def edit(
24482453
rtc_region: VoiceRegion | None = ...,
24492454
video_quality_mode: VideoQualityMode = ...,
24502455
reason: str | None = ...,
2451-
) -> StageChannel | None:
2452-
...
2456+
) -> StageChannel | None: ...
24532457

24542458
@overload
2455-
async def edit(self) -> StageChannel | None:
2456-
...
2459+
async def edit(self) -> StageChannel | None: ...
24572460

24582461
async def edit(self, *, reason=None, **options):
24592462
"""|coro|
@@ -2627,12 +2630,10 @@ async def edit(
26272630
nsfw: bool = ...,
26282631
overwrites: Mapping[Role | Member, PermissionOverwrite] = ...,
26292632
reason: str | None = ...,
2630-
) -> CategoryChannel | None:
2631-
...
2633+
) -> CategoryChannel | None: ...
26322634

26332635
@overload
2634-
async def edit(self) -> CategoryChannel | None:
2635-
...
2636+
async def edit(self) -> CategoryChannel | None: ...
26362637

26372638
async def edit(self, *, reason=None, **options):
26382639
"""|coro|

0 commit comments

Comments
 (0)