Skip to content

Commit

Permalink
[Info] handle if
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg committed Aug 5, 2024
1 parent f8cc0f9 commit e9806da
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions info/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union, cast

import discord
from redbot.cogs.downloader.downloader import Downloader
from redbot.core import commands
from redbot.core.bot import Red
from redbot.core.tree import RedTree
from redbot.core.utils import AsyncIter, views
from redbot.cogs.downloader.downloader import Downloader
from redbot.core.utils.chat_formatting import box, humanize_list, pagify
from redbot.core.utils.common_filters import filter_invites

Expand Down Expand Up @@ -176,18 +176,18 @@ def __init__(
async def _callback(self: UISelect, interaction: discord.Interaction[Red]) -> None:
await interaction.response.defer()
value: str = self.values[0]
if value == "home":
if value.lower() == "home":
embed: discord.Embed = await self.view._make_embed()
await interaction.edit_original_response(embed=embed)
elif value == "avatar":
elif value.lower() == "avatar":
embed: discord.Embed = discord.Embed(
color=self.user.color, title="{}'s Avatar".format(self.user.display_name)
)
embed.set_image(
url=(self.user.avatar.url if self.user.avatar else self.user.default_avatar.url)
)
await interaction.edit_original_response(embed=embed)
elif value == "gavatar":
elif value.lower() == "gavatar":
embed: discord.Embed = discord.Embed(
color=self.user.color,
title="{}'s Guild Avatar".format(self.user.display_name),
Expand All @@ -199,7 +199,7 @@ async def _callback(self: UISelect, interaction: discord.Interaction[Red]) -> No
self.user.mention
)
await interaction.edit_original_response(embed=embed)
elif value == "banner":
elif value.lower() == "banner":
embed: discord.Embed = discord.Embed(
color=self.user.color, title="{}'s Banner".format(self.user.display_name)
)
Expand All @@ -208,7 +208,7 @@ async def _callback(self: UISelect, interaction: discord.Interaction[Red]) -> No
else:
embed.description = "{} does not have a banner.".format(self.user.mention)
await interaction.edit_original_response(embed=embed)
elif value == "roles":
elif value.lower() == "roles":
embed: discord.Embed = discord.Embed(
color=self.user.color, title="{}'s Roles".format(self.user.display_name)
)
Expand All @@ -218,7 +218,7 @@ async def _callback(self: UISelect, interaction: discord.Interaction[Red]) -> No
else "{} does not have any roles in this server.".format(self.user.mention)
)
await interaction.edit_original_response(embed=embed)
elif value == "perms":
elif value.lower() == "perms":
embed: discord.Embed = discord.Embed(
color=self.user.color, title="{}'s Permissions".format(self.user.display_name)
)
Expand All @@ -230,6 +230,10 @@ async def _callback(self: UISelect, interaction: discord.Interaction[Red]) -> No
)
)
await interaction.edit_original_response(embed=embed)
else:
await interaction.followup.send(
"I have no idea how this even happened.", ephemeral=True
)

def _format_roles(self) -> Union[str, Any]:
roles: Optional[List[str]] = get_roles(self.user)
Expand Down

0 comments on commit e9806da

Please sign in to comment.