discordpycord

Very simple slash command failing with "This interaction failed"


I'm trying to make a simple Discord bot with pycord that includes slash commands, after porting away from text-based commands.

I've made the below simple-as-possible code, yet every time I run the slash command no matter what, I get a "This interaction failed" error, but no errors in the command line.

on_ready() calls, and I've added the bot to my test server with applications.command and bot access as an administrator, yet it's still failing.

What could I possibly be doing wrong?

import discord

bot = discord.Bot()

@bot.event
async def on_ready():
    print('Online as {0.user}'.format(bot))

@bot.slash_command(name="hello", description="Say hello to the bot")
async def hello(ctx: discord.ApplicationContext):
    await ctx.respond("Hey!")

Pycord, macOS Sonoma, Python 3


Solution

  • I still have no idea what happened, but I made a new bot and it worked perfectly with the same code.