Skip to content

Commit 0b459e6

Browse files
authored
Apply suggestions from code review
Signed-off-by: Vincent Jose <[email protected]>
1 parent affaff9 commit 0b459e6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

discord/events/guild.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ async def __load__(cls, data: Any, state: ConnectionState) -> Self | None:
287287
self.guild = guild
288288
self.old_emojis = guild.emojis
289289
self.emojis = emojis
290+
return self
290291

291292

292293
class GuildStickersUpdate(Event):
@@ -333,6 +334,7 @@ async def __load__(cls, data: Any, state: ConnectionState) -> Self | None:
333334
self.old_stickers = stickers
334335
self.stickers = stickers
335336
self.guild = guild
337+
return self
336338

337339

338340
class GuildAvailable(Event, Guild):
@@ -352,7 +354,7 @@ def __init__(self) -> None: ...
352354
@override
353355
async def __load__(cls, data: Guild, state: ConnectionState) -> Self:
354356
self = cls()
355-
# self.__dict__.update(data.__dict__) # TODO: Find another way to do this
357+
self._populate_from_slots(data)
356358
return self
357359

358360

@@ -373,7 +375,7 @@ def __init__(self) -> None: ...
373375
@override
374376
async def __load__(cls, data: Guild, state: ConnectionState) -> Self:
375377
self = cls()
376-
self.__dict__.update(data.__dict__)
378+
self._populate_from_slots(data)
377379
return self
378380

379381

@@ -393,7 +395,7 @@ def __init__(self) -> None: ...
393395
@override
394396
async def __load__(cls, data: Guild, state: ConnectionState) -> Self:
395397
self = cls()
396-
# self.__dict__.update(data.__dict__) # TODO: Find another way to do this
398+
self._populate_from_slots(data)
397399
return self
398400

399401

@@ -441,7 +443,7 @@ async def __load__(cls, data: Any, state: ConnectionState) -> Self | None:
441443
await state.emitter.emit("GUILD_JOIN", guild)
442444

443445
self = cls()
444-
# self.__dict__.update(data.__dict__) # TODO: Find another way to do this
446+
self._populate_from_slots(guild)
445447
return self
446448

447449

0 commit comments

Comments
 (0)