Esempio n. 1
0
 def do(self, params):
     words = [word.text for word in params[1:]]
     term = 0
     i = 0
     for word in words:
         if word == 'what\'s':
             term = i
         elif word == 'a':
             term = i
         elif word == 'an':
             term = i
         elif word == 'is':
             term = i
         elif word == 'the':
             term = i
         i += 1
     query = ' '.join(words[term + 1:])
     print(
         f'https://en.wikipedia.org/w/api.php?action=opensearch&search={query}&limit=1&namespace=0&format=json'
     )
     response = requests.get(
         f'https://en.wikipedia.org/w/api.php?action=opensearch&search={query}&limit=1&namespace=0&format=json'
     )
     if response.status_code == 200 and response.headers[
             'content-type'] == 'application/json; charset=utf-8':
         json = response.json()
         if len(json) >= 2 and isinstance(json[2],
                                          list) and len(json[2]) >= 1:
             tts.say(json[2][0])
Esempio n. 2
0
    def do(self, params):
        post_data = reddit.submission(id=self.post_ids[randint(0, self.limit)])
        text = post_data.selftext.replace('\n\n', ' ').replace('\n', '')
        
        text = 'What the jiminy crickets did you just flaming say about me, you little bozo? I’ll have you know I graduated top of my class in the Cub Scouts, and I’ve been involved in numerous secret camping trips in Wyoming, and I have over 300 confirmed knots. I am trained in first aid and I’m the top bandager in the entire US Boy Scouts (of America). You are nothing to me but just another friendly face. I will clean your wounds for you with precision the likes of which has never been seen before on this annual trip, mark my words. You think you can get away with saying those shenanigans to me over the Internet? Think again, finkle. As we speak I am contacting my secret network of MSN friends across the USA and your IP is being traced right now so you better prepare for the seminars, man. The storm that wipes out the pathetic little thing you call your bake sale. You’re frigging done, kid. I can be anywhere, anytime, and I can tie knots in over seven hundred ways, and that’s just with my bare hands. Not only am I extensively trained in road safety, but I have access to the entire manual of the United States Boy Scouts (of America) and I will use it to its full extent to train your miserable butt on the facts of the continents, you little schmuck. If only you could have known what unholy retribution your little “clever” comment was about to bring down upon you, maybe you would have held your silly tongue. But you couldn’t, you didn’t, and now you’re paying the price, you goshdarned sillyhead. I will throw leaves all over you and you will dance in them. You’re friggin done, kiddo.'

        tts.say(text)
Esempio n. 3
0
    def do(self, params):
        response = requests.get('https://official-joke-api.appspot.com/jokes/random')
        if response.status_code == 200 and response.headers['content-type'] == 'application/json; charset=utf-8':
            json = response.json()
            setup = json['setup']
            punchline = json['punchline']

            tts.say(setup)
            time.sleep(0.5)
            tts.say(punchline)
Esempio n. 4
0
 def use_open_weather(self, api_key):
     global owm
     loc_data = location.get_location()
     weather = owm.weather_at_coords(float(loc_data.latitude),
                                     float(
                                         loc_data.longitude)).get_weather()
     print(weather)
     tts.say(
         f'It is currently {weather.get_status()} with a temperature of {round(weather.get_temperature("fahrenheit")["temp"])} degrees fahrenheit'
     )
     return
Esempio n. 5
0
 def do(self, params):
     tts.say('pong')
Esempio n. 6
0
 def do(self, params):
     tts.say('Hello, world!');
Esempio n. 7
0
 def do(self, params):
     tts.say('The time is ' + datetime.now().strftime('%I:%M %p'))
Esempio n. 8
0
 def do(self, params):
     words = map(lambda word: word.text, params[1:])
     tts.say(' '.join(words))