diff options
author | 2020-03-22 14:25:18 +0100 | |
---|---|---|
committer | 2020-03-22 14:25:18 +0100 | |
commit | 10747bc7977ed1342f8cd48ab8bafebf5cae4dc4 (patch) | |
tree | d090b3858f5156219cba33127db1fafc2f70ba94 | |
parent | Deseasonify: add autostart env var (diff) |
Deseasonify: respect autostart env var
-rw-r--r-- | bot/branding.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bot/branding.py b/bot/branding.py index 690c14c1..39c3b52c 100644 --- a/bot/branding.py +++ b/bot/branding.py @@ -83,7 +83,7 @@ class BrandingManager(commands.Cog): should_cycle: t.Iterator - daemon: asyncio.Task + daemon: t.Optional[asyncio.Task] def __init__(self, bot: SeasonalBot) -> None: """ @@ -103,7 +103,10 @@ class BrandingManager(commands.Cog): self.available_icons = [] self.remaining_icons = [] - self.daemon = self.bot.loop.create_task(self._daemon_func()) + if Branding.autostart: + self.daemon = self.bot.loop.create_task(self._daemon_func()) + else: + self.daemon = None async def _daemon_func(self) -> None: """ @@ -115,7 +118,8 @@ class BrandingManager(commands.Cog): - Update assets if changes are detected (banner, guild icon, bot avatar, bot nickname) - Check whether it's time to cycle guild icons - The daemon awakens on start-up, then periodically at the time given by `seconds_until_midnight`. + If the `Branding.autostart` constant is True, The daemon awakens on start-up, + then periodically at the time given by `seconds_until_midnight`. """ await self.bot.wait_until_ready() |