diff --git a/payphone/cogs/mods/cog.py b/payphone/cogs/mods/cog.py index 2c07d56..67edf74 100644 --- a/payphone/cogs/mods/cog.py +++ b/payphone/cogs/mods/cog.py @@ -245,34 +245,37 @@ class Mods(base.Cog): self.bot.scheduled_shutdown.value = True - oncall_channel_ids = list( - await self.bot.redis.smembers(constants.CHANNELS_ONCALL_SET) - ) - searching_channel_ids = list( - await self.bot.redis.smembers(constants.CHANNELS_SEARCH_QUEUE) - ) + if seconds > 0: + oncall_channel_ids = list( + await self.bot.redis.smembers(constants.CHANNELS_ONCALL_SET) + ) + searching_channel_ids = list( + await self.bot.redis.smembers(constants.CHANNELS_SEARCH_QUEUE) + ) - channel_ids = [int(c) for c in oncall_channel_ids] + [ - int(c) for c in searching_channel_ids - ] + channel_ids = [int(c) for c in oncall_channel_ids] + [ + int(c) for c in searching_channel_ids + ] - await ctx.send(f"⚡ Notifying `{len(channel_ids)}` channels of the shutdown.") + await ctx.send( + f"⚡ Notifying `{len(channel_ids)}` channels of the shutdown." + ) - for channel_id in channel_ids: - try: - await self.bot.get_partial_messageable(channel_id).send( - f"⚡ Payphone will be shutdown due to a maintenance restart." - + (" Reason: " + reason if reason is not None else "") - ) + for channel_id in channel_ids: + try: + await self.bot.get_partial_messageable(channel_id).send( + f"⚡ Payphone will be shutdown due to a maintenance restart." + + (" Reason: " + reason if reason is not None else "") + ) - except errors.DiscordException: - pass + except errors.DiscordException: + pass - await ctx.send( - f"⚡ All channels were notified of the shutdown. Payphone will shut down ." - ) + await ctx.send( + f"⚡ All channels were notified of the shutdown. Payphone will shut down ." + ) - await asyncio.sleep(seconds) + await asyncio.sleep(seconds) oncall_channel_ids = list( await self.bot.redis.smembers(constants.CHANNELS_ONCALL_SET) @@ -302,7 +305,7 @@ class Mods(base.Cog): await self.bot.change_presence( activity=discord.CustomActivity(name="Payphone is restarting."), - status=discord.Status.do_not_disturb + status=discord.Status.do_not_disturb, ) await self.bot.redis.delete(constants.CHANNELS_ONCALL_SET)