Skip to content

Commit c4e6b75

Browse files
authored
Merge branch 'master' into master
Signed-off-by: ItsRqtl <[email protected]>
2 parents bcbb5ff + 982c5d8 commit c4e6b75

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

CHANGELOG.md

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

3434
### Fixed
3535

36+
- Fixed `AttributeError` caused by
37+
[#1957](https://github.com/Pycord-Development/pycord/pull/1957) when using listeners
38+
in cogs. ([#1989](https://github.com/Pycord-Development/pycord/pull/1989))
3639
- Fixed `None` being handled incorrectly for avatar in `ClientUser.edit`.
3740
([#1994](https://github.com/Pycord-Development/pycord/pull/1994))
41+
- Fixed scheduled events breaking when changing the location from external to a channel.
42+
([#1998](https://github.com/Pycord-Development/pycord/pull/1998))
43+
- Fixed `TypeError` being raised when passing `name` argument to bridge groups.
44+
([#2000](https://github.com/Pycord-Development/pycord/pull/2000))
3845

3946
## [2.4.1] - 2023-03-20
4047

discord/client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,18 @@ def dispatch(self, event: str, *args: Any, **kwargs: Any) -> None:
442442
# Schedule additional handlers registered with @listen
443443
for coro in self._event_handlers.get(method, []):
444444
self._schedule_event(coro, method, *args, **kwargs)
445-
if coro._once:
446-
once_listeners.append(coro)
445+
446+
try:
447+
if coro._once: # added using @listen()
448+
once_listeners.append(coro)
449+
450+
except AttributeError: # added using @Cog.add_listener()
451+
# https://github.com/Pycord-Development/pycord/pull/1989
452+
# Although methods are similar to functions, attributes can't be added to them.
453+
# This means that we can't add the `_once` attribute in the `add_listener` method
454+
# and can only be added using the `@listen` decorator.
455+
456+
continue
447457

448458
# remove the once listeners
449459
for coro in once_listeners:

discord/ext/bridge/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,12 @@ class BridgeCommandGroup(BridgeCommand):
325325
slash_variant: BridgeSlashGroup
326326

327327
def __init__(self, callback, *args, **kwargs):
328+
ext_var = BridgeExtGroup(callback, *args, **kwargs)
329+
kwargs.update({"name": ext_var.name})
328330
super().__init__(
329331
callback,
330-
ext_variant=(ext_var := BridgeExtGroup(callback, *args, **kwargs)),
331-
slash_variant=BridgeSlashGroup(callback, ext_var.name, *args, **kwargs),
332+
ext_variant=ext_var,
333+
slash_variant=BridgeSlashGroup(callback, *args, **kwargs),
332334
parent=kwargs.pop("parent", None),
333335
)
334336

discord/scheduled_events.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ async def edit(
359359
payload["channel_id"] = location.value.id
360360
payload["entity_metadata"] = None
361361

362+
payload["entity_type"] = location.type.value
363+
362364
location = location if location is not MISSING else self.location
363365
if end_time is MISSING and location.type is ScheduledEventLocationType.external:
364366
end_time = self.end_time

requirements/dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-r _.txt
2-
pylint~=2.17.1
2+
pylint~=2.17.2
33
pytest~=7.2.2
44
pytest-asyncio~=0.21.0
55
# pytest-order~=1.0.1

0 commit comments

Comments
 (0)