Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

python - can any one tell me what is missing in my code please, i cant use the discord user name

I want the user to start with 40 points, but if he already started just send how many points he has.

The error that im currently geting is: message is a required argument that is missing. But i dont know what is missing.

async def money(self, ctx, message):
    user = message.author
    read = open(user, 'a').close()

    if os.stat(user).st_size == 0:
        moneyfile=open(user, 'w')
        moneyfile.write('40')
        moneyfile.close()
    else:
        readfile = open(user, 'r').read()
        points=readfile
        int(points)
        await ctx.send(points)
question from:https://stackoverflow.com/questions/65906871/can-any-one-tell-me-what-is-missing-in-my-code-please-i-cant-use-the-discord-us

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The error reads itself, you are doing the command but not entering a message param. To fix this, delete the message param and set user in the 2nd line to ctx.author.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...