aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-12-25 12:11:19 -0800
committerGravatar MarkKoz <[email protected]>2020-02-12 10:07:45 -0800
commit919431fddfd2f392cf549177f1d4743c76034951 (patch)
tree98dcf0f6ab0a996608694ac7f5e7992aa8479f96
parentSync: fix missing await for fetch_channel (diff)
Sync: fix passing context instead of message to _confirm()
* Mention possibility of timing out as a reason for aborting a sync
-rw-r--r--bot/cogs/sync/syncers.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/bot/cogs/sync/syncers.py b/bot/cogs/sync/syncers.py
index d9010ce3f..1465730c1 100644
--- a/bot/cogs/sync/syncers.py
+++ b/bot/cogs/sync/syncers.py
@@ -92,8 +92,8 @@ class Syncer(abc.ABC):
await message.edit(content=f':ok_hand: {self.name} sync will proceed.')
return True
else:
- log.warning(f"{self.name} syncer aborted!")
- await message.edit(content=f':x: {self.name} sync aborted!')
+ log.warning(f"{self.name} syncer aborted or timed out!")
+ await message.edit(content=f':x: {self.name} sync aborted or timed out!')
return False
@abc.abstractmethod
@@ -115,20 +115,21 @@ class Syncer(abc.ABC):
optionally redirect to `ctx` instead.
"""
log.info(f"Starting {self.name} syncer.")
+ message = None
if ctx:
message = await ctx.send(f"📊 Synchronising {self.name}s.")
diff = await self._get_diff(guild)
totals = {k: len(v) for k, v in diff._asdict().items() if v is not None}
- if sum(totals.values()) > self.MAX_DIFF and not await self._confirm(ctx):
+ if sum(totals.values()) > self.MAX_DIFF and not await self._confirm(message):
return # Sync aborted.
await self._sync(diff)
results = ", ".join(f"{name} `{total}`" for name, total in totals.items())
log.info(f"{self.name} syncer finished: {results}.")
- if ctx:
+ if message:
await message.edit(
content=f":ok_hand: Synchronisation of {self.name}s complete: {results}"
)