首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试使用users.nitro discord.py时出错

尝试使用users.nitro discord.py时出错
EN

Stack Overflow用户
提问于 2021-01-12 05:08:00
回答 1查看 261关注 0票数 1
代码语言:javascript
复制
    @client.command()
    async def nitro(ctx):
        nitro = ctx.message.author.discord.profile.nitro
        embed = discord.Embed(title=f":house_with_garden: {ctx.message.author} - Stats",
                              description=f"Nitro: {nitro}",
                              color=discord.Colour.green())
        await ctx.send(embed=embed)

每当我运行这个命令时,我都会得到这样的错误:

代码语言:javascript
复制
"discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'discord'" 

当我输入:.nitro @username时,我想告诉用户是否有nitro

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-12 05:11:49

使用ctx.message.author.profile().nitro,因为discord.Profile是一个表示用户配置文件的类(可通过Member.profile访问)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65674545

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档