Defer response

This commit is contained in:
Parker M. 2025-01-21 21:10:41 -06:00
parent 13ee068358
commit 9dad98a914
Signed by: parker
GPG Key ID: 505ED36FC12B5D5E

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):