因此,基本上,这个人正在尝试猜测动漫的名字!我想要做的是牢记案件的情感!我怎样才能做到这一点?这是代码:
@client.command()
async def work(ctx):
await open_account(ctx.author)
users = await get_bank_data()
user = ctx.author
def check(m):
return m.author.id == ctx.author.id
Question1 = 'https://upload.wikimedia.org/wikipedia/en/thumb/d/dc/DARLING_in_the_FRANXX%2C_second_key_visual.jpg/220px-DARLING_in_the_FRANXX%2C_second_key_visual.jpg'
Question2 = 'http://www.j1studios.com/wordpress/wp-content/uploads/Trinity-Seven-Header-001-20160707.jpg'
Question3 = 'https://www.animenewsnetwork.com/hotlink/images/encyc/A18170-2511174083.1466822675.jpg'
Question4 = 'https://www.animenewsnetwork.com/hotlink/images/encyc/A16344-911899268.1425205899.jpg'
Question5 = 'https://www.theanimedaily.com/wp-content/uploads/2020/06/20061004422210.jpg'
Question6 = 'https://th.bing.com/th/id/OIP.zvtbvP4JZNrrlAKPnclMpwHaEK?pid=Api&rs=1&adlt=strict'
Question7 = 'https://mangathrill.com/wp-content/uploads/2020/01/pjimage-1-4.jpg'
Question8 = 'https://th.bing.com/th/id/OIP.xV_2srfdOhEre9Vua-u6zAHaFb?pid=Api&rs=1&adlt=strict'
Question9 = 'https://img1.looper.com/img/gallery/the-untold-truth-of-hunter-x-hunter/intro-1591800144.jpg'
Question10 = 'https://i1.wp.com/static.anidub.com/blog/2014/09/Seirei-Tsukai-no-Blade-Dance.jpg'
questionlist = [Question1, Question2, Question3, Question4, Question5, Question6, Question7, Question8, Question9, Question10]
question = random.choice(questionlist)
await ctx.send("What is the title name of this anime?")
await asyncio.sleep(1)
await ctx.send(question)
msg = await client.wait_for('message', check=check)
await msg.lower()
if question == Question1:
if msg.content == "darling in the franxx":
earnings = random.randrange(300, 500)
await ctx.send(f"You did good! You got an earning of **{earnings}** coins!")
else:
earnings = random.randrange(0, 200)
await ctx.send(f"Did you even try? You got **{earnings}** coins!")
答案 0 :(得分:0)
msg = await client.wait_for('message', check=check)
返回discord.Message
类。并且discord.Message
没有属性lower()
。但是它有content
,content
返回邮件的字符串值。
await msg.lower()
也是很奇怪的用法,它不是协程,所以您不能await
。
所以您可以简单地做:
msg = await client.wait_for('message', check=check)
msg_content = msg.content.lower()
if question == Question1:
if msg_content == "darling in the franxx":
earnings = random.randrange(300, 500)
await ctx.send(f"You did good! You got an earning of **{earnings}** coins!")
else:
earnings = random.randrange(0, 200)
await ctx.send(f"Did you even try? You got **{earnings}** coins!")
而且,我建议您将问题和问题列表排除在命令之外,这样会更加优化。