【问题标题】:discord.py have error in my discord bot how to fix?discord.py 在我的不和谐机器人中有错误如何解决?
【发布时间】:2021-05-11 14:15:56
【问题描述】:

我有错误 IndentationError: unindent does not match any outer indentation level,我检查了这个 - discord bot - userinfo command "IndentationError: unexpected indent",但我不知道如何修复我的代码

这一行出错 - emb = discord.Embed( title = f'{ ctx.author } | { ctx.author.display_name }', color = discord.Color.green(), description = f'{ctx.author.id} |' )

这是我所有的功能

@client.command( aliases = ['uinfo'])

async def userinfo( ctx ):
    emb = discord.Embed( title = f'{ ctx.author } | { ctx.author.display_name }', color = discord.Color.green(), description = f'{ctx.author.id} |' )
    emb.set_thumbnail( url = ctx.author.avatar_url )
    emb.add_field( name = 'Joined server', value = f'{ - }' )
    emb.add_field( name = 'Joined discord', value = f'{ - }' )

    await ctx.send( embed = emb )

【问题讨论】:

    标签: python discord.py


    【解决方案1】:

    这是与 discord.py 无关的典型 python 错误;如果您混合使用空格和制表符来缩进,则可能会出现此错误。要解决它,请确保删除每行之前的空格(错误周围的行)并将它们替换为空格或制表符(取决于您在代码中使用的内容)。

    【讨论】:

      猜你喜欢
      • 2021-11-03
      • 2021-04-27
      • 1970-01-01
      • 2021-09-22
      • 2018-11-17
      • 2021-04-30
      • 1970-01-01
      • 2021-07-20
      • 2021-05-08
      相关资源
      最近更新 更多