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)
