diff options
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/seasons/easter/egg_facts.py | 13 | ||||
| -rw-r--r-- | bot/seasons/pride/pride_facts.py | 10 | 
2 files changed, 15 insertions, 8 deletions
diff --git a/bot/seasons/easter/egg_facts.py b/bot/seasons/easter/egg_facts.py index 260a505a..cfa420f6 100644 --- a/bot/seasons/easter/egg_facts.py +++ b/bot/seasons/easter/egg_facts.py @@ -1,15 +1,14 @@  import asyncio  import logging  import random +from datetime import datetime  from json import load  from pathlib import Path  import discord  from discord.ext import commands -from bot.constants import Channels -from bot.constants import Colours - +from bot.constants import Channels, Colours, Month  log = logging.getLogger(__name__) @@ -24,6 +23,8 @@ class EasterFacts(commands.Cog):      def __init__(self, bot: commands.Bot):          self.bot = bot          self.facts = self.load_json() + +        self.active_months = {Month.april}          self.daily_fact_task = self.bot.loop.create_task(self.send_egg_fact_daily())      @staticmethod @@ -39,8 +40,10 @@ class EasterFacts(commands.Cog):          channel = self.bot.get_channel(Channels.seasonalbot_commands)          while True: -            embed = self.make_embed() -            await channel.send(embed=embed) +            current_month = Month(datetime.utcnow().month) +            if current_month in self.active_months: +                await channel.send(embed=self.make_embed()) +              await asyncio.sleep(24 * 60 * 60)      @commands.command(name='eggfact', aliases=['fact']) diff --git a/bot/seasons/pride/pride_facts.py b/bot/seasons/pride/pride_facts.py index fe5e3cf9..2df9c8cd 100644 --- a/bot/seasons/pride/pride_facts.py +++ b/bot/seasons/pride/pride_facts.py @@ -10,8 +10,7 @@ import dateutil.parser  import discord  from discord.ext import commands -from bot.constants import Channels -from bot.constants import Colours +from bot.constants import Channels, Colours, Month  log = logging.getLogger(__name__) @@ -24,6 +23,8 @@ class PrideFacts(commands.Cog):      def __init__(self, bot: commands.Bot):          self.bot = bot          self.facts = self.load_facts() + +        self.active_months = {Month.june}          self.daily_fact_task = self.bot.loop.create_task(self.send_pride_fact_daily())      @staticmethod @@ -38,7 +39,10 @@ class PrideFacts(commands.Cog):          channel = self.bot.get_channel(Channels.seasonalbot_commands)          while True: -            await self.send_select_fact(channel, datetime.utcnow()) +            current_month = Month(datetime.utcnow().month) +            if current_month in self.active_months: +                await self.send_select_fact(channel, datetime.utcnow()) +              await asyncio.sleep(24 * 60 * 60)      async def send_random_fact(self, ctx: commands.Context) -> None:  |