-- Скорость: км/ч ↔ миль/ч local phrase = (jarvis.context.phrase or ""):lower() local n_str = phrase:match("([%d%.,]+)") if not n_str then return jarvis.cmd.error("Не понял число.") end local n = tonumber((n_str:gsub(",", "."))) if not n then return jarvis.cmd.error("Не понял число.") end local result, unit_out if phrase:find("в милях") or phrase:find("в миль") or phrase:find("to mph") then result = n * 0.621371 unit_out = "миль в час" elseif phrase:find("в кмч") or phrase:find("в км в час") or phrase:find("в километров") or phrase:find("to kmh") then result = n * 1.60934 unit_out = "километров в час" else return jarvis.cmd.error("Скажите: в милях в час или в км в час.") end local rounded = math.floor(result + 0.5) return jarvis.cmd.ok(string.format("%d %s.", rounded, unit_out))