From e69bda8985b6ea951cc465a8c541b0aef70d6246 Mon Sep 17 00:00:00 2001 From: diamante0018 Date: Thu, 23 Jan 2025 20:20:52 +0100 Subject: [PATCH] feat: heat death --- aw.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/aw.py b/aw.py index 23c88b9..2e5e4f7 100644 --- a/aw.py +++ b/aw.py @@ -13,11 +13,14 @@ from discord.ext import commands, tasks GUILD_ID = 1110531063161299074 BOT_LOG = 1112049391482703873 GENERAL_CHANNEL = 1110531063744303138 +OFFTOPIC_CHANNEL = 1112048063448617142 CRAZY_USER_ID = 1319364607487512658 CRAZY_URL = "https://cdn.discordapp.com/attachments/1119371841711112314/1329770453744746559/download.png" crazy_last_response_time = None +TARGET_DATE = datetime(2036, 8, 12, tzinfo=timezone.utc) + # Define the channel IDs where auto responds are allowed ALLOWED_CHANNELS = [ GENERAL_CHANNEL, @@ -510,6 +513,26 @@ async def update_status(): await bot.change_presence(activity=activity) +@tasks.loop(minutes=10080) +async def heat_death(): + try: + now = aware_utcnow() + + remaining_seconds = int((TARGET_DATE - now).total_seconds()) + + print(f"Seconds until August 12, 2036, UTC: {remaining_seconds}") + + channel = bot.get_channel(OFFTOPIC_CHANNEL) + if channel: + await channel.send( + f"Can you believe it? Only {remaining_seconds} seconds until August 12th, 2036, the heat death of the universe." + ) + else: + print("Debug: Channel not found. Check the OFFTOPIC_CHANNEL.") + except Exception as e: + print(f"An error occurred in heat_death task: {e}") + + @bot.event async def on_ready(): print(f"{bot.user.name} has connected to Discord!") @@ -517,6 +540,7 @@ async def on_ready(): guild=discord.Object(id=GUILD_ID) ) # Sync commands for a specific guild. update_status.start() + heat_death.start() bot.run(os.getenv("BOT_TOKEN"))