rssnyder / discord-stock-ticker

Add live stock & crypto prices to your discord sidebar.
https://rssnyder.github.io/discord-stock-ticker/
MIT License
293 stars 113 forks source link

[BUG] Unable to add any ticker #111

Closed MButcho closed 2 years ago

MButcho commented 2 years ago

Hey, I installed latest version 3.7.2. When calling basic ticker function, I get an error: root@name1:~/discord-stock-ticker# ./discord-stock-ticker INFO[0000] Running discord-stock-ticker version v3.7.2... WARN[0000] Will not be storing state. INFO[0000] Starting api server on 0.0.0.0:8080... INFO[0002] Added crypto: ethereum panic: non-positive interval for NewTicker

goroutine 21 [running]: time.NewTicker(0x0, 0x64) /usr/local/go/src/time/tick.go:24 +0x151 main.(Ticker).watchCryptoPrice(0xc0001ae2d0) /home/riley/go/src/github.com/rssnyder/discord-stock-ticker/ticker.go:487 +0xb51 created by main.(Ticker).Start /home/riley/go/src/github.com/rssnyder/discord-stock-ticker/ticker.go:95 +0x3f

This is basic ticker function I called: curl -X POST -H "Content-Type: application/json" --data '{ "name": "ethereum", "crypto": true, "set_nickname": true, "discord_bot_token": "my bot token" }' localhost:8080/ticker

I disabled FW to make sure its not connection issue, same issue.

rssnyder commented 2 years ago

You need to add a frequency in your JSON payload.

MButcho commented 2 years ago

Perfect, working :).

The part: "frequency": 10, # int/OPTIONAL: default 60 confused me

rssnyder commented 2 years ago

fixing this bug in https://github.com/rssnyder/discord-stock-ticker/pull/112