Merge pull request #606 from appelemac/unitconversion

Unitconversion
This commit is contained in:
Master Kwoth 2016-09-05 00:53:28 +02:00 committed by GitHub
commit 397ba798a5
10 changed files with 1292 additions and 0 deletions

View File

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace NadekoBot.Modules.Searches.Commands.Models
{
public class MeasurementUnit
{
public List<string> Triggers { get; set; }
public string UnitType { get; set; }
public decimal Modifier { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace NadekoBot.Modules.Searches.Commands.Models
{
public class Rates
{
public string Base { get; set; }
public DateTime Date { get; set; }
[JsonProperty("rates")]
public Dictionary<string, decimal> ConversionRates { get; set; }
}
}

View File

@ -0,0 +1,201 @@
using Discord;
using Discord.Commands;
using NadekoBot.Attributes;
using NadekoBot.Extensions;
using NadekoBot.Modules.Searches.Commands.Models;
using NadekoBot.Services;
using NadekoBot.Services.Database.Models;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
namespace NadekoBot.Modules.Searches
{
public partial class Searches
{
[Group]
public class UnitConverterCommands
{
private Logger _log;
private static Timer _timer;
public static TimeSpan Span = new TimeSpan(12, 0, 0);
public UnitConverterCommands()
{
_log = LogManager.GetCurrentClassLogger();
try
{
using (var uow = DbHandler.UnitOfWork())
{
//need to do this the first time
if (uow.ConverterUnits.Empty())
{
var content = JsonConvert.DeserializeObject<List<MeasurementUnit>>(File.ReadAllText("units.json")).Select(u => new ConvertUnit()
{
Modifier = u.Modifier,
UnitType = u.UnitType,
InternalTrigger = string.Join("|", u.Triggers)
});
uow.ConverterUnits.AddRange(content.ToArray());
uow.Complete();
}
Units = uow.ConverterUnits.GetAll().ToList();
}
}
catch (Exception e)
{
_log.Warn("Could not load units: " + e.Message);
}
_timer = new Timer(new TimerCallback(UpdateCurrency), null, 0,(int)Span.TotalMilliseconds);
}
public void UpdateCurrency(object stateInfo)
{
var currencyRates = UpdateCurrencyRates().Result;
var unitTypeString = "currency";
using (var uow = DbHandler.UnitOfWork())
{
var toRemove = Units.Where(u => u.UnitType == unitTypeString);
Units.RemoveAll(u => u.UnitType == unitTypeString);
uow.ConverterUnits.RemoveRange(toRemove.ToArray());
var baseType = new ConvertUnit()
{
Triggers = new[] { currencyRates.Base },
Modifier = decimal.One,
UnitType = unitTypeString
};
uow.ConverterUnits.Add(baseType);
Units.Add(baseType);
var range = currencyRates.ConversionRates.Select(u => new ConvertUnit()
{
InternalTrigger = u.Key,
Modifier = u.Value,
UnitType = unitTypeString
}).ToArray();
uow.ConverterUnits.AddRange(range);
Units.AddRange(range);
uow.Complete();
}
_log.Info("Updated Currency");
}
public List<ConvertUnit> Units { get; set; }
[LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
[RequireContext(ContextType.Guild)]
public async Task ConvertListE(IUserMessage msg) //extended and bugged list
{
var channel = msg.Channel as IGuildChannel;
var sb = new StringBuilder("Units that can be used by the converter: \n");
var res = Units.GroupBy(x => x.UnitType);
foreach (var group in res)
{
sb.AppendLine($"{group.Key}: ```xl");
foreach (var el in group)
{
sb.Append($" [{string.Join(",", el.Triggers)}] ");
}
sb.AppendLine("```");
}
await msg.ReplyLong(sb.ToString(), "```xl", "```", "```xl");
}
[LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
[RequireContext(ContextType.Guild)]
public async Task ConvertList(IUserMessage msg)
{
var sb = new StringBuilder("Units that can be used by the converter: \n");
var res = Units.GroupBy(x => x.UnitType);
foreach (var group in res)
{
sb.AppendLine($"{group.Key}: ```xl");
sb.AppendLine(string.Join(",", group.Select(x => x.Triggers.FirstOrDefault()).OrderBy(x => x)));
sb.AppendLine("```");
}
await msg.ReplyLong(sb.ToString(), "```xl", "```", "```xl");
}
[LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
public async Task Convert(IUserMessage msg, string origin, string target, decimal value)
{
var originUnit = Units.Find(x => x.Triggers.Select(y => y.ToLowerInvariant()).Contains(origin.ToLowerInvariant()));
var targetUnit = Units.Find(x => x.Triggers.Select(y => y.ToLowerInvariant()).Contains(target.ToLowerInvariant()));
if (originUnit == null || targetUnit == null)
{
await msg.Reply(string.Format("Cannot convert {0} to {1}: units not found", origin, target));
return;
}
if (originUnit.UnitType != targetUnit.UnitType)
{
await msg.Reply(string.Format("Cannot convert {0} to {1}: types of unit are not equal", originUnit.Triggers.First(), targetUnit.Triggers.First()));
return;
}
decimal res;
if (originUnit.Triggers == targetUnit.Triggers) res = value;
else if (originUnit.UnitType == "temperature")
{
//don't really care too much about efficiency, so just convert to Kelvin, then to target
switch (originUnit.Triggers.First().ToUpperInvariant())
{
case "C":
res = value + (decimal)273.15; //celcius!
break;
case "F":
res = (value + (decimal)459.67) * ((decimal)5 / 9);
break;
default:
res = value;
break;
}
//from Kelvin to target
switch (targetUnit.Triggers.First())
{
case "C":
res = value - (decimal)273.15; //celcius!
break;
case "F":
res = res * ((decimal)9 / 5) - (decimal)458.67;
break;
default:
break;
}
}
else
{
//I just love currency
if (originUnit.UnitType == "currency")
{
res = (value * targetUnit.Modifier) / originUnit.Modifier;
}
else
res = (value * originUnit.Modifier) / targetUnit.Modifier;
}
res = Math.Round(res, 2);
await msg.Reply(string.Format("{0} {1} is equal to {2} {3}", value, originUnit.Triggers.First(), res, targetUnit.Triggers.First()));
}
}
public static async Task<Rates> UpdateCurrencyRates()
{
using (var http = new HttpClient())
{
var res = await http.GetStringAsync("http://api.fixer.io/latest").ConfigureAwait(false);
return JsonConvert.DeserializeObject<Rates>(res);
}
}
}
}

View File

@ -17,6 +17,7 @@ namespace NadekoBot.Services.Database
ISelfAssignedRolesRepository SelfAssignedRoles { get; }
IBotConfigRepository BotConfig { get; }
IRepeaterRepository Repeaters { get; }
IUnitConverterRepository ConverterUnits { get; }
int Complete();
Task<int> CompleteAsync();

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace NadekoBot.Services.Database.Models
{
public class ConvertUnit : DbEntity
{
public ConvertUnit() { }
[NotMapped]
private string[] _triggersValue;
[NotMapped]
public string[] Triggers
{
get
{
return _triggersValue ?? (_triggersValue = InternalTrigger.Split('|'));
}
set
{
_triggersValue = value;
InternalTrigger = string.Join("|", _triggersValue);
}
}
//protected or private?
/// <summary>
/// DO NOT CALL THIS
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public string InternalTrigger { get; set; }
public string UnitType { get; set; }
public decimal Modifier { get; set; }
}
}

View File

@ -20,6 +20,7 @@ namespace NadekoBot.Services.Database
public DbSet<BotConfig> BotConfig { get; set; }
public DbSet<Repeater> Repeaters { get; set; }
public DbSet<Currency> Currency { get; set; }
public DbSet<ConvertUnit> ConversionUnits { get; set; }
public DbSet<TypingArticle> TypingArticles { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
@ -84,6 +85,7 @@ namespace NadekoBot.Services.Database
.HasIndex(c => c.UserId)
.IsUnique();
#endregion
}
protected abstract override void OnConfiguring(DbContextOptionsBuilder optionsBuilder);
}

View File

@ -0,0 +1,14 @@
using NadekoBot.Services.Database.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace NadekoBot.Services.Database.Repositories
{
public interface IUnitConverterRepository : IRepository<ConvertUnit>
{
void AddOrUpdate(Func<ConvertUnit, bool> check, ConvertUnit toAdd, Func<ConvertUnit, ConvertUnit> toUpdate);
bool Empty();
}
}

View File

@ -0,0 +1,28 @@
using NadekoBot.Services.Database.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace NadekoBot.Services.Database.Repositories.Impl
{
public class UnitConverterRepository : Repository<ConvertUnit>, IUnitConverterRepository
{
public UnitConverterRepository(DbContext context) : base(context)
{
}
public void AddOrUpdate(Func<ConvertUnit, bool> check, ConvertUnit toAdd, Func<ConvertUnit, ConvertUnit> toUpdate)
{
var existing = _set.FirstOrDefault(check);
if (existing != null)
{
existing = toUpdate.Invoke(existing);
}
else _set.Add(toAdd);
}
public bool Empty() => !_set.Any();
}
}

View File

@ -38,6 +38,8 @@ namespace NadekoBot.Services.Database
private ICurrencyRepository _currency;
public ICurrencyRepository Currency => _currency ?? (_currency = new CurrencyRepository(_context));
private IUnitConverterRepository _conUnits;
public IUnitConverterRepository ConverterUnits => _conUnits ?? (_conUnits = new UnitConverterRepository(_context));
private ITypingArticlesRepository _typingArticles;
public ITypingArticlesRepository TypingArticles => _typingArticles ?? (_typingArticles = new TypingArticlesRepository(_context));

981
src/NadekoBot/units.json Normal file
View File

@ -0,0 +1,981 @@
[
{
"Triggers": [
"millimeter",
"millimeters",
"millimeter",
"mm"
],
"UnitType": "length",
"Modifier": 0.001
},
{
"Triggers": [
"centimeter",
"centimeters",
"centimeter",
"cm"
],
"UnitType": "length",
"Modifier": 0.01
},
{
"Triggers": [
"decimeter",
"decimeters",
"decimeter",
"dm"
],
"UnitType": "length",
"Modifier": 0.1
},
{
"Triggers": [
"meter",
"meters",
"meter",
"m"
],
"UnitType": "length",
"Modifier": 1.0
},
{
"Triggers": [
"kilometer",
"kilometers",
"kilometer",
"km"
],
"UnitType": "length",
"Modifier": 1000.0
},
{
"Triggers": [
"foot",
"feet",
"foot",
"ft"
],
"UnitType": "length",
"Modifier": 0.3048
},
{
"Triggers": [
"inch",
"inches",
"inch",
"in"
],
"UnitType": "length",
"Modifier": 0.0254
},
{
"Triggers": [
"mile",
"miles",
"mile",
"mi"
],
"UnitType": "length",
"Modifier": 1609.344
},
{
"Triggers": [
"yard",
"yards",
"yard",
"yd"
],
"UnitType": "length",
"Modifier": 0.9144
},
{
"Triggers": [
"cubic foot",
"cubic feet",
"cubic foot",
"ft3"
],
"UnitType": "volume",
"Modifier": 0.02831685
},
{
"Triggers": [
"cubic inch",
"cubic inches",
"cubic inch",
"in3"
],
"UnitType": "volume",
"Modifier": 0.00001638706
},
{
"Triggers": [
"cubic mile",
"cubic miles",
"cubic mile",
"mi3"
],
"UnitType": "volume",
"Modifier": 4168182000.0
},
{
"Triggers": [
"cubic yard",
"cubic yards",
"cubic yard",
"yd3"
],
"UnitType": "volume",
"Modifier": 0.7645549
},
{
"Triggers": [
"cup",
"cups",
"cup",
"cup"
],
"UnitType": "volume",
"Modifier": 0.0002365882
},
{
"Triggers": [
"imperial gallon",
"Imperial gallons",
"Imperial gallon",
"gal"
],
"UnitType": "volume",
"Modifier": 0.00454609
},
{
"Triggers": [
"us gallon",
"US gallons",
"US gallon",
"gal"
],
"UnitType": "volume",
"Modifier": 0.003785412
},
{
"Triggers": [
"milliliter",
"milliliters",
"milliliter",
"mL"
],
"UnitType": "volume",
"Modifier": 0.000001
},
{
"Triggers": [
"liter",
"liters",
"liter",
"L"
],
"UnitType": "volume",
"Modifier": 0.001
},
{
"Triggers": [
"imperial fluid ounce",
"Imperial fluid ounces",
"Imperial fluid ounce",
"fl oz"
],
"UnitType": "volume",
"Modifier": 0.00002841306
},
{
"Triggers": [
"us fluid ounce",
"US fluid ounces",
"US fluid ounce",
"fl oz"
],
"UnitType": "volume",
"Modifier": 0.00002957353
},
{
"Triggers": [
"imperial pint",
"Imperial pints",
"Imperial pint",
"pt"
],
"UnitType": "volume",
"Modifier": 0.00056826125
},
{
"Triggers": [
"us liquid pint",
"US pints (liquid)",
"US pint (liquid)",
"pt"
],
"UnitType": "volume",
"Modifier": 0.0004731765
},
{
"Triggers": [
"us dry pint",
"US pints (dry)",
"US pint (dry)",
"pt"
],
"UnitType": "volume",
"Modifier": 0.0005506105
},
{
"Triggers": [
"imperial quart",
"Imperial quarts",
"Imperial quart",
"qt"
],
"UnitType": "volume",
"Modifier": 0.00113652297
},
{
"Triggers": [
"us liquid quart",
"US quarts (liquid)",
"US quart (liquid)",
"qt"
],
"UnitType": "volume",
"Modifier": 0.0009463529
},
{
"Triggers": [
"us dry quart",
"US quarts (dry)",
"US quart (dry)",
"qt"
],
"UnitType": "volume",
"Modifier": 0.001101221
},
{
"Triggers": [
"tablespoon",
"tablespoons",
"tablespoon",
"tbsp"
],
"UnitType": "volume",
"Modifier": 0.00001478676
},
{
"Triggers": [
"teaspoon",
"teaspoons",
"teaspoon",
"tspn"
],
"UnitType": "volume",
"Modifier": 0.000004928922
},
{
"Triggers": [
"milligram",
"milligrams",
"milligram",
"mg"
],
"UnitType": "weight",
"Modifier": 0.000001
},
{
"Triggers": [
"gram",
"grams",
"gram",
"g"
],
"UnitType": "weight",
"Modifier": 0.001
},
{
"Triggers": [
"kilogram",
"kilograms",
"kilogram",
"kg"
],
"UnitType": "weight",
"Modifier": 1.0
},
{
"Triggers": [
"carat",
"carats",
"carat",
"CD"
],
"UnitType": "weight",
"Modifier": 0.00020
},
{
"Triggers": [
"grain",
"grains",
"grain",
"gr"
],
"UnitType": "weight",
"Modifier": 0.00006479891
},
{
"Triggers": [
"ounce",
"ounces",
"ounce",
"oz"
],
"UnitType": "weight",
"Modifier": 0.02834952
},
{
"Triggers": [
"pennyweight",
"pennyweights",
"pennyweight",
"dwt"
],
"UnitType": "weight",
"Modifier": 0.001555174
},
{
"Triggers": [
"pound",
"pounds",
"pound",
"lb"
],
"UnitType": "weight",
"Modifier": 0.4535924
},
{
"Triggers": [
"stone",
"stones",
"stone",
"st"
],
"UnitType": "weight",
"Modifier": 6.35029318
},
{
"Triggers": [
"slug",
"slugs",
"slug",
"slug"
],
"UnitType": "weight",
"Modifier": 14.59390
},
{
"Triggers": [
"metric ton",
"metric tons",
"metric ton",
"t"
],
"UnitType": "weight",
"Modifier": 1000.0
},
{
"Triggers": [
"long ton",
"long tons",
"long ton",
"t"
],
"UnitType": "weight",
"Modifier": 1016.047
},
{
"Triggers": [
"short ton",
"short tons",
"short ton",
"t"
],
"UnitType": "weight",
"Modifier": 907.1847
},
{
"Triggers": [
"acre",
"acres",
"acre",
"acre"
],
"UnitType": "area",
"Modifier": 4046.873
},
{
"Triggers": [
"are",
"ares",
"are",
"a"
],
"UnitType": "area",
"Modifier": 100.0
},
{
"Triggers": [
"hectare",
"hectares",
"hectare",
"ha"
],
"UnitType": "area",
"Modifier": 10000.0
},
{
"Triggers": [
"square foot",
"square feet",
"square foot",
"ft2"
],
"UnitType": "area",
"Modifier": 0.09290304
},
{
"Triggers": [
"square meter",
"square meters",
"square meter",
"m2"
],
"UnitType": "area",
"Modifier": 1.0
},
{
"Triggers": [
"square kilometer",
"square kilometers",
"square kilometer",
"km2"
],
"UnitType": "area",
"Modifier": 1000000.0
},
{
"Triggers": [
"square inch",
"square inches",
"square inch",
"in2"
],
"UnitType": "area",
"Modifier": 0.00064516
},
{
"Triggers": [
"square yard",
"square yards",
"square yard",
"yd2"
],
"UnitType": "area",
"Modifier": 0.8361274
},
{
"Triggers": [
"square mile",
"square miles",
"square mile",
"mi2"
],
"UnitType": "area",
"Modifier": 2589988.0
},
{
"Triggers": [
"aankadam",
"aankadam",
"aankadam",
"aankadam"
],
"UnitType": "area",
"Modifier": 6.69
},
{
"Triggers": [
"perch",
"perches",
"perch",
"perch"
],
"UnitType": "area",
"Modifier": 25.29
},
{
"Triggers": [
"cent",
"cents",
"cent",
"cent"
],
"UnitType": "area",
"Modifier": 40.47
},
{
"Triggers": [
"chatak",
"chataks",
"chatak",
"chatak"
],
"UnitType": "area",
"Modifier": 41.81
},
{
"Triggers": [
"kottah",
"kottah (B)",
"kottah (B)",
"kottah (B)"
],
"UnitType": "area",
"Modifier": 66.89
},
{
"Triggers": [
"guntha",
"guntha",
"guntha",
"guntha"
],
"UnitType": "area",
"Modifier": 101.17
},
{
"Triggers": [
"ground",
"grounds",
"ground",
"ground"
],
"UnitType": "area",
"Modifier": 222.97
},
{
"Triggers": [
"marla",
"marla",
"marla",
"marla"
],
"UnitType": "area",
"Modifier": 501.68
},
{
"Triggers": [
"rood",
"roods",
"rood",
"rood"
],
"UnitType": "area",
"Modifier": 1011.71
},
{
"Triggers": [
"bigha I",
"bigha I",
"bigha I",
"bigha I"
],
"UnitType": "area",
"Modifier": 1618.74
},
{
"Triggers": [
"bigha II",
"bigha II",
"bigha II",
"bigha II"
],
"UnitType": "area",
"Modifier": 2529.29
},
{
"Triggers": [
"kanal",
"kanal",
"kanal",
"kanal"
],
"UnitType": "area",
"Modifier": 10033.53
},
{
"Triggers": [
"biswa I",
"biswa I",
"biswa I",
"biswa I"
],
"UnitType": "area",
"Modifier": 32374.85
},
{
"Triggers": [
"biswa II",
"biswa II",
"biswa II",
"biswa II"
],
"UnitType": "area",
"Modifier": 50585.71
},
{
"Triggers": [
"pascal",
"pascal",
"pascal",
"Pa"
],
"UnitType": "pressure",
"Modifier": 1.0
},
{
"Triggers": [
"torr",
"torr",
"torr",
"Torr"
],
"UnitType": "pressure",
"Modifier": 133.3224
},
{
"Triggers": [
"bar",
"bars",
"bar",
"bar"
],
"UnitType": "pressure",
"Modifier": 100000.0
},
{
"Triggers": [
"millibar",
"millibars",
"millibar",
"mb"
],
"UnitType": "pressure",
"Modifier": 100.0
},
{
"Triggers": [
"psi",
"psi",
"psi",
"lbf/in2"
],
"UnitType": "pressure",
"Modifier": 6894.757
},
{
"Triggers": [
"day",
"days",
"day",
"d"
],
"UnitType": "time",
"Modifier": 86400.0
},
{
"Triggers": [
"hour",
"hours",
"hour",
"h"
],
"UnitType": "time",
"Modifier": 3600.0
},
{
"Triggers": [
"minute",
"minutes",
"minute",
"min"
],
"UnitType": "time",
"Modifier": 60.0
},
{
"Triggers": [
"year",
"years",
"year",
"yr"
],
"UnitType": "time",
"Modifier": 31536000.0
},
{
"Triggers": [
"AUD"
],
"UnitType": "currency",
"Modifier": 1.4787
},
{
"Triggers": [
"BGN"
],
"UnitType": "currency",
"Modifier": 1.9558
},
{
"Triggers": [
"BRL"
],
"UnitType": "currency",
"Modifier": 3.5991
},
{
"Triggers": [
"CAD"
],
"UnitType": "currency",
"Modifier": 1.4562
},
{
"Triggers": [
"CHF"
],
"UnitType": "currency",
"Modifier": 1.0951
},
{
"Triggers": [
"CNY"
],
"UnitType": "currency",
"Modifier": 7.4565
},
{
"Triggers": [
"CZK"
],
"UnitType": "currency",
"Modifier": 27.025
},
{
"Triggers": [
"DKK"
],
"UnitType": "currency",
"Modifier": 7.4448
},
{
"Triggers": [
"GBP"
],
"UnitType": "currency",
"Modifier": 0.8517
},
{
"Triggers": [
"HKD"
],
"UnitType": "currency",
"Modifier": 8.6631
},
{
"Triggers": [
"HRK"
],
"UnitType": "currency",
"Modifier": 7.4846
},
{
"Triggers": [
"HUF"
],
"UnitType": "currency",
"Modifier": 308.97
},
{
"Triggers": [
"IDR"
],
"UnitType": "currency",
"Modifier": 14814.35
},
{
"Triggers": [
"ILS"
],
"UnitType": "currency",
"Modifier": 4.2241
},
{
"Triggers": [
"INR"
],
"UnitType": "currency",
"Modifier": 74.8703
},
{
"Triggers": [
"JPY"
],
"UnitType": "currency",
"Modifier": 114.27
},
{
"Triggers": [
"KRW"
],
"UnitType": "currency",
"Modifier": 1244.47
},
{
"Triggers": [
"MXN"
],
"UnitType": "currency",
"Modifier": 20.7542
},
{
"Triggers": [
"MYR"
],
"UnitType": "currency",
"Modifier": 4.5205
},
{
"Triggers": [
"NOK"
],
"UnitType": "currency",
"Modifier": 9.2873
},
{
"Triggers": [
"NZD"
],
"UnitType": "currency",
"Modifier": 1.5427
},
{
"Triggers": [
"PHP"
],
"UnitType": "currency",
"Modifier": 51.797
},
{
"Triggers": [
"PLN"
],
"UnitType": "currency",
"Modifier": 4.3436
},
{
"Triggers": [
"RON"
],
"UnitType": "currency",
"Modifier": 4.4505
},
{
"Triggers": [
"RUB"
],
"UnitType": "currency",
"Modifier": 72.4564
},
{
"Triggers": [
"SEK"
],
"UnitType": "currency",
"Modifier": 9.5008
},
{
"Triggers": [
"SGD"
],
"UnitType": "currency",
"Modifier": 1.5196
},
{
"Triggers": [
"THB"
],
"UnitType": "currency",
"Modifier": 38.608
},
{
"Triggers": [
"TRY"
],
"UnitType": "currency",
"Modifier": 3.2977
},
{
"Triggers": [
"USD"
],
"UnitType": "currency",
"Modifier": 1.1168
},
{
"Triggers": [
"ZAR"
],
"UnitType": "currency",
"Modifier": 16.0537
},
{
"Triggers": [
"K",
"kelvin"
],
"UnitType": "temperature",
"Modifier": 0.00
},
{
"Triggers": [
"F",
"fahrenheit"
],
"UnitType": "temperature",
"Modifier": 0.00
},
{
"Triggers": [
"C",
"Celcius",
"Centigrade"
],
"UnitType": "temperature",
"Modifier": 0.00
},
{
"Triggers": [
"EUR"
],
"UnitType": "currency",
"Modifier": 1.0
}
]