Compare commits

...

3 Commits

Author SHA1 Message Date
b48f2a1eff
Safety check 2025-01-22 16:03:57 -06:00
571a12d329
Remove view properly 2025-01-22 16:03:40 -06:00
9dad98a914
Defer response 2025-01-21 21:10:41 -06:00
3 changed files with 18 additions and 20 deletions

View File

@ -20,6 +20,8 @@ class NewAccount(commands.Cog):
@app_commands.check(lambda inter: JELLYFIN_ENABLED)
async def newaccount(self, interaction: discord.Interaction) -> None:
"""Create a new temporary Jellyfin account"""
# Defer in case it takes too long
await interaction.response.defer(ephemeral=True)
# Make sure the user doesn't already have an account
with Session() as session:
account = (
@ -38,9 +40,7 @@ class NewAccount(commands.Cog):
),
color=0xD01B86,
)
return await interaction.response.send_message(
embed=embed, ephemeral=True
)
return await interaction.followup.send(embed=embed)
# Create a new Jellyfin account for the user
response = create_jellyfin_account(interaction.user.id)
@ -53,9 +53,7 @@ class NewAccount(commands.Cog):
),
color=0xD01B86,
)
await interaction.response.send_message(
embed=embed, ephemeral=True
)
await interaction.followup.send(embed=embed)
# Send the user their account information
embed = discord.Embed(
@ -83,9 +81,7 @@ class NewAccount(commands.Cog):
),
color=0xD01B86,
)
return await interaction.response.send_message(
embed=embed, ephemeral=True
)
return await interaction.followup.send(embed=embed)
async def setup(bot):

View File

@ -200,13 +200,15 @@ class Status(commands.Cog):
session.commit()
# If series and only a portion of episodes have been downloaded
if data.get("statistics").get("percentOfEpisodes"):
description += (
f"\n**{title} ({release_year})** - Status: `NOT"
" FOUND"
f" ({int(data['statistics']['percentOfEpisodes'])}%"
" of eps.)`"
)
# If data["statistics"] exists and is not None
if "statistics" in data and data["statistics"] != None:
if "percentOfEpisodes" in data["statistics"]:
description += (
f"\n**{title} ({release_year})** - Status: `NOT"
" FOUND"
f" ({int(data['statistics']['percentOfEpisodes'])}%"
" of eps.)`"
)
# All other scenarios, download not found
else:
description += (

View File

@ -148,7 +148,8 @@ class RequestButtonView(discord.ui.View):
),
color=0xD01B86,
)
await interaction.response.send_message(embed=embed, view=None)
await interaction.response.edit_message(view=None)
await interaction.followup.send(embed=embed)
# Alert the user that the content failed to be added
else:
embed = discord.Embed(
@ -159,9 +160,8 @@ class RequestButtonView(discord.ui.View):
f" {self.service} library."
),
)
return await interaction.response.edit_message(
embed=embed, view=None
)
await interaction.delete_original_response()
return await interaction.response.edit_message(embed=embed)
# Keep track of the requests for the `/status` command
with Session() as session: