done, pending = await asyncio.wait([
bot.loop.create_task(bot.wait_for('message')),
bot.loop.create_task(bot.wait_for('reaction_add'))
], return_when=asyncio.FIRST_COMPLETED)
try:
stuff = done.pop().result()
except ...:
# If the first finished task died for any reason,
# the exception will be replayed here.
for future in done:
# If any exception happened in any other done tasks
# we don't care about the exception, but don't want the noise of
# non-retrieved exceptions
future.exception()
for future in pending:
future.cancel() # we don't need these anymore