【问题标题】:How to fix the error Command raised an exception: TypeError: 'Member' object is not iterable如何修复错误 命令引发异常:TypeError: 'Member' object is not iterable
【发布时间】:2020-10-02 23:35:37
【问题描述】:

我正在尝试创建一个命令,当他们使用该命令时 Zalgofyes 成员用户名,但我无法让它工作我正在使用 python 库 zalgo_text 这里是代码

async def fmsu(ctx):
     await ctx.author.edit(nick=zalgo.zalgo().zalgofy(ctx.author)),
     await ctx.send("Your username has been Zalgofyed {0.author.mention}".format(ctx.message))``` 

When I use the command I get this error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Member' object is not iterable

【问题讨论】:

    标签: python command bots discord


    【解决方案1】:

    你需要得到ctx.author的名字。

    目前您正在询问应该处理字符串的东西来处理成员对象..

    解决方案:ctx.author.name。我仍然强烈建议您查看 API 文档 https://discordpy.readthedocs.io/en/latest/api.html#user 了解为什么这不起作用,并且可能会帮助您解决未来的任何问题。

    【讨论】:

      猜你喜欢
      • 2020-02-03
      • 2019-09-21
      • 2022-08-18
      • 2022-12-15
      • 2021-07-07
      • 2022-11-14
      • 2021-08-08
      • 1970-01-01
      • 2017-10-14
      相关资源
      最近更新 更多