我有这个代码。它应该做的是询问用户他们的姓名和电子邮件,然后制作一个名为输入姓名和数字 600 并包含电子邮件地址的文本文档。但它不起作用。我尝试了许多不同的教程和措辞方式,但它不接受变量。
await message.author.send('We need some information first.\nWhat is your name?')
Name = await message.content
await message.author.send('What is the Email you used for your PayPal account?')
Email = await message.content
with open(Name + '600.txt', "w") as f:
f.write(Email())
错误:
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\ArtyF\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\ArtyF\AppData\Roaming\Microsoft\Windows\Network Shortcuts\HWMonitor\discord bot\bot.py", line 34, in on_message
Name = await message.content
TypeError: object str can't be used in 'await' expression
答案 0 :(得分:0)
你不能在 message.content 中使用 await,所以它只是 message.content