diff options
| author | 2021-03-14 09:49:55 +0100 | |
|---|---|---|
| committer | 2021-03-14 09:55:09 +0100 | |
| commit | 7900c630b81c0800c2bd7cb9e205cab8eeeac4ed (patch) | |
| tree | 342596985b812aed2c2e0f618c138e8eca6593c5 | |
| parent | Branding: propagate success-indicating boolean from 'apply_asset' (diff) | |
Branding: show success information in 'sync' response
Now that the boolean flags are propagating from 'apply_asset', we can
present them to the user.
| -rw-r--r-- | bot/exts/backend/branding/_cog.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/bot/exts/backend/branding/_cog.py b/bot/exts/backend/branding/_cog.py index dd19832af..0664a5c6c 100644 --- a/bot/exts/backend/branding/_cog.py +++ b/bot/exts/backend/branding/_cog.py @@ -462,15 +462,26 @@ class Branding(commands.Cog): @commands.has_any_role(*MODERATION_ROLES) @branding_group.command(name="sync") async def branding_sync_cmd(self, ctx: commands.Context) -> None: - """Force branding synchronisation.""" + """ + Force branding synchronisation. + + Shows which assets have failed to synchronise, if any. + """ async with ctx.typing(): - await self.synchronise() + banner_success, icon_success = await self.synchronise() - resp = make_embed( - "Synchronisation complete", - "If something doesn't look right, check log for errors.", - success=True, + failed_assets = ", ".join( + name + for name, status in [("banner", banner_success), ("icon", icon_success)] + if status is False ) + + if failed_assets: + resp = make_embed("Synchronisation unsuccessful", f"Failed to apply: {failed_assets}.", success=False) + resp.set_footer(text="Check log for details.") + else: + resp = make_embed("Synchronisation successful", "Assets have been applied.", success=True) + await ctx.send(embed=resp) # endregion |