Example #1
0
    def get_random_joke(cls, first_name=None, last_name=None):
        """ Returns a random joke fetched from remote API.
        :return Result object
        """

        return Result(
            text=utils.get_joke(first_name=first_name, last_name=last_name))
Example #2
0
def joke():
    '''API to get random word'''
    error, content = get_joke(
        request.args.get('firstName', settings.DEFAULT_FIRST_NAME),
        request.args.get('lastName', settings.DEFAULT_LAST_NAME),
    )
    if not error:
        resp = make_response(200, {'content': content})
    else:
        resp = make_response(502, {'status': 'error', 'error': error})

    return resp
Example #3
0
def joke(update, context):
    update.message.reply_text(get_joke(update.message.text),
                              reply_markup=markup)
Example #4
0
 def test_get_joke_content(self, mock_get):
     error, word = get_joke('Alex', 'Golt')
     self.assertEqual(error, None)
     self.assertEqual(word, 'Alex Golt is a funny')
Example #5
0
def command_joke(name: str, args: str):
    rcon.say(utils.get_joke())