diff options
| author | 2019-03-31 14:34:57 +0530 | |
|---|---|---|
| committer | 2019-03-31 14:34:57 +0530 | |
| commit | ebd4155a2b7eb2b713bf1a04c12feaca3a1dfc1e (patch) | |
| tree | a1bdb78c8f7f4151dd1709eb52e26681d2a99d39 | |
| parent | Merge pull request #1 from python-discord/master (diff) | |
added command that gets a random april fools video
| -rw-r--r-- | bot/resources/easter/april_fools_vids.json | 125 | ||||
| -rw-r--r-- | bot/seasons/easter/april_fools_vids.py | 50 | 
2 files changed, 175 insertions, 0 deletions
| diff --git a/bot/resources/easter/april_fools_vids.json b/bot/resources/easter/april_fools_vids.json new file mode 100644 index 00000000..dfc01b7b --- /dev/null +++ b/bot/resources/easter/april_fools_vids.json @@ -0,0 +1,125 @@ +{ +  "google": [ +    { +      "title": "Introducing Bad Joke Detector", +      "link": "https://youtu.be/OYcv406J_J4" +    }, +    { +      "title": "Introducing Google Cloud Hummus API - Find your Hummus!", +      "link": "https://youtu.be/0_5X6N6DHyk" +    }, +    { +      "title": "Introducing Google Play for Pets", +      "link": "https://youtu.be/UmJ2NBHXTqo" +    }, +    { +      "title": "Haptic Helpers: bringing you to your senses", +      "link": "https://youtu.be/3MA6_21nka8" +    }, +    { +      "title": "Introducing Google Gnome", +      "link": "https://youtu.be/vNOllWX-2aE" +    }, +    { +      "title": "Introducing Google Wind", +      "link": "https://youtu.be/QAwL0O5nXe0" +    }, +    { +      "title": "Experience YouTube in #SnoopaVision", +      "link": "https://youtu.be/DPEJB-FCItk" +    }, +    { +      "title": "Introducing the self-driving bicycle in the Netherlands", +      "link": "https://youtu.be/LSZPNwZex9s" +    }, +    { +      "title": "Android Developer Story: The Guardian goes galactic with Android and Google Play", +      "link": "https://youtu.be/dFrgNiweQDk" +    }, +    { +      "title": "Introducing new delivery technology from Google Express", +      "link": "https://youtu.be/F0F6SnbqUcE" +    }, +    { +      "title": "Google Cardboard Plastic", +      "link": "https://youtu.be/VkOuShXpoKc" +    }, +    { +      "title": "Google Photos: Search your photos by emoji", +      "link": "https://youtu.be/HQtGFBbwKEk" +    }, +    { +      "title": "Introducing Google Actual Cloud Platform", +      "link": "https://youtu.be/Cp10_PygJ4o" +    }, +    { +      "title": "Introducing Dial-Up mode", +      "link": "https://youtu.be/XTTtkisylQw" +    }, +    { +      "title": "Smartbox by Inbox: the mailbox of tomorrow, today", +      "link": "https://youtu.be/hydLZJXG3Tk" +    }, +    { +      "title": "Introducing Coffee to the Home", +      "link": "https://youtu.be/U2JBFlW--UU" +    }, +    { +      "title": "Chrome for Android and iOS: Emojify the Web", +      "link": "https://youtu.be/G3NXNnoGr3Y" +    }, +    { +      "title": "Google Maps: Pokémon Challenge", +      "link": "https://youtu.be/4YMD6xELI_k" +    }, +    { +      "title": "Introducing Google Fiber to the Pole", +      "link": "https://youtu.be/qcgWRpQP6ds" +    }, +    { +      "title": "Introducing Gmail Blue", +      "link": "https://youtu.be/Zr4JwPb99qU" +    }, +    { +      "title": "Introducing Google Nose", +      "link": "https://youtu.be/VFbYadm_mrw" +    }, +    { +      "title": "Explore Treasure Mode with Google Maps", +      "link": "https://youtu.be/_qFFHC0eIUc" +    }, +    { +      "title": "YouTube's ready to select a winner", +      "link": "https://youtu.be/H542nLTTbu0" +    }, +    { +      "title": "A word about Gmail Tap", +      "link": "https://youtu.be/Je7Xq9tdCJc" +    }, +    { +      "title": "Introducing the Google Fiber Bar", +      "link": "https://youtu.be/re0VRK6ouwI" +    }, +    { +      "title": "Introducing Gmail Tap", +      "link": "https://youtu.be/1KhZKNZO8mQ" +    }, +    { +      "title": "Chrome Multitask Mode", +      "link": "https://youtu.be/UiLSiqyDf4Y" +    }, +    { +      "title": "Google Maps 8-bit for NES", +      "link": "https://youtu.be/rznYifPHxDg" +    }, +    { +      "title": "Being a Google Autocompleter", +      "link": "https://youtu.be/blB_X38YSxQ" +    }, +    { +      "title": "Introducing Gmail Motion", +      "link": "https://youtu.be/Bu927_ul_X0" +    } +  ] + +}
\ No newline at end of file diff --git a/bot/seasons/easter/april_fools_vids.py b/bot/seasons/easter/april_fools_vids.py new file mode 100644 index 00000000..1640e214 --- /dev/null +++ b/bot/seasons/easter/april_fools_vids.py @@ -0,0 +1,50 @@ +import logging +import random +from json import load +from pathlib import Path + +import discord +from discord.ext import commands + +from bot.constants import Colours + +log = logging.getLogger(__name__) + + +class AprilFoolVideos(commands.Cog): +    """A cog for april fools that gets a random april fools video from youtube.""" +    def __init__(self, bot): +        self.bot = bot +        self.yt_vids = self.load_json() +        self.youtubers = ['google']  # will add more in future + +    @staticmethod +    def load_json(): +        p = Path('bot/resources/april_fools_vids.json') +        with p.open() as json_file: +            all_vids = load(json_file) +        return all_vids + +    @commands.command(name='fool') +    async def aprial_fools(self, ctx): +        """Gets a random april fools video from youtube.""" +        random_youtuber = 'google' + +        # Change the above line of code to "random_youtuber = random.choice(self.youtubers)". +        # I will add more youtubers and their vids in the future, for now only google, Around 30 vids. + +        category = self.yt_vids[random_youtuber] +        random_vid = random.choice(category) +        embed = discord.Embed() +        embed.title = random_vid['title'] +        embed.colour = Colours.yellow +        embed.description = f'Checkout this april fools video by {random_youtuber}' +        embed.url = random_vid['link'] +        await ctx.send(embed=embed) +        await ctx.send(random_vid["link"]) + + +def setup(bot): +    """A function to add the cog.""" +    bot.add_cog(AprilFoolVideos(bot)) +    log.info('April Fools videos cog loaded!') | 
