如何在discord.py上创建自定义函数?

时间:2020-08-02 13:29:42

标签: python discord.py

我正在开发一款不和谐的bot,必须使用以下功能:

async def get_ox(author,my_msg):
    ox = ['⭕', '❌']
    for i in ox:
        await my_msg.add_reaction(i)
    def check(reaction, user):
        return user == author and str(reaction) in ox
    try:
        reaction = await client.wait_for('reaction_add', check=check, timeout=10.0)
    except asyncio.TimeoutError:
        return False
    else:
        reaction = reaction[0]
    if str(reaction)==ox[1]:
        return False
    else:
        return True

但是它绝对不起作用,并且只返回True。
我该怎么做?

1 个答案:

答案 0 :(得分:1)

我的问题是await
我必须像这样调用函数:await get_ox(message.author, my_msg)