【问题标题】:Discord.py ModMail system doesnt work without problemsDiscord.py ModMail 系统无法正常工作
【发布时间】:2020-11-26 19:54:15
【问题描述】:

当我写 !apply 时,机器人会在我的私人不和谐消息中写给我并问我问题,当我写答案时,机器人会写下一个问题,但在一些问题之后,机器人会写 2 个问题而无需等待我的回答知道如何解决吗?

命令代码

@bot.command(aliases=['staff-application'])
async def apply(ctx):
    await ctx.send('Send it to you via Private Chat!')
    a_list = []
    submit_channel = bot.get_channel(781551916802113556)
    channel = await ctx.author.create_dm()

    def check(m):
        return m.content is not None and m.channel == channel

    for question in q_list:
        sleep(.30)
        await channel.send(question)
        msg = await bot.wait_for('message', check=check)
        a_list.append(msg.content)

    submit_wait = True
    while submit_wait:
        await channel.send('**DAS WÄRE ES** - Schreibe "submit" um die Antworten weiter zu leiten!')
        msg = await bot.wait_for('message', check=check)
        if "submit" in msg.content.lower():
            submit_wait = False
            answers = "\n".join(f'{a}. {b}' for a, b in enumerate(a_list, 1))
            submit_msg = f'Application from {msg.author} \nThe answers are:\n{answers}'
            await submit_channel.send(submit_msg)

问题列表

q_list = [
        'Wie heißt du?',
        'Wie alt bist du?',
        'Wie lautet dein Epic Name?',
        'Als was möchtest du dem Clan beitreten?',
        'Hast du schon Earnings?',
        'Hast du einen Duo Mate?',
        'Warum möchtest du in diesen Clan?',
        'Was willst du hier mal erreichen?'
]

【问题讨论】:

标签: python discord bots token


【解决方案1】:

你应该使用await asyncio.sleep()而不是sleep()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-29
    • 2015-08-24
    • 2017-10-27
    • 2014-05-30
    • 1970-01-01
    • 1970-01-01
    • 2021-05-25
    相关资源
    最近更新 更多