fix: added handling for if there's no role icon

This commit is contained in:
Seaswimmer 2023-08-08 20:15:17 -04:00
parent c03ca6649b
commit 1bab406e7e
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -507,11 +507,14 @@ class Info(commands.Cog):
async def roleinfo(self, ctx, role: discord.Role, list_permissions: bool = False):
"""Gives information on a specific role.
`list_permissions` is ignored if the role you're checking has the `Administrator` permission."""
icon = role.display_icon
if isinstance(icon, discord.Asset):
icon_url = icon.url
elif isinstance(icon, str):
icon_url = await self.fetch_twemoji(unicode_emoji=icon)
try:
icon = role.display_icon
if isinstance(icon, discord.Asset):
icon_url = icon.url
elif isinstance(icon, str):
icon_url = await self.fetch_twemoji(unicode_emoji=icon)
except commands.CommandInvokeError:
icon_url = None
permissions = role.permissions
if role.color.value == 0:
colorint = 10070709