Advertisement
RokettoJanpu

Nightbot - !temp

Oct 22nd, 2018
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. c={F:{a:32,m:180,t:-459.67,n:"Fahrenheit (F)"},C:{a:0,m:100,t:-273.15,n:"Celsius (C)"},K:{a:273.15,m:100,t:0,n:"Kelvin (K)"},R:{a:491.67,m:180,t:0,n:"Rankine (R)"},DE:{a:-100,m:150,t:-509.725,n:"Delisle (De)"},N:{a:0,m:33,t:-90.1395,n:"Newton (N)"},RE:{a:0,m:80,t:-218.52,n:"Réaumur (Ré)"},RO:{a:7.5,m:52.5,t:-135.90375,n:"Rømer (Rø)"}};d=decodeURIComponent;t1=parseFloat(d(`$(querystring $(1))`));u1=d(`$(querystring $(2))`).toUpperCase();u2=d(`$(querystring $(3))`).toUpperCase();try{a1=c[u1].a,m1=c[u1].m,tm=c[u1].t,a2=c[u2].a,m2=c[u2].m,t2=(((t1-a1)/m1)*m2)+a2;t1>=tm?t1+` `+c[u1].n+` = `+t2+` `+c[u2].n:`Temperatures below absolute zero (`+tm+u1+`) don't exist!`;}catch(e){`Usage: !temp [temp] [old unit (F/C/K/R/De/N/Re/Ro)] [new unit (F/C/K/R/De/N/Re/Ro)]`;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement