def get_emote(emote_id: str, server: discord.Server):
""" Return the image of a custom emote. """
emote = discord.Emoji(id=emote_id, server=server)
# Return the cached version if possible
if emote.id in emote_cache:
return Image.open(emote_cache[emote.id])
# Otherwise, download the emote, store it in the cache and return
emote_bytes = await utils.download_file(emote.url, bytesio=True)
emote_cache[emote.id] = emote_bytes
return Image.open(emote_bytes)
评论列表
文章目录