Prevent unneeded exceptions.
build_latest / build (push) Successful in 1m23s
build_develop / build (push) Successful in 1m7s

This commit is contained in:
2024-01-01 14:11:07 -05:00
parent 2596b9fa7b
commit 5d05006a23
+10 -2
View File
@@ -79,6 +79,10 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
config: DakinyConfig = self.bot.config config: DakinyConfig = self.bot.config
cycle = get_current_cycle(config) cycle = get_current_cycle(config)
# prevent exception from using cycle as an Int in an array
if cycle is None:
return None
return ElectionCycle(cycle, config, self.bot.get_guild(config.params.guild_id)) return ElectionCycle(cycle, config, self.bot.get_guild(config.params.guild_id))
def update_birthdays(self) -> None: def update_birthdays(self) -> None:
@@ -107,10 +111,14 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
today = datetime.today() today = datetime.today()
guild: nextcord.Guild = self.bot.get_guild(self.bot.config.params.guild_id) 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) announce_channel: nextcord.TextChannel = guild.get_channel(
self.bot.config.params.general_channel_id
)
cakedays: list[nextcord.Member] = [ cakedays: list[nextcord.Member] = [
human for human in guild.humans if human.joined_at.month == today.month and human.joined_at.day == today.day human
for human in guild.humans
if human.joined_at.month == today.month and human.joined_at.day == today.day
] ]
for member in cakedays: for member in cakedays: