Why is my slash command not displayed despite correct usage?

Solution for Why is my slash command not displayed despite correct usage?
is Given Below:

I am currently working with the discord-py-slash-command library and have read through the documentation here: https://discord-py-slash-command.readthedocs.io/en/latest/quickstart.html

But for whatever reason it doesn’t work, the command is not recognized/on the two servers, and the private messages of the bot the slash command doesn’t show up.

I know that discord.py doesn’t support slash commands yet, but this lib actually seems to work, at least from what I saw. Does anyone here see the mistake I made? I followed tons of tutorials with no success…

I already removed sync_commands=True or even tried to remove guild_ids and then wrote a message to the bot. Global commands take up to an hour to be displayed, but I actually avoid that with guild_ids.

Here is my code so far:

import discord
from discord.ext import commands
from discord_slash import SlashCommand # The lib

intents = discord.Intents.all()
client = commands.Bot(command_prefix="-", intents=intents)
slash = SlashCommand(client, sync_commands=True)

TOKEN = "..."

@client.event
async def on_ready():
    print("Ready!")
    print(slash.commands)
  # Prints: {'ping': <discord_slash.model.BaseCommandObject object at 0x000002184B23E708>}
guild_ids = [812510632360149XXX, 871078836870185XXX]

# Directly from the docs!
@slash.slash(name="Ping", description="Ping command", guild_ids=guild_ids)
async def _ping(ctx):  # Defines a new "context" (ctx) command called "ping."
    await ctx.send("Pong!")


@client.command(name="test") # Test command which works
async def test(ctx):
    await ctx.send("test")


client.run(TOKEN)

I also looked at other questions like: Discord.py | Slash commands aren’t working but they did not help either. Is this a problem with how I code/the program? (PyCharm)

You first have to set it to “True” in the App Settings of Discord. Here we turn on Text Box and can now use Slash commands, Most of the time this will be the error, because your code itself does not contain any, at least from what I have tested.

Here is a picture:

enter image description here

What about PRESENCE INTENT and SERVER MEMBERS INTENT in bot settings? cause i copied your code and tried to run, it worked for me. I’ve attached the images here. https://imgur.com/a/S0IuSlY

import discord
from discord.ext import commands
from discord_slash import SlashCommand # The lib

intents = discord.Intents.all()
client = commands.Bot(command_prefix="-", intents=intents)
slash = SlashCommand(client, sync_commands=True)


@client.event
async def on_ready():
    print("Ready!")



guild_ids = [85528118773940xxxxx]

@slash.slash(name="Ping", description="Ping command", guild_ids=guild_ids)
async def _ping(ctx):  # Defines a new "context" (ctx) command called "ping."
    await ctx.send("Pong!")


@client.command(name="test") # Test command which works
async def test(ctx):
    await ctx.send("test")


client.run('token')