mirror of https://github.com/velour/catbase.git
Merge pull request #188 from velour/stock
fixed loss of decimal point in stock prices
This commit is contained in:
commit
887fbe8824
|
@ -69,10 +69,10 @@ func (p *StockPlugin) message(c bot.Connector, kind bot.Kind, message msg.Messag
|
||||||
|
|
||||||
response := "Failed to retrieve data for stock symbol: " + tokens[1]
|
response := "Failed to retrieve data for stock symbol: " + tokens[1]
|
||||||
|
|
||||||
cleaned := strings.ReplaceAll(string(body), " ", "")
|
|
||||||
regex := regexp.MustCompile("[0-9][0-9]\\. ")
|
regex := regexp.MustCompile("[0-9][0-9]\\. ")
|
||||||
|
|
||||||
cleaned = regex.ReplaceAllString(cleaned, "")
|
cleaned := regex.ReplaceAllString(string(body), "")
|
||||||
|
cleaned = strings.ReplaceAll(cleaned, " ", "")
|
||||||
|
|
||||||
var info GlobalQuote
|
var info GlobalQuote
|
||||||
err = json.Unmarshal([]byte(cleaned), &info)
|
err = json.Unmarshal([]byte(cleaned), &info)
|
||||||
|
|
Loading…
Reference in New Issue