Python discord.py错误:缩进错误:未缩进与任何外部缩进级别不匹配

Python discord.py错误:缩进错误:未缩进与任何外部缩进级别不匹配,python,discord,discord.py,Python,Discord,Discord.py,你好,世界,我刚开始开发一个discord机器人 我的机器人可以应答和发送GIF,所以我的下一步是嵌入GIF 答复说: 缩进错误:未缩进与任何外部缩进级别不匹配 任何帮助都将受到感谢 这是我的密码: 抱歉,如果它非常基本;- 代码: 你的错误信息说明了一切。您的缩进级别不匹配。由于Python是一种解释器语言,这是您真正需要注意的事情 @client.command(hug) async def reyhugs(ctx): embed = discord.Embed( t

你好,世界,我刚开始开发一个discord机器人

我的机器人可以应答和发送GIF,所以我的下一步是嵌入GIF

答复说: 缩进错误:未缩进与任何外部缩进级别不匹配

任何帮助都将受到感谢

这是我的密码:

抱歉,如果它非常基本;-

代码:


你的错误信息说明了一切。您的缩进级别不匹配。由于Python是一种解释器语言,这是您真正需要注意的事情

@client.command(hug)
async def reyhugs(ctx):
    embed = discord.Embed(
        title=":x: rey hugs @user",
        color=discord.Colour.purple()
    )
    embed.set_image(url="https://cdn.discordapp.com/attachments/821733999637561385/843251675275591720/steamuserimages-a.akamaihd.net.gif")
    await ctx.send(embed=embed)
试试这个

你写代码的方式是错误的 纠正它,它就会工作

@client.command()
async def reyhugs(ctx):
    embed = discord.Embed(title=f":x: rey hugs {ctx.author.mention}", description="_ _",color=discord.Colour.purple())
    embed.set_image(url="https://cdn.discordapp.com/attachments/821733999637561385/843251675275591720/steamuserimages-a.akamaihd.net.gif")
    await ctx.send(embed=embed)

检查您是否混合了制表符和空格,或者只是空间太少。谢谢,我将尝试查找这些小问题^^
@client.command()
async def reyhugs(ctx):
    embed = discord.Embed(title=f":x: rey hugs {ctx.author.mention}", description="_ _",color=discord.Colour.purple())
    embed.set_image(url="https://cdn.discordapp.com/attachments/821733999637561385/843251675275591720/steamuserimages-a.akamaihd.net.gif")
    await ctx.send(embed=embed)