Why can't I add a nextcord slash command?

Question:

I am getting this error when trying to make a slash command:

`
Ignoring exception in on_guild_available
Traceback (most recent call last):
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/client.py", line 499, in _run_event
await coro(*args, **kwargs)
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/client.py", line 2403, in on_guild_available
await self.sync_application_commands(
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/client.py", line 2186, in sync_application_commands
await self._connection.sync_application_commands(
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/state.py", line 825, in sync_application_commands
await self.register_new_application_commands(data=data, guild_id=guild_id)
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/state.py", line 1032, in register_new_application_commands
await self.register_application_command(app_cmd, guild_id)
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/state.py", line 1067, in register_application_command
raise e
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/state.py", line 1059, in register_application_command
raw_response = await self.http.upsert_guild_command(
File "/home/runner/Nextcord-First-bot/venv/lib/python3.8/site-packages/nextcord/http.py", line 374, in request
raise HTTPException(response, data)
nextcord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In name: Command name is invalid“`

The command takes 2 arguments: Tier and Server. Here is the code snippet for the command:

@bot.slash_command(name="sendPlay", description="Play with someone", guild_ids=guildIds) async def sendPlay(interaction: Interaction, tier: int, server: int): await bot.get_channel(PlayReqs).send(f"Join @username in ERLC! If you arrest them you can be banned: Server: Tier {str(tier)}, Server {str(server)}.") await interaction.response.send_message("Sent Public Invite")
Here is the full code:

import nextcord
from nextcord.ext import commands
from nextcord import Interaction, SlashOption, ChannelType
from nextcord.abc import GuildChannel
import os

PlayReqs=1010695004362113094
guildIds=[881678018580467745]
    
    

intents = nextcord.Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix="!", intents=intents)

#####Events######
@bot.event
async def on_ready():
  print(f"Logged in as {bot.user.name}")



#####Commands#####

  
@bot.slash_command(name="sendPlay", description="Play with someone", guild_ids=guildIds)
async def sendPlay(interaction: Interaction, tier: int, server: int):
  await bot.get_channel(PlayReqs).send(f"Join @username in ERLC! If you arrest them you can be banned: Server: Tier {str(tier)}, Server {str(server)}.")
  await interaction.response.send_message("Sent Public Invite")

  


  

@bot.command(name="Hi")
async def SendMessage(ctx):
  await ctx.send("Hello!")

# @bot.slash_command(name="ping", description="This pongs  the user", guild_ids=[881678018580467745])
# async def ping(interaction: Interaction, arg: bool):
#   await interaction.response.send_message("Sent Invite")
#   await bot.get_channel(1010695004362113094).send(f"Do you want to play? Code is {arg}.")


if __name__ == "__main__":
  bot.run(os.environ['TOKEN'])
`
I am running /sendPlay but I am not even getting the bot in the menu. I am a new dev in python so I wonder if its a dumb error? I need details so blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
Asked By: Ipad 6456

||

Answers:

Try to change name to, e.g. sendplay. From the docs:

The names of slash commands and their command options must only
contain lowercase letters, numbers, hyphens, and underscores and be
between 1 and 32 characters long

Answered By: qaziqarta
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.