I cannot use my slash command twice without restarting my bot

16 Views Asked by At

So I'm developing a bot for someone and whenever I try to run my command twice, it doesn't work. Every time I restart it, I can run it once but then it doesn't pop up in the slash command tab. Can anyone help?

@client.slash_command(name='appaccept', description='Accept someone\'s application!', guild_ids=[server_id])
async def appaccept(
    interaction: nextcord.Interaction,
    member: nextcord.Member,
    channel: nextcord.TextChannel,
    application: str = nextcord.SlashOption(description='Which application?', choices=['Staff', 'Designer', 'Developer'], required=True),
    reason: str = nextcord.SlashOption(description='What\'s the reason?', required=True)
):
    required_role_ids = [1201203378596872282, 1201201157180235857]

    has_required_role = any(role.id in required_role_ids for role in interaction.user.roles)

    if has_required_role:
        if application.lower() not in ['staff', 'designer', 'developer']:
            await interaction.response.send_message('Please choose the correct application choice.', ephemeral=True)
            return
        
        reasons_list = reason.split(',')
        
        application = application.lower()

        tada = ''

        embed = nextcord.Embed(
            title=f'{tada} **__Application Results__** {tada}',
            description=f'Congratulations {member.mention} on passing your {application} application!',
            color=0x00FF00
        )

        embed.set_thumbnail(url='https://cdn.discordapp.com/icons/1200555592805273611/5c112985f8390ee88a6d0e18c7413274.png?size=512')
        embed.add_field(name="> **Reason(s):**", value="\n".join([f"⤷ {reason}" for reason in reasons_list]), inline=False)
        embed.add_field(name='> **Reviewed By:**', value=f"\n{interaction.user.mention}", inline=False)
        embed.set_footer(text=f"Applicant: {member.name}", icon_url=member.avatar.url if member.avatar else member.default_avatar.url)

        await channel.send(content=member.mention, embed=embed)
        await interaction.response.send_message(f'{member.mention}\'s application accepted in {channel.mention}.', ephemeral=True)

    else:
        await interaction.response.send_message('You do not have permission to run this command.', ephemeral=True)

I've looked through my code and didn't spot anything wrong.

0

There are 0 best solutions below