Prevent unneeded exceptions.
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user