为什么discord.py向数字传递消息时出错

2024-04-26 17:31:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要帮助,我不知道我的代码出了什么问题。有人能解释一下吗

@client.command()
async def gameONE(ctx):
    await ctx.send("Welcome to the GAME! (between 1-20) ")

    pcNumber = random.randint(0,21)
    print(pcNumber)

    await ctx.send("Enter a number please.. ")
    userNumber = await client.wait_for("message")
    corro = float(userNumber.contect)
    if pcNumber > corro:
        ctx.send("PC won!")
    elif corro > pcNumber:
        ctx.send("YOU won!")
    else:
        ctx.send("I didnt understand")

它给了我这个错误:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Message' object has no attribute 'contect'