@commands(u'wt', u'define', u'dict')
@example(u'.wt bailiwick')
def wiktionary(bot, trigger):
 word = trigger.group(2)
 if (word is None):
  bot.reply(u'You must tell me what to look up!')
  return
 (_etymology, definitions) = wikt(word)
 if (not definitions):
  bot.say((u"Couldn't get any definitions for %s." % word))
  return
 result = format(word, definitions)
 if (len(result) < 150):
  result = format(word, definitions, 3)
 if (len(result) < 150):
  result = format(word, definitions, 5)
 if (len(result) > 300):
  result = (result[:295] + u'[...]')
 bot.say(result)

@ commands ( u'wt' , u'define' , u'dict' ) @ example ( u'.wt bailiwick' ) def wiktionary ( bot , trigger ) : word = trigger . group ( 2 ) if ( word is None ) : bot . reply ( u'You must tell me what to look up!' ) return ( _etymology , definitions ) = wikt ( word ) if ( not definitions ) : bot . say ( ( u"Couldn't get any definitions for %s." % word ) ) return result = format ( word , definitions ) if ( len ( result ) < 150 ) : result = format ( word , definitions , 3 ) if ( len ( result ) < 150 ) : result = format ( word , definitions , 5 ) if ( len ( result ) > 300 ) : result = ( result [ : 295 ] + u'[...]' ) bot . say ( result )
look up a word on wiktionary .