diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | bot/resources/evergreen/magic8ball.json | 22 | ||||
| -rw-r--r-- | bot/seasons/easter/__init__.py | 17 | ||||
| -rw-r--r-- | bot/seasons/evergreen/magic_8ball.py | 36 | ||||
| -rw-r--r-- | bot/seasons/pride/__init__.py | 17 | ||||
| -rw-r--r-- | bot/seasons/valentines/savethedate.py | 23 | 
6 files changed, 105 insertions, 11 deletions
| @@ -111,3 +111,4 @@ venv.bak/  # jetbrains  .idea/ +.DS_Store
\ No newline at end of file diff --git a/bot/resources/evergreen/magic8ball.json b/bot/resources/evergreen/magic8ball.json new file mode 100644 index 00000000..6fe86950 --- /dev/null +++ b/bot/resources/evergreen/magic8ball.json @@ -0,0 +1,22 @@ +[ +    "It is certain", +    "It is decidedly so", +    "Without a doubt", +    "Yes definitely", +    "You may rely on it", +    "As I see it, yes", +    "Most likely", +    "Outlook good", +    "Yes", +    "Signs point to yes", +    "Reply hazy try again", +    "Ask again later", +    "Better not tell you now", +    "Cannot predict now", +    "Concentrate and ask again", +    "Don't count on it", +    "My reply is no", +    "My sources say no", +    "Outlook not so good", +    "Very doubtful" +]
\ No newline at end of file diff --git a/bot/seasons/easter/__init__.py b/bot/seasons/easter/__init__.py new file mode 100644 index 00000000..bfad772d --- /dev/null +++ b/bot/seasons/easter/__init__.py @@ -0,0 +1,17 @@ +from bot.seasons import SeasonBase + + +class Easter(SeasonBase): +    """ +    Easter is a beautiful time of the year often celebrated after the first Full Moon of the new spring season. +    This time is quite beautiful due to the colorful flowers coming out to greet us. So. let's greet Spring +    in an Easter celebration of contributions. +    """ + +    name = "easter" +    bot_name = "BunnyBot" +    greeting = "Happy Easter to us all!" + +    # Duration of season +    start_date = "01/04" +    end_date = "30/04" diff --git a/bot/seasons/evergreen/magic_8ball.py b/bot/seasons/evergreen/magic_8ball.py new file mode 100644 index 00000000..88c9fd26 --- /dev/null +++ b/bot/seasons/evergreen/magic_8ball.py @@ -0,0 +1,36 @@ +import json +import logging +import random +from pathlib import Path + +from discord.ext import commands + +log = logging.getLogger(__name__) + + +class Magic8ball: +    """ +    A Magic 8ball command to respond to a users question. +    """ + +    def __init__(self, bot): +        self.bot = bot +        with open(Path("bot", "resources", "evergreen", "magic8ball.json"), "r") as file: +            self.answers = json.load(file) + +    @commands.command(name="8ball") +    async def output_answer(self, ctx, *, question): +        """ +        Return a magic 8 ball answer from answers list. +        """ +        if len(question.split()) >= 3: +            answer = random.choice(self.answers) +            await ctx.send(answer) +        else: +            await ctx.send("Usage: .8ball <question> (minimum length of 3 eg: `will I win?`)") + + +# Required in order to load the cog, use the class name in the add_cog function. +def setup(bot): +    bot.add_cog(Magic8ball(bot)) +    log.info("Magic 8ball cog loaded") diff --git a/bot/seasons/pride/__init__.py b/bot/seasons/pride/__init__.py new file mode 100644 index 00000000..d8a7e34b --- /dev/null +++ b/bot/seasons/pride/__init__.py @@ -0,0 +1,17 @@ +from bot.seasons import SeasonBase + + +class Pride(SeasonBase): +    """ +    No matter your origin, identity or sexuality, we come together to celebrate each and everyone's individuality. +    Feature contributions to ProudBot is encouraged to commemorate the history and challenges of the LGBTQ+ community. +    Happy Pride Month +    """ + +    name = "pride" +    bot_name = "ProudBot" +    greeting = "Happy Pride Month!" + +    # Duration of season +    start_date = "01/06" +    end_date = "30/06" diff --git a/bot/seasons/valentines/savethedate.py b/bot/seasons/valentines/savethedate.py index b9484be9..f460283a 100644 --- a/bot/seasons/valentines/savethedate.py +++ b/bot/seasons/valentines/savethedate.py @@ -12,6 +12,9 @@ log = logging.getLogger(__name__)  HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_heart:", ":two_hearts:"] +with open(Path('bot', 'resources', 'valentines', 'date_ideas.json'), 'r', encoding="utf8") as f: +    VALENTINES_DATES = load(f) +  class SaveTheDate:      """ @@ -26,17 +29,15 @@ class SaveTheDate:          """          Gives you ideas for what to do on a date with your valentine.          """ -        with open(Path('bot', 'resources', 'valentines', 'date_ideas.json'), 'r', encoding="utf8") as f: -            valentine_dates = load(f) -            random_date = random.choice(valentine_dates['ideas']) -            emoji_1 = random.choice(HEART_EMOJIS) -            emoji_2 = random.choice(HEART_EMOJIS) -            embed = discord.Embed( -                title=f"{emoji_1}{random_date['name']}{emoji_2}", -                description=f"{random_date['description']}", -                colour=Colours.pink -            ) -            await ctx.send(embed=embed) +        random_date = random.choice(VALENTINES_DATES['ideas']) +        emoji_1 = random.choice(HEART_EMOJIS) +        emoji_2 = random.choice(HEART_EMOJIS) +        embed = discord.Embed( +            title=f"{emoji_1}{random_date['name']}{emoji_2}", +            description=f"{random_date['description']}", +            colour=Colours.pink +        ) +        await ctx.send(embed=embed)  def setup(bot): | 
