Add new birthday action.
build_develop / build (push) Has been cancelled

This commit is contained in:
2023-07-25 11:19:56 -04:00
parent 9bef20de5b
commit d3102b57cc
+19 -1
View File
@@ -3,6 +3,7 @@ Defines cog for on message listener.
"""
import re
from datetime import datetime
import nextcord
from nextcord.ext import commands
@@ -28,6 +29,8 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
if message.author.id == self.bot.user.id:
return
birthday_action(message)
guild_id = message.guild.id
if submission_objects.has_user(message.author.id):
@@ -45,7 +48,6 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
if message.channel.id == submission_channel_id:
state = submission.submission_state
if state == SubmissionState.SCORE and message.content:
stmt = select(Category.IsTimeRecord).where(Category.CategoryId == submission.category_id)
# check with regex if score matches correctly
@@ -102,3 +104,19 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
def setup(bot: commands.Bot):
"""Adds function to bot"""
bot.add_cog(SubmissionListener(bot))
def birthday_action(message: nextcord.Message) -> None:
"""
Does the birthday thing, currently for chris only.
Args:
message (nextcord.Message): The message to check for birthday thing.
"""
today = datetime.today()
birthday = datetime(today.year, 7, 31)
chris = 642330132958281750
if today.date() == birthday.date():
if message.author.id == chris or chris in message.raw_mentions:
message.add_reaction("🎂")