temp

Privateunrated

Content

41 lines
{=(comment):puts the args in uppercase, and separates the temperature scale letter from things surrounding it. the join and replace tightens it back up to just one space between it and the other args, if there was already a space present}
{=(uargs):{upper:{args}}}
{=(spaced):{replace(&, ):{join(&):{replace(F, F ):{replace(C, C ):{replace(K, K ):{uargs}}}}}}}

{=(comment):sets the first arg to raw if it's a numerical value, and 2nd arg to type if it is F, C or K}
{=(raw):{if({m:{spaced(1)}}=={m:{spaced(1)}/1}):{spaced(1)}|error}}
{=(type):{if({contains({spaced(2)}):F C K}==true):{spaced(2)}|error}}

{=(comment):removes type from the list of types and puts the remaining into a list of nottypes}
{=(nottype):{replace(&, ):{join(&):{replace({type},):F C K}}}}

{=(comment):the math for all conversions. all are put through, the multiplication and division gives it a tenth place sigfig}
{=(C2C):{m:trunc(10*{raw})/10}}
{=(F2F):{m:trunc(10*{raw})/10}}
{=(K2K):{m:trunc(10*{raw})/10}}
{=(C2F):{m:trunc(10*(({raw}*9/5)+32))/10}}
{=(C2K):{m:trunc(10*({raw}+273.15))/10}}
{=(F2C):{m:trunc(10*(({raw}-32)*5/9))/10}}
{=(F2K):{m:trunc(10*((({raw}-32)*5/9)+273.15))/10}}
{=(K2C):{m:trunc(10*({raw}-273.15))/10}}
{=(K2F):{m:trunc(10*((({raw}-273.15)*9/5)+32))/10}}

{=(comment):if the first arg after type detection isn't a number, or the 2nd arg was not a temperature scale designation letter, outputs an error. uses blacklist and channel id conditionally to prevent sending the attached embed}
{=():}
{{if({contains(error):{raw} {type}}==true):blacklist(Input error. Please provide a numerical temperature followed by an `F`, `C`, or `K` to designate the temperature scale.):{channel(id)}}}

{=(comment):words for each temp type}
{=(Cword):Celsius}
{=(Fword):Fahrenheit}
{=(Kword):Kelvin}

{=(comment):scale of how it feels, the Celsius temps that correspond, and colors for each section}
{=(feels):freezing cold chilly cool just-right warm hot hellish}
{=(scale):0 5 10 17 23 28 50}
{=(colors):3399FF 66CCFF 33FFEE CCFFFF 22FFBB FFAA33 FF5500 FF0000}

{=(comment):grabs the temp in C, uses sgns to determine where in the scale the temperature falls by looking for the first -1 that occurs. changes all 0's to -1's for simplicity and to be "downwards inclusive" (ie, 0C = freezing)}
{=(cels):{{type}2C}}
{=(sgns):{replace(0,-1):1 {m:sgn({cels}-{scale(1)})} {m:sgn({cels}-{scale(2)})} {m:sgn({cels}-{scale(3)})} {m:sgn({cels}-{scale(4)})} {m:sgn({cels}-{scale(5)})} {m:sgn({cels}-{scale(6)})} {m:sgn({cels}-{scale(7)})} -1}}
{=(english):It feels {replace(-, ):{feels({index(-1):{sgns}})}}.}
{embed(color):#{colors({index(-1):{sgns}})}}

Embed

1 line
{"color": 5198940, "title": "{{type}2{type}}° {{type}word} is", "description": "{{type}2{nottype(1)}}° {{nottype(1)}word}\nor\n{{type}2{nottype(2)}}° {{nottype(2)}word}\n\n{english}"}
Raw JSON
{
  "id": 380626,
  "created_at": "2020-10-18T19:52:43.000Z",
  "tag_name": "temp",
  "nsfw": false,
  "owner_id": "129419437911572480",
  "uses": 14,
  "description": null,
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "728777576348254258",
  "sharer": "158368312420466697",
  "content": "{=(comment):puts the args in uppercase, and separates the temperature scale letter from things surrounding it. the join and replace tightens it back up to just one space between it and the other args, if there was already a space present}\n{=(uargs):{upper:{args}}}\n{=(spaced):{replace(&, ):{join(&):{replace(F, F ):{replace(C, C ):{replace(K, K ):{uargs}}}}}}}\n\n{=(comment):sets the first arg to raw if it's a numerical value, and 2nd arg to type if it is F, C or K}\n{=(raw):{if({m:{spaced(1)}}=={m:{spaced(1)}/1}):{spaced(1)}|error}}\n{=(type):{if({contains({spaced(2)}):F C K}==true):{spaced(2)}|error}}\n\n{=(comment):removes type from the list of types and puts the remaining into a list of nottypes}\n{=(nottype):{replace(&, ):{join(&):{replace({type},):F C K}}}}\n\n{=(comment):the math for all conversions. all are put through, the multiplication and division gives it a tenth place sigfig}\n{=(C2C):{m:trunc(10*{raw})/10}}\n{=(F2F):{m:trunc(10*{raw})/10}}\n{=(K2K):{m:trunc(10*{raw})/10}}\n{=(C2F):{m:trunc(10*(({raw}*9/5)+32))/10}}\n{=(C2K):{m:trunc(10*({raw}+273.15))/10}}\n{=(F2C):{m:trunc(10*(({raw}-32)*5/9))/10}}\n{=(F2K):{m:trunc(10*((({raw}-32)*5/9)+273.15))/10}}\n{=(K2C):{m:trunc(10*({raw}-273.15))/10}}\n{=(K2F):{m:trunc(10*((({raw}-273.15)*9/5)+32))/10}}\n\n{=(comment):if the first arg after type detection isn't a number, or the 2nd arg was not a temperature scale designation letter, outputs an error. uses blacklist and channel id conditionally to prevent sending the attached embed}\n{=():}\n{{if({contains(error):{raw} {type}}==true):blacklist(Input error. Please provide a numerical temperature followed by an `F`, `C`, or `K` to designate the temperature scale.):{channel(id)}}}\n\n{=(comment):words for each temp type}\n{=(Cword):Celsius}\n{=(Fword):Fahrenheit}\n{=(Kword):Kelvin}\n\n{=(comment):scale of how it feels, the Celsius temps that correspond, and colors for each section}\n{=(feels):freezing cold chilly cool just-right warm hot hellish}\n{=(scale):0 5 10 17 23 28 50}\n{=(colors):3399FF 66CCFF 33FFEE CCFFFF 22FFBB FFAA33 FF5500 FF0000}\n\n{=(comment):grabs the temp in C, uses sgns to determine where in the scale the temperature falls by looking for the first -1 that occurs. changes all 0's to -1's for simplicity and to be \"downwards inclusive\" (ie, 0C = freezing)}\n{=(cels):{{type}2C}}\n{=(sgns):{replace(0,-1):1 {m:sgn({cels}-{scale(1)})} {m:sgn({cels}-{scale(2)})} {m:sgn({cels}-{scale(3)})} {m:sgn({cels}-{scale(4)})} {m:sgn({cels}-{scale(5)})} {m:sgn({cels}-{scale(6)})} {m:sgn({cels}-{scale(7)})} -1}}\n{=(english):It feels {replace(-, ):{feels({index(-1):{sgns}})}}.}\n{embed(color):#{colors({index(-1):{sgns}})}}",
  "embed": "{\"color\": 5198940, \"title\": \"{{type}2{type}}° {{type}word} is\", \"description\": \"{{type}2{nottype(1)}}° {{nottype(1)}word}\\nor\\n{{type}2{nottype(2)}}° {{nottype(2)}word}\\n\\n{english}\"}",
  "last_fetched": "2026-10-20T22:48:42.124Z"
}