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): async def roleinfo(self, ctx, role: discord.Role, list_permissions: bool = False):
"""Gives information on a specific role. """Gives information on a specific role.
`list_permissions` is ignored if the role you're checking has the `Administrator` permission.""" `list_permissions` is ignored if the role you're checking has the `Administrator` permission."""
icon = role.display_icon try:
if isinstance(icon, discord.Asset): icon = role.display_icon
icon_url = icon.url if isinstance(icon, discord.Asset):
elif isinstance(icon, str): icon_url = icon.url
icon_url = await self.fetch_twemoji(unicode_emoji=icon) elif isinstance(icon, str):
icon_url = await self.fetch_twemoji(unicode_emoji=icon)
except commands.CommandInvokeError:
icon_url = None
permissions = role.permissions permissions = role.permissions
if role.color.value == 0: if role.color.value == 0:
colorint = 10070709 colorint = 10070709