1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

Converted appropriate waits to gathers for ease of use with exceptions

This commit is contained in:
Myned 2017-11-07 01:50:44 -05:00
parent e550c7b14e
commit 06e07dc865

View file

@ -681,10 +681,8 @@ class MsG:
while not self.bot.is_closed(): while not self.bot.is_closed():
try: try:
done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60),
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)], return_when=asyncio.FIRST_COMPLETED) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)])
for future in done:
future.result()
except exc.Save: except exc.Save:
if values[c - 1]['url'] not in hearted: if values[c - 1]['url'] not in hearted:
@ -824,10 +822,8 @@ class MsG:
while not self.bot.is_closed(): while not self.bot.is_closed():
try: try:
done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60),
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)], return_when=asyncio.FIRST_COMPLETED) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)])
for future in done:
future.result()
except exc.Save: except exc.Save:
if values[c - 1]['url'] not in hearted: if values[c - 1]['url'] not in hearted:
@ -990,10 +986,8 @@ class MsG:
while not self.bot.is_closed(): while not self.bot.is_closed():
try: try:
done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60),
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)], return_when=asyncio.FIRST_COMPLETED) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)])
for future in done:
future.result()
except exc.Save: except exc.Save:
if values[c - 1]['url'] not in hearted: if values[c - 1]['url'] not in hearted: