Add a lupupa warning

This commit is contained in:
EEKIM10 2022-10-13 08:53:45 +01:00
parent 404421dee5
commit 3791ef4705

View file

@ -1,9 +1,10 @@
from typing import Optional from typing import Optional
from datetime import datetime, time
import discord import discord
from discord.ext import commands from discord.ext import commands, tasks
from utils import Student, get_or_none from utils import Student, get_or_none
from config import guilds from config import guilds, lupupa_warning
LTR = "\N{black rightwards arrow}\U0000fe0f" LTR = "\N{black rightwards arrow}\U0000fe0f"
@ -13,6 +14,20 @@ RTL = "\N{leftwards black arrow}\U0000fe0f"
class Events(commands.Cog): class Events(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = 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") @commands.Cog.listener("on_raw_reaction_add")
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent): async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):