Skip to content

Commit 6aca10a

Browse files
authored
Merge branch 'master' into fix/poll-to-dict-id-tuple
Signed-off-by: Paillat <paillat@pycord.dev>
2 parents d5fd933 + c7cb45d commit 6aca10a

9 files changed

Lines changed: 30 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ These changes are available on the `master` branch, but have not yet been releas
1616

1717
### Fixed
1818

19+
- Fix error message for `Guild.create_sticker`.
20+
([#3263](https://github.com/Pycord-Development/pycord/pull/3263))
1921
- Fix typehint for `SlashCommandGroup.__new__`.
2022
([#3235](https://github.com/Pycord-Development/pycord/pull/3235))
2123
- Include `bypass_slowmode` in `Permissions.all`.
@@ -24,6 +26,9 @@ These changes are available on the `master` branch, but have not yet been releas
2426
([#3245](https://github.com/Pycord-Development/pycord/pull/3245))
2527
- Fix `PollAnswer.to_dict` incorrectly setting `answer_id` as a tuple instead of an int.
2628
([#3260](https://github.com/Pycord-Development/pycord/pull/3260))
29+
- Fix a bug where `TextChannel.archived_threads` would ignore any limit parameter
30+
smaller than 50 and use 50 instead.
31+
([#3266](https://github.com/Pycord-Development/pycord/pull/3266))
2732

2833
### Deprecated
2934

discord/components.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,10 +850,9 @@ def to_dict(self) -> SectionComponentPayload:
850850
return payload
851851

852852
def walk_components(self) -> Iterator[Component]:
853-
r = self.components
853+
yield from self.components
854854
if self.accessory:
855-
yield from r + [self.accessory]
856-
yield from r
855+
yield self.accessory
857856

858857
def get_component(self, id: str | int) -> Component | None:
859858
"""Get a component from this section. Roughly equivalent to `utils.get(section.walk_components(), ...)`.

discord/emoji.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def __repr__(self) -> str:
364364
return f"<AppEmoji id={self.id} name={self.name!r} animated={self.animated}>"
365365

366366
@property
367-
def guild(self) -> Guild:
367+
def guild(self) -> None:
368368
"""The guild this emoji belongs to. This is always `None` for :class:`AppEmoji`."""
369369
return None
370370

discord/flags.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -765,15 +765,6 @@ def moderation(self):
765765
return 1 << 2
766766

767767
@flag_value
768-
def emojis(self):
769-
""":class:`bool`: Alias of :attr:`.emojis_and_stickers`.
770-
771-
.. versionchanged:: 2.0
772-
Changed to an alias.
773-
"""
774-
return 1 << 3
775-
776-
@alias_flag_value
777768
def emojis_and_stickers(self):
778769
""":class:`bool`: Whether guild emoji and sticker related events are enabled.
779770
@@ -797,6 +788,15 @@ def emojis_and_stickers(self):
797788
"""
798789
return 1 << 3
799790

791+
@alias_flag_value
792+
def emojis(self):
793+
""":class:`bool`: Alias of :attr:`.emojis_and_stickers`.
794+
795+
.. versionchanged:: 2.0
796+
Changed to an alias.
797+
"""
798+
return 1 << 3
799+
800800
@flag_value
801801
def integrations(self):
802802
""":class:`bool`: Whether guild integration related events are enabled.
@@ -1495,8 +1495,8 @@ def gateway_message_content(self):
14951495

14961496
@flag_value
14971497
def gateway_message_content_limited(self):
1498-
""":class:`bool`: Returns ``True`` if the application is currently pending verification
1499-
and has hit the guild limit.
1498+
""":class:`bool`: Returns ``True`` if the application is allowed to receive limited
1499+
message content information over the gateway.
15001500
"""
15011501
return 1 << 19
15021502

discord/guild.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3084,7 +3084,7 @@ async def create_sticker(
30843084
raise TypeError('"name" parameter must be 2 to 30 characters long.')
30853085

30863086
if description and not (2 <= len(description) <= 100):
3087-
raise TypeError('"description" parameter must be 2 to 200 characters long.')
3087+
raise TypeError('"description" parameter must be 2 to 100 characters long.')
30883088

30893089
payload = {"name": name, "description": description or ""}
30903090

@@ -3327,7 +3327,7 @@ async def fetch_role(self, role_id: int) -> Role:
33273327
data = await self._state.http.get_role(self.id, role_id)
33283328
return Role(guild=self, state=self._state, data=data)
33293329

3330-
async def _fetch_role(self, role_id: int) -> Role:
3330+
async def _fetch_role(self, role_id: int) -> Role | None:
33313331
"""|coro|
33323332
33333333
Retrieves a :class:`Role` that the guild has.

discord/iterators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ async def fill_queue(self) -> None:
870870
if not self.has_more:
871871
raise NoMoreItems()
872872

873-
limit = 50 if self.limit is None else max(self.limit, 50)
873+
limit = 50 if self.limit is None else min(self.limit, 50)
874874
data = await self.endpoint(self.channel_id, before=self.before, limit=limit)
875875

876876
# This stuff is obviously WIP because 'members' is always empty

discord/member.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
from .role import RoleColours
4949
from .types.collectibles import AvatarDecoration
5050
from .user import BaseUser, User, _UserTag
51-
from .utils import MISSING
51+
from .utils import MISSING, utcnow
5252

5353
__all__ = (
5454
"VoiceState",
@@ -821,8 +821,7 @@ def timed_out(self) -> bool:
821821
"""
822822
return (
823823
self.communication_disabled_until is not None
824-
and self.communication_disabled_until
825-
> datetime.datetime.now(datetime.timezone.utc)
824+
and self.communication_disabled_until > utcnow()
826825
)
827826

828827
async def ban(
@@ -1019,8 +1018,9 @@ async def edit(
10191018
else:
10201019
if not suppress:
10211020
voice_state_payload["request_to_speak_timestamp"] = (
1022-
datetime.datetime.utcnow().isoformat()
1021+
utcnow().isoformat()
10231022
)
1023+
10241024
await http.edit_voice_state(guild_id, self.id, voice_state_payload)
10251025

10261026
if voice_channel is not MISSING:
@@ -1121,9 +1121,7 @@ async def timeout_for(
11211121
HTTPException
11221122
An error occurred doing the request.
11231123
"""
1124-
await self.timeout(
1125-
datetime.datetime.now(datetime.timezone.utc) + duration, reason=reason
1126-
)
1124+
await self.timeout(utcnow() + duration, reason=reason)
11271125

11281126
async def remove_timeout(self, *, reason: str | None = None) -> None:
11291127
"""|coro|
@@ -1172,7 +1170,7 @@ async def request_to_speak(self) -> None:
11721170
"""
11731171
payload = {
11741172
"channel_id": self.voice.channel.id,
1175-
"request_to_speak_timestamp": datetime.datetime.utcnow().isoformat(),
1173+
"request_to_speak_timestamp": utcnow().isoformat(),
11761174
}
11771175

11781176
if self._state.self_id != self.id:

discord/reaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def burst_colors(self) -> list[Colour]:
133133
return self.burst_colours
134134

135135
@property
136-
def count_details(self):
136+
def count_details(self) -> ReactionCountDetails:
137137
"""Returns :class:`ReactionCountDetails` for the individual counts of normal and super reactions made."""
138138
return ReactionCountDetails(self._count_details)
139139

discord/state.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,12 +2075,9 @@ def _update_sound(self, sound: SoundboardSound) -> SoundboardSound | None:
20752075
return before
20762076

20772077
def parse_soundboard_sounds(self, data) -> None:
2078-
guild_id = int(data["guild_id"])
20792078
for sound_data in data["soundboard_sounds"]:
20802079
self._add_sound(
2081-
SoundboardSound(
2082-
state=self, http=self.http, data=sound_data, guild_id=guild_id
2083-
)
2080+
SoundboardSound(state=self, http=self.http, data=sound_data)
20842081
)
20852082

20862083
def parse_guild_soundboard_sounds_update(self, data):

0 commit comments

Comments
 (0)