From e04e03b775d9902cc0fd1fa2e3da9e52d1c33648 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sun, 22 Mar 2020 17:39:38 +0100 Subject: Deseasonify: propagate success value of `set_icon` The `set_icon` will return False if the application fails. Sine the `cycle` function wraps it, it should allow for the value to propagate out. --- bot/branding.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'bot/branding.py') diff --git a/bot/branding.py b/bot/branding.py index 195d46a2..e6ab44b5 100644 --- a/bot/branding.py +++ b/bot/branding.py @@ -262,7 +262,11 @@ class BrandingManager(commands.Cog): return branding_changed async def cycle(self) -> bool: - """Apply the next-up server icon.""" + """ + Apply the next-up server icon. + + Returns True if an icon is available and successfully gets applied, False otherwise. + """ if not self.available_icons: log.info("Cannot cycle: no icons for this season") return False @@ -272,10 +276,11 @@ class BrandingManager(commands.Cog): log.info(f"Set remaining icons: {await pretty_files(self.remaining_icons)}") next_up, *self.remaining_icons = self.remaining_icons - # await self.bot.set_icon(next_up.download_url) + # success = await self.bot.set_icon(next_up.download_url) log.info(f"Applying icon: {next_up}") + success = True # Default value during development - return True + return success async def apply(self) -> None: """ -- cgit v1.2.3