start on moderation stuff
This commit is contained in:
1 parent
b538da6033
commit
53e0daac1e
6 files changed
+271
-15
No files matched your search
+8
-14
@@ -90,11 +90,10 @@ class Countdown(commands.Cog):
|
||||
"""Posts once per day during the 9:00-9:04 Central window."""
|
||||
try:
|
||||
now = datetime.now(CENTRAL)
|
||||
if (
|
||||
now.hour != DAILY_HOUR
|
||||
or now.minute >= 5
|
||||
or self.last_posted == now.date()
|
||||
):
|
||||
today = now.date().isoformat()
|
||||
if now.hour != DAILY_HOUR or now.minute >= 5:
|
||||
return
|
||||
if await self.bot.db.get_setting("countdown_last_posted") == today:
|
||||
return
|
||||
|
||||
embed = countdown_embed()
|
||||
@@ -102,19 +101,14 @@ class Countdown(commands.Cog):
|
||||
return
|
||||
|
||||
guild = self.bot.get_guild(config.GUILD.id)
|
||||
channel = (
|
||||
discord.utils.get(guild.text_channels, name=DAILY_CHANNEL)
|
||||
if guild
|
||||
else None
|
||||
)
|
||||
channel = (discord.utils.get(guild.text_channels, name=DAILY_CHANNEL)
|
||||
if guild else None)
|
||||
if channel is None:
|
||||
print(
|
||||
f"daily_countdown: no channel named {DAILY_CHANNEL!r}", flush=True
|
||||
)
|
||||
print(f"daily_countdown: no channel named {DAILY_CHANNEL!r}", flush=True)
|
||||
return
|
||||
|
||||
await channel.send(embed=embed)
|
||||
self.last_posted = now.date()
|
||||
await self.bot.db.set_setting("countdown_last_posted", today)
|
||||
print(f"daily_countdown: posted in #{DAILY_CHANNEL}", flush=True)
|
||||
except discord.HTTPException as e:
|
||||
print(f"daily_countdown: could not post: {e}", flush=True)
|
||||
|
||||
Reference in new issue
Block a user