You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nextcord嵌入消息命令能否设置多个触发别名?附YouTube命令报错问题

问题修复方案

错误原因

你的代码触发错误的核心原因是:命令主名称与别名配置重复,你将youtube同时设置为命令主函数名,又加入了aliases别名列表,导致Nextcord注册命令时出现命名冲突。
aliases参数的作用是配置除主命令名以外的额外触发词,不需要将主命令名本身加入列表。

修复后代码

@client.command(aliases=['yt'])
async def youtube (ctx):
    embed = nextcord.Embed(
        title="Youtube", url="https://www.youtube.com/",
        description="Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.",
        colour = nextcord.Colour.brand_red(),
        
    )
    await ctx.send(embed=embed)

修改完成后,你可以用你的机器人命令前缀加youtube或者yt两种方式触发该命令,正常发送YouTube嵌入消息。

内容的提问来源于stack exchange,提问作者BasicLol

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.27 12:27:08