diff --git a/.gitignore b/.gitignore index f784ebc..4471aed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ /.idea/ /__pycache__/ /venv/ -config.ini \ No newline at end of file +config.ini +*.7z +*.bat +/DSDPlus/ diff --git a/modules/WillieTimer/Phrases.txt b/modules/WillieTimer/Phrases.txt new file mode 100644 index 0000000..a21a6f5 --- /dev/null +++ b/modules/WillieTimer/Phrases.txt @@ -0,0 +1,10 @@ +Hey, are you busy? I just wanted to let you know IT'S 4:20! +You know, the funny thing about time is we often forget to pay attention to it and we miss out on things. ALMOST LIKE 4:20! LIGHT UP! +Oh say can you see. By the blunts early light. IT'S 4:20! +Can you smell what the rock is cooking? No? PROBABLY BECAUSE IT'S 4:20! +Willie wanted to let you know that IT'S 4:20! +It's 4:20! It's time to light up! +4:20. Can you stand it? Wait, that's not right. IT'S 4:20!! +smoke on 4/20 inhale with friends at Lowlife, Red Tiger, Taraval, Buddha Lounge, and Sticky Rice +4:20! Well, I'll take a hit. Why not! Isn't this the right way to think about time. I mean, hey, we're at 4:20 in the afternoon today, so it must make sense to think of 4:20 as THE RIGHT TIME TO FLIP A CIGARETTE! +(I'll now take a moment to explain to you what 4:20 actually means.) \ No newline at end of file diff --git a/modules/WillieTimer/cog.py b/modules/WillieTimer/cog.py index 79d718c..45a7b19 100644 --- a/modules/WillieTimer/cog.py +++ b/modules/WillieTimer/cog.py @@ -1,5 +1,6 @@ import asyncio import datetime +import random import discord from random import choice from discord.ext import commands @@ -13,14 +14,6 @@ class WillieTimer(commands.Cog): self.mention_group = str(self.bot.Default_Mention_Group) self.channel_id = int(self.bot.Default_Channel_ID) self.lock = False - self.message_pool = [ - "It's 4:20! It's time to light up!", - "Willie wanted to let you know that IT'S 4:20!", - "Can you smell what the rock is cooking? No? PROBABLY BECAUSE IT'S 4:20!", - "Oh say can you see. By the blunts early light. IT'S 4:20!", - "Hey, are you busy? I just wanted to let you know IT'S 4:20!", - "You know, the funny thing about time is we often forget to pay attention to it and we miss out on things. ALMOST LIKE 4:20! LIGHT UP!" - ] @loop(minutes=1) async def bg_timer(self): @@ -31,7 +24,7 @@ class WillieTimer(commands.Cog): if datetime.datetime.now().strftime('%H:%M') in ("04:20", "16:20"): print(f"It's {datetime.datetime.now().strftime('%H:%M:%S')}!") channel = self.bot.get_channel(id=self.channel_id) - await channel.send(f"<@&{self.bot_get_role().id}> {choice(self.message_pool)}") + await channel.send(f"<@&{self.bot_get_role().id}> {self.get_random_phrase()}") @commands.command(help="Use this command to start the background task to wait for 4:20", brief="Starts the 4:20 clock") @@ -93,6 +86,15 @@ class WillieTimer(commands.Cog): role = discord.utils.get(guild.roles, name=self.mention_group) return role + def get_random_phrase(self): + selected_phrase = None + with open('./Phrases.txt', 'r') as phrase_file: + phrases = phrase_file.readlines() + selected_phrase = choice(phrases) + + if selected_phrase is not None: + return selected_phrase + def setup(bot: commands.Bot): bot.add_cog(WillieTimer(bot))