|  894adb1e43 This will make it convenient to include these bots in Zulip API releases on pypi. Fix #5009. | ||
|---|---|---|
| .. | ||
| assets | ||
| __init__.py | ||
| converter.config | ||
| converter.py | ||
| readme.md | ||
| test_converter.py | ||
| utils.py | ||
Converter bot
This bot allows users to perform conversions for various measurement units.
Usage
Run this bot as described in here.
Use this bot with the following command
@convert <number> <unit_from> <unit_to>
This will convert number, given in the unit unit_from, to the unit unit_to
and print the result.
- numbercan be any floating-point number, e.g. 12, 13.05, 0.002.
- unit_fromand- unit_toare two units from the following table in the same category.
- unit_fromand- unit_tocan be preceded by these prefixes.
Supported units
| Category | Units | 
|---|---|
| Area | square-centimeter (cm^2, cm2), square-decimeter (dm^2, dm2), square-meter (m^2, m2), square-kilometer (km^2, km2), square-inch (in^2, in2), square-foot (ft^2, ft2), square-yard (y^2, y2), square-mile (mi^2, mi2), are (a), hectare (ha), acre (ac) | 
| Information | bit, byte | 
| Length | centimeter (cm), decimeter (dm), meter (m), kilometer (km), inch (in), foot (ft), yard (y), mile (mi), nautical-mile (nmi) | 
| Temperature | Kelvin (K), Celsius (C), Fahrenheit (F) | 
| Volume | cubic-centimeter (cm^3, cm3), cubic-decimeter (dm^3, dm3), liter (l), cubic-meter (m^3, m3), cubic-inch (in^3, in3), fluid-ounce (fl-oz), cubic-foot (ft^3, ft3), cubic-yard (y^3, y3) | 
| Weight | gram (g), kilogram (kg), ton (t), ounce (oz), pound (lb) | 
| Cooking (metric only, U.S. and imperial units differ slightly) | teaspoon (tsp), tablespoon (tbsp), cup | 
Supported prefixes
| Prefix | Power of 10 | 
|---|---|
| atto | 10-18 | 
| pico | 10-15 | 
| femto | 10-12 | 
| nano | 10-9 | 
| micro | 10-6 | 
| milli | 10-3 | 
| centi | 10-2 | 
| deci | 10-1 | 
| deca | 101 | 
| hecto | 102 | 
| kilo | 103 | 
| mega | 106 | 
| giga | 109 | 
| tera | 1012 | 
| peta | 1015 | 
| exa | 1018 | 
Usage examples
| Message | Response | 
|---|---|
| @convert 12 celsius fahrenheit | 12.0 celsius = 53.600054 fahrenheit | 
| @convert 0.002 kilomile millimeter | 0.002 kilomile = 3218688.0 millimeter | 
| `@convert 31.5 square-mile ha | 31.5 square-mile = 8158.4625 ha | 
| @convert 56 g lb | 56.0 g = 0.12345887 lb | 
