92d2981726
Add one function (get_bot_botname_response()) that generates response from the given input and replies back to the handle_message with the final content of response to be sent. Also add code to bots(except followup) to reply to private messages along with stream messages. |
||
---|---|---|
.. | ||
assets | ||
converter.config | ||
converter.py | ||
readme.md | ||
tests.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.
number
can be any floating-point number, e.g. 12, 13.05, 0.002.unit_from
andunit_to
are two units from the following table in the same category.unit_from
andunit_to
can 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 |