Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
Signed-off-by: ItsRqtl <itsrqtl@gmail.com>
  • Loading branch information
ItsRqtl authored Apr 4, 2023
2 parents bcbb5ff + 982c5d8 commit c4e6b75
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ These changes are available on the `master` branch, but have not yet been releas

### Fixed

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

## [2.4.1] - 2023-03-20

Expand Down
14 changes: 12 additions & 2 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,18 @@ def dispatch(self, event: str, *args: Any, **kwargs: Any) -> None:
# Schedule additional handlers registered with @listen
for coro in self._event_handlers.get(method, []):
self._schedule_event(coro, method, *args, **kwargs)
if coro._once:
once_listeners.append(coro)

try:
if coro._once: # added using @listen()
once_listeners.append(coro)

except AttributeError: # added using @Cog.add_listener()
# https://github.com/Pycord-Development/pycord/pull/1989
# Although methods are similar to functions, attributes can't be added to them.
# This means that we can't add the `_once` attribute in the `add_listener` method
# and can only be added using the `@listen` decorator.

continue

# remove the once listeners
for coro in once_listeners:
Expand Down
6 changes: 4 additions & 2 deletions discord/ext/bridge/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,12 @@ class BridgeCommandGroup(BridgeCommand):
slash_variant: BridgeSlashGroup

def __init__(self, callback, *args, **kwargs):
ext_var = BridgeExtGroup(callback, *args, **kwargs)
kwargs.update({"name": ext_var.name})
super().__init__(
callback,
ext_variant=(ext_var := BridgeExtGroup(callback, *args, **kwargs)),
slash_variant=BridgeSlashGroup(callback, ext_var.name, *args, **kwargs),
ext_variant=ext_var,
slash_variant=BridgeSlashGroup(callback, *args, **kwargs),
parent=kwargs.pop("parent", None),
)

Expand Down
2 changes: 2 additions & 0 deletions discord/scheduled_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ async def edit(
payload["channel_id"] = location.value.id
payload["entity_metadata"] = None

payload["entity_type"] = location.type.value

location = location if location is not MISSING else self.location
if end_time is MISSING and location.type is ScheduledEventLocationType.external:
end_time = self.end_time
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-r _.txt
pylint~=2.17.1
pylint~=2.17.2
pytest~=7.2.2
pytest-asyncio~=0.21.0
# pytest-order~=1.0.1
Expand Down

0 comments on commit c4e6b75

Please sign in to comment.