我正在使用discord组件库的“SelectOption”组件修改我的help命令。以下是代码:-
@bot.command()
async def help(ctx):
embed_main = discord.Embed(title = "Help!", color = discord.Color.random())
await ctx.send(
embed=embed_main,
components = [
Select(placeholder="Make A Choice!", options=[SelectOption(emoji="🛠", label="Moderation", value="A", description="Get Help On Moderation")])
]
)
interaction = await bot.wait_for("select_option", check=lambda i: i.component[0].value == "A")
await interaction.respond(
embed = discord.Embed(title = "🛠 Moderation Commands", color = discord.Color.random())
embed.add_field(name = "Type `tnj.help <command name> for more info on it", value = "`kick`\n `ban`\n `unban`\n `mute`\n `unmute`\n `purge`")
)
每件事都能正常工作,但它给出了一个语法错误,并在这一行上写着“expected’”:
embed.add_field(name = "Type `tnj.help <command name> for more info on it", value = "`kick`\n `ban`\n `unban`\n `mute`\n `unmute`\n `purge`")
我不知道我做错了什么,任何帮助都将不胜感激谢谢
很难猜测您的意图,但此代码可能更接近您想要做的事情:
这假设
embed.add_field()
返回的值适合作为调用interaction.respond()
的第二个参数相关问题 更多 >
编程相关推荐