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

View File

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

View File

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