readd currency bug
This commit is contained in:
parent
b4037f2c33
commit
141d7aecf4
@ -78,12 +78,16 @@ namespace NadekoBot.Modules.Searches
|
|||||||
UnitType = unitTypeString
|
UnitType = unitTypeString
|
||||||
};
|
};
|
||||||
uow.ConverterUnits.Add(baseType);
|
uow.ConverterUnits.Add(baseType);
|
||||||
uow.ConverterUnits.AddRange(currencyRates.ConversionRates.Select(u => new ConvertUnit()
|
Units.Add(baseType);
|
||||||
|
var range = currencyRates.ConversionRates.Select(u => new ConvertUnit()
|
||||||
{
|
{
|
||||||
InternalTrigger = u.Key,
|
InternalTrigger = u.Key,
|
||||||
Modifier = u.Value,
|
Modifier = u.Value,
|
||||||
UnitType = unitTypeString
|
UnitType = unitTypeString
|
||||||
}).ToArray());
|
}).ToArray();
|
||||||
|
uow.ConverterUnits.AddRange(range);
|
||||||
|
Units.AddRange(range);
|
||||||
|
|
||||||
uow.Complete();
|
uow.Complete();
|
||||||
}
|
}
|
||||||
_log.Info("Updated Currency");
|
_log.Info("Updated Currency");
|
||||||
@ -132,7 +136,7 @@ namespace NadekoBot.Modules.Searches
|
|||||||
var targetUnit = Units.Find(x => x.Triggers.Select(y => y.ToLowerInvariant()).Contains(target.ToLowerInvariant()));
|
var targetUnit = Units.Find(x => x.Triggers.Select(y => y.ToLowerInvariant()).Contains(target.ToLowerInvariant()));
|
||||||
if (originUnit == null || targetUnit == null)
|
if (originUnit == null || targetUnit == null)
|
||||||
{
|
{
|
||||||
await msg.Reply(string.Format("Cannot convert {0} to {1}: units not found", originUnit.Triggers.First(), targetUnit.Triggers.First()));
|
await msg.Reply(string.Format("Cannot convert {0} to {1}: units not found", origin, target));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (originUnit.UnitType != targetUnit.UnitType)
|
if (originUnit.UnitType != targetUnit.UnitType)
|
||||||
|
Loading…
Reference in New Issue
Block a user