misc(aurora): less restrictive type requirements for some utils functions
This commit is contained in:
parent
db7c06b044
commit
f7d2f1a564
3 changed files with 26 additions and 26 deletions
|
@ -146,16 +146,16 @@ def generate_dict(result) -> dict:
|
|||
return case
|
||||
|
||||
|
||||
async def fetch_user_dict(interaction: Interaction, user_id: str) -> dict:
|
||||
async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict:
|
||||
"""This function returns a dictionary containing either user information or a standard deleted user template."""
|
||||
if user_id == "?":
|
||||
user_dict = {"id": "?", "name": "Unknown User", "discriminator": "0"}
|
||||
|
||||
else:
|
||||
try:
|
||||
user = interaction.client.get_user(user_id)
|
||||
user = client.get_user(int(user_id))
|
||||
if user is None:
|
||||
user = await interaction.client.fetch_user(user_id)
|
||||
user_dict = {"id": user_id, "name": "Unknown User", "discriminator": "0"}
|
||||
|
||||
user_dict = {
|
||||
"id": user.id,
|
||||
|
@ -173,12 +173,12 @@ async def fetch_user_dict(interaction: Interaction, user_id: str) -> dict:
|
|||
return user_dict
|
||||
|
||||
|
||||
async def fetch_channel_dict(interaction: Interaction, channel_id: str) -> dict:
|
||||
async def fetch_channel_dict(guild: Guild, channel_id: str) -> dict:
|
||||
"""This function returns a dictionary containing either channel information or a standard deleted channel template."""
|
||||
try:
|
||||
channel = interaction.guild.get_channel(channel_id)
|
||||
channel = guild.get_channel(channel_id)
|
||||
if not channel:
|
||||
channel = await interaction.guild.fetch_channel(channel_id)
|
||||
channel = await guild.fetch_channel(channel_id)
|
||||
|
||||
channel_dict = {
|
||||
"id": channel.id,
|
||||
|
@ -192,9 +192,9 @@ async def fetch_channel_dict(interaction: Interaction, channel_id: str) -> dict:
|
|||
return channel_dict
|
||||
|
||||
|
||||
async def fetch_role_dict(interaction: Interaction, role_id: str) -> dict:
|
||||
async def fetch_role_dict(guild: Guild, role_id: str) -> dict:
|
||||
"""This function returns a dictionary containing either role information or a standard deleted role template."""
|
||||
role = interaction.guild.get_role(role_id)
|
||||
role = guild.get_role(role_id)
|
||||
if not role:
|
||||
role_dict = {"id": role_id, "name": "Deleted Role"}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue