From 65ceaf4f715a8d33b27d9fa344b855efaf0d46ad Mon Sep 17 00:00:00 2001 From: Jimbo <17926797+Kapppa@users.noreply.github.com> Date: Sun, 12 Jun 2022 14:41:08 +0100 Subject: [PATCH] Support for alternative role icon getters (#47) * Support for alternative role icon getters * Do member check and remove nested if * redundant else --- chat_exporter/construct/message.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chat_exporter/construct/message.py b/chat_exporter/construct/message.py index 7f6e092..7c30ab4 100644 --- a/chat_exporter/construct/message.py +++ b/chat_exporter/construct/message.py @@ -253,8 +253,13 @@ async def _gather_user_colour(self, author: discord.Member): async def _gather_user_icon(self, author: discord.Member): member = await self._gather_member(author) - if member and member.display_icon: + if not member: + return "" + + if hasattr(member, "display_icon") and member.display_icon: return f"Role Icon" + elif hasattr(member, "top_role") and member.top_role and member.top_role.icon: + return f"Role Icon" return "" def set_time(self, message: Optional[discord.Message] = None):