Skip to content

Commit 1244e4f

Browse files
authored
full cache
1 parent 3f04a98 commit 1244e4f

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

discord/client.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,25 @@ def emojis(self) -> list[GuildEmoji | AppEmoji]:
342342
343343
.. note::
344344
345-
This only includes the application's emojis if :attr:`~Client.cache_app_emojis` is ``True``.
345+
This only includes the application's emojis if `cache_app_emojis` is ``True``.
346346
"""
347347
return self._connection.emojis
348348

349+
@property
350+
def guild_emojis(self) -> list[GuildEmoji]:
351+
"""The :class:`~discord.GuildEmoji` that the connected client has."""
352+
return [e for e in self.emojis if isinstance(e, GuildEmoji)]
353+
354+
@property
355+
def app_emojis(self) -> list[AppEmoji]:
356+
"""The :class:`~discord.AppEmoji` that the connected client has.
357+
358+
.. note::
359+
360+
This is only available if `cache_app_emojis` is ``True``.
361+
"""
362+
return [e for e in self.emojis if isinstance(e, AppEmoji)]
363+
349364
@property
350365
def stickers(self) -> list[GuildSticker]:
351366
"""The stickers that the connected client has.

discord/state.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,11 @@ async def query_members(
602602
raise
603603

604604
async def _delay_ready(self) -> None:
605+
606+
if self.cache_app_emojis and self.application_id:
607+
data = await self.http.get_all_application_emojis(self.application_id)
608+
for e in data.get("items", []):
609+
self.maybe_store_app_emoji(self.application_id, e)
605610
try:
606611
states = []
607612
while True:
@@ -643,11 +648,6 @@ async def _delay_ready(self) -> None:
643648
except AttributeError:
644649
pass # already been deleted somehow
645650

646-
if self.cache_app_emojis and self.application_id:
647-
data = await self.http.get_all_application_emojis(self.application_id)
648-
for e in data.get("items", []):
649-
self.maybe_store_app_emoji(self.application_id, e)
650-
651651
except asyncio.CancelledError:
652652
pass
653653
else:

0 commit comments

Comments
 (0)