非常简单的斜杠命令失败并显示“此交互失败”

问题描述 投票:0回答:1

在移植基于文本的命令后,我正在尝试使用 pycord 制作一个简单的 Discord 机器人,其中包含斜线命令。

我已经编写了下面尽可能简单的代码,但是每次我运行斜杠命令时,无论如何,我都会收到“此交互失败”错误,但命令行中没有错误。

on_ready()
调用,我已将机器人添加到我的测试服务器,并以管理员身份使用
applications.command
bot
访问权限,但它仍然失败。

我可能做错了什么?

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 索诺玛、Python 3

discord pycord
1个回答
0
投票

我仍然不知道发生了什么,但我制作了一个新机器人,它使用相同的代码完美运行。

© www.soinside.com 2019 - 2024. All rights reserved.