@commands(u'temp')
@example(u'.temp 100F', u'37.78\xb0C = 100.00\xb0F = 310.93K')
@example(u'.temp 100C', u'100.00\xb0C = 212.00\xb0F = 373.15K')
@example(u'.temp 100K', u'-173.15\xb0C = -279.67\xb0F = 100.00K')
def temperature(bot, trigger):
 try:
  source = find_temp.match(trigger.group(2)).groups()
 except (AttributeError, TypeError):
  bot.reply(u"That's not a valid temperature.")
  return NOLIMIT
 unit = source[1].upper()
 numeric = float(source[0])
 celsius = 0
 if (unit == u'C'):
  celsius = numeric
 elif (unit == u'F'):
  celsius = f_to_c(numeric)
 elif (unit == u'K'):
  celsius = k_to_c(numeric)
 kelvin = c_to_k(celsius)
 fahrenheit = c_to_f(celsius)
 bot.reply(u'{:.2f}\xb0C = {:.2f}\xb0F = {:.2f}K'.format(celsius, fahrenheit, kelvin))

@ commands ( u'temp' ) @ example ( u'.temp 100F' , u'37.78\xb0C = 100.00\xb0F = 310.93K' ) @ example ( u'.temp 100C' , u'100.00\xb0C = 212.00\xb0F = 373.15K' ) @ example ( u'.temp 100K' , u'-173.15\xb0C = -279.67\xb0F = 100.00K' ) def temperature ( bot , trigger ) : try : source = find_temp . match ( trigger . group ( 2 ) ) . groups ( ) except ( AttributeError , TypeError ) : bot . reply ( u"That's not a valid temperature." ) return NOLIMIT unit = source [ 1 ] . upper ( ) numeric = float ( source [ 0 ] ) celsius = 0 if ( unit == u'C' ) : celsius = numeric elif ( unit == u'F' ) : celsius = f_to_c ( numeric ) elif ( unit == u'K' ) : celsius = k_to_c ( numeric ) kelvin = c_to_k ( celsius ) fahrenheit = c_to_f ( celsius ) bot . reply ( u'{:.2f}\xb0C = {:.2f}\xb0F = {:.2f}K' . format ( celsius , fahrenheit , kelvin ) )
convert between kelvin .