From 3791ef47050c3c31c733510925723a980a8730e9 Mon Sep 17 00:00:00 2001 From: EEKIM10 Date: Thu, 13 Oct 2022 08:53:45 +0100 Subject: [PATCH] Add a lupupa warning --- cogs/events.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cogs/events.py b/cogs/events.py index 7f228d2..15d293c 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -1,9 +1,10 @@ from typing import Optional +from datetime import datetime, time import discord -from discord.ext import commands +from discord.ext import commands, tasks from utils import Student, get_or_none -from config import guilds +from config import guilds, lupupa_warning LTR = "\N{black rightwards arrow}\U0000fe0f" @@ -13,6 +14,20 @@ RTL = "\N{leftwards black arrow}\U0000fe0f" class Events(commands.Cog): def __init__(self, bot): self.bot = bot + self.lupupa_warning_task.start() + + def cog_unload(self): + self.lupupa_warning_task.stop() + + @tasks.loop(time=[time(10, 0, 0), time(13, 30, 0)]) + async def lupupa_warning_task(self): + if lupupa_warning and datetime.now().strftime("%A") == "Thursday": + channel = discord.utils.get(self.bot.get_guild(guilds[0]).text_channels, name="general") + if channel and channel.can_send(): + await channel.send( + "Uh oh, Lupupa warning! Make sure you've got your essays written in academic style in Microsoft " + "Word on your pen drive! You aren't in primary school anymore!" + ) @commands.Cog.listener("on_raw_reaction_add") async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):