Python 提问、设置和回答discord.py
因此,每当有人执行命令Python 提问、设置和回答discord.py,python,discord.py,Python,Discord.py,因此,每当有人执行命令s时,我都会尝试提出一个随机问题!工作唯一的问题是我在这方面尝试了多次,要么所有列表都被发送了,要么我得到了一个错误!这是我的密码: @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.
s时,我都会尝试提出一个随机问题!工作
唯一的问题是我在这方面尝试了多次,要么所有列表都被发送了,要么我得到了一个错误!这是我的密码:
@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
question = [
(await ctx.send(file=discord.File('work1.png')), 'DARLING in the FRANXX'),
(await ctx.send(file=discord.File('work2.png')), 'Trinity Seven')
]
questions = shuffle(question)
await ctx.send("What is the title name of this anime?")
await asyncio.sleep(1)
await ctx.send(questions)
msg = await client.wait_for('message', check=check)
if msg.content == answer:
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!")
users[str(user.id)]["wallet"] += earnings
with open("mainbank.json", "w") as f:
users = json.dump(users, f)
在您的
问题
列表中,您在对列表执行任何操作之前,正在发送这两个问题,这是有意的吗
只需重新排列问题
列表中的项目,即可发送整个列表。您可能正在寻找。不应该同时发送两个问题。您可以在的任何地方等待ctx。发送它将发送一条消息,因此您在问题列表的实例化中发送这两个问题。那么我是否要删除它们?我不知道这是您的代码,如果你不想发送到那里,那么就不要发送到那里。我如何从列表中提取答案?