forked from adam/discord-bot-shtik
how about don't clear out the aliases? now I can configure more aliases
All checks were successful
gitea/vassago/pipeline/head This commit looks good
All checks were successful
gitea/vassago/pipeline/head This commit looks good
This commit is contained in:
parent
894b536c04
commit
451ace753d
@ -57,18 +57,21 @@ namespace vassago.Conversion
|
|||||||
if(currencyConf != null)
|
if(currencyConf != null)
|
||||||
{
|
{
|
||||||
knownConversions.RemoveAll(kc => kc.Item1 == currencyConf.Base);
|
knownConversions.RemoveAll(kc => kc.Item1 == currencyConf.Base);
|
||||||
knownAliases.Remove(knownAliases.FirstOrDefault(kvp => kvp.Value == currencyConf.Base).Key);
|
|
||||||
foreach (var rate in currencyConf.rates)
|
|
||||||
knownAliases.Remove(knownAliases.FirstOrDefault(kvp => kvp.Value == rate.Key).Key);
|
|
||||||
}
|
}
|
||||||
if (File.Exists(currencyPath))
|
if (File.Exists(currencyPath))
|
||||||
{
|
{
|
||||||
currencyConf = JsonConvert.DeserializeObject<ExchangePairs>(File.ReadAllText(currencyPath));
|
currencyConf = JsonConvert.DeserializeObject<ExchangePairs>(File.ReadAllText(currencyPath));
|
||||||
|
|
||||||
knownAliases.Add(new List<string>() { currencyConf.Base.ToLower() }, currencyConf.Base);
|
if(!knownAliases.ContainsValue(currencyConf.Base))
|
||||||
|
{
|
||||||
|
knownAliases.Add(new List<string>() { currencyConf.Base.ToLower() }, currencyConf.Base);
|
||||||
|
}
|
||||||
foreach (var rate in currencyConf.rates)
|
foreach (var rate in currencyConf.rates)
|
||||||
{
|
{
|
||||||
knownAliases.Add(new List<string>() { rate.Key.ToLower() }, rate.Key);
|
if(!knownAliases.ContainsValue(rate.Key))
|
||||||
|
{
|
||||||
|
knownAliases.Add(new List<string>() { rate.Key.ToLower() }, rate.Key);
|
||||||
|
}
|
||||||
AddLinearPair(currencyConf.Base, rate.Key, rate.Value);
|
AddLinearPair(currencyConf.Base, rate.Key, rate.Value);
|
||||||
Console.WriteLine($"{rate.Key.ToLower()} alias of {rate.Key}");
|
Console.WriteLine($"{rate.Key.ToLower()} alias of {rate.Key}");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user