@hook.command('wordrandom', 'randomword', autohelp=False)
def random_word():
 if (not api_key):
  return 'This command requires an API key from wordnik.com.'
 url = (API_URL + 'words.json/randomWord')
 params = {'api_key': api_key, 'hasDictionarydef': 'true', 'vulgar': 'true'}
 json = requests.get(url, params=params).json()
 if json:
  word = json['word']
  return 'Your random word is \x02{}\x02.'.format(word)
 else:
  return 'There was a problem contacting the Wordnik API.'

@ hook . command ( 'wordrandom' , 'randomword' , autohelp = False ) def random_word ( ) : if ( not api_key ) : return 'This command requires an API key from wordnik.com.' url = ( API_URL + 'words.json/randomWord' ) params = { 'api_key' : api_key , 'hasDictionarydef' : 'true' , 'vulgar' : 'true' } json = requests . get ( url , params = params ) . json ( ) if json : word = json [ 'word' ] return 'Your random word is \x02{}\x02.' . format ( word ) else : return 'There was a problem contacting the Wordnik API.'
returns a random word given the source of characters to pick from and resulting length .