diff options
| author | 2021-10-27 14:33:32 +0100 | |
|---|---|---|
| committer | 2021-10-27 14:33:32 +0100 | |
| commit | 241c27bce6e51f5505b2e4b24b80a642899c18f4 (patch) | |
| tree | c0c9a70c55b8453a0dc376acc1aab82f701e0224 | |
| parent | Add patrons command (diff) | |
Add monthly patrons list
| -rw-r--r-- | bot/exts/info/patreon.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/bot/exts/info/patreon.py b/bot/exts/info/patreon.py index fb4a44dfd..4ed24d23e 100644 --- a/bot/exts/info/patreon.py +++ b/bot/exts/info/patreon.py @@ -1,7 +1,8 @@ +import datetime import logging import discord -from discord.ext import commands +from discord.ext import commands, tasks from bot import constants from bot.bot import Bot @@ -12,9 +13,11 @@ log = logging.getLogger(__name__) class Patreon(commands.Cog): """Cog that shows patreon supporters.""" - def __init__(self, bot: Bot): + def __init__(self, bot: Bot) -> None: self.bot: Bot = bot + self.current_supporters_monthly.start() + @commands.Cog.listener() async def on_member_update(self, before: discord.Member, after: discord.Member) -> None: """Send a message when someone receives a patreon role.""" @@ -131,6 +134,16 @@ class Patreon(commands.Cog): """A command to activate self.send_current_supporters().""" await self.send_current_supporters(ctx.channel) + @tasks.loop(time=datetime.time(hour=17)) + async def current_supporters_monthly(self) -> None: + """A loop running every day to see if it's the first of the month, if so call self.send_current_supporters().""" + date: datetime.date = datetime.date.today().day + + if date == 1: + await self.send_current_supporters( + discord.utils.get(self.bot.get_all_channels(), id=constants.Channels.meta) + ) + def setup(bot: Bot) -> None: """Load the patreon cog.""" |