This commit is contained in:
@@ -3,6 +3,7 @@ Defines cog for on message listener.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
@@ -28,6 +29,8 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
|
|||||||
if message.author.id == self.bot.user.id:
|
if message.author.id == self.bot.user.id:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
birthday_action(message)
|
||||||
|
|
||||||
guild_id = message.guild.id
|
guild_id = message.guild.id
|
||||||
|
|
||||||
if submission_objects.has_user(message.author.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:
|
if message.channel.id == submission_channel_id:
|
||||||
state = submission.submission_state
|
state = submission.submission_state
|
||||||
if state == SubmissionState.SCORE and message.content:
|
if state == SubmissionState.SCORE and message.content:
|
||||||
|
|
||||||
stmt = select(Category.IsTimeRecord).where(Category.CategoryId == submission.category_id)
|
stmt = select(Category.IsTimeRecord).where(Category.CategoryId == submission.category_id)
|
||||||
|
|
||||||
# check with regex if score matches correctly
|
# check with regex if score matches correctly
|
||||||
@@ -102,3 +104,19 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
|
|||||||
def setup(bot: commands.Bot):
|
def setup(bot: commands.Bot):
|
||||||
"""Adds function to bot"""
|
"""Adds function to bot"""
|
||||||
bot.add_cog(SubmissionListener(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("🎂")
|
||||||
|
|||||||
Reference in New Issue
Block a user