Use datetime.now().date() instead of today().
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Contains commands and views for set commands.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import UTC, datetime
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
@@ -57,7 +57,7 @@ class setCog(commands.Cog, name="Set Commands"):
|
||||
return
|
||||
|
||||
# check if valid day
|
||||
today = datetime.today()
|
||||
today = datetime.now(tz=UTC).date()
|
||||
try:
|
||||
birthday = datetime(today.year, month, day)
|
||||
except ValueError:
|
||||
|
||||
@@ -3,7 +3,7 @@ Defines the daily loop that runs the Dakiny bot functions.
|
||||
"""
|
||||
|
||||
import random
|
||||
from datetime import datetime, time
|
||||
from datetime import UTC, datetime, time
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands, tasks
|
||||
@@ -92,7 +92,7 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
if random.randint(0, 99) == 0:
|
||||
birthday_list.append(239547993106284544)
|
||||
|
||||
today = datetime.today()
|
||||
today = datetime.now(tz=UTC).date()
|
||||
birthday = f"{today.month}/{today.day}"
|
||||
|
||||
stmt = select(UserBirthday.UserId).where(UserBirthday.Birthday == birthday)
|
||||
@@ -105,7 +105,7 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
Loops through the guild's humans checking for joined_at dates that match today's date. Sends a message
|
||||
saying happy cakeday.
|
||||
"""
|
||||
today = datetime.today()
|
||||
today = datetime.now(tz=UTC).date()
|
||||
guild: nextcord.Guild = self.bot.get_guild(self.bot.config.params.guild_id)
|
||||
announce_channel: nextcord.TextChannel = guild.get_channel(self.bot.config.params.general_channel_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user