From 7ae6d4d2905b48c9bc566818396dd5f877156b3d Mon Sep 17 00:00:00 2001 From: Arjun Satarkar Date: Sun, 24 Dec 2023 13:44:22 +0530 Subject: question_of_the_day: actually check if enabled before posting 😓 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- question_of_the_day/question_of_the_day.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/question_of_the_day/question_of_the_day.py b/question_of_the_day/question_of_the_day.py index 9f4af07..3ad8472 100644 --- a/question_of_the_day/question_of_the_day.py +++ b/question_of_the_day/question_of_the_day.py @@ -50,13 +50,14 @@ class QuestionOfTheDay(commands.Cog): for guild_id in guilds_due: guild = await self.bot.fetch_guild(int(guild_id)) - channel_id = await self.config.guild(guild).post_in_channel() - if not channel_id: - self.logger.info( - f"QOTD was due for guild {guild.name} ({guild_id}) but no channel was set, so it was not posted." - ) - channel = await guild.fetch_channel(channel_id) - await self.send_question_to_channel(channel) + if await self.config.guild(guild).enabled(): + channel_id = await self.config.guild(guild).post_in_channel() + if not channel_id: + self.logger.info( + f"QOTD was due for guild {guild.name} ({guild_id}) but no channel was set, so it was not posted." + ) + channel = await guild.fetch_channel(channel_id) + await self.send_question_to_channel(channel) current_time = time.time() -- cgit v1.2.3-57-g22cb