Discord.py:尝试根据用户的反应采取措施

时间:2020-02-24 19:30:31

标签: discord.py discord.py-rewrite

这是代码:

import asyncio
import discord
from discord.ext import commands

client = commands.Bot(command_prefix = ".")
Token=""

@client.command()
async def react(ctx):
    message = await ctx.send("Test")
    await message.add_reaction("<?>")
    await message.add_reaction("<?>")
    user=ctx.message.author
    def check(reaction, user):
        user == ctx.message.author and str(message.emoji) == '?'
        try:
            reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
        except asyncio.TimeoutError:
            await channel.send('?')
        else:
            await channel.send('?')

client.run(Token)

问题在于,我总是在异步函数外部收到错误“'await'”,并且“ reaction,user = a”的a突出显示。谢谢您的帮助。

0 个答案:

没有答案