rssnyder / discord-stock-ticker

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

Create new bot failed #133

Closed giga89 closed 2 years ago

giga89 commented 2 years ago

Hi, I follow "Self-Hosting - Binary" procedure but I have a problem to create a new bot. When I call my curl "curl -X POST -H "Content-type: application/json" -d @test.json localhost:8080/crypto" I have 404 page not found.

The service is on because when I stop it with "systemctl stop discord-stock-ticker.service" I have "Failed to connect to localhost port 8080: Connection refused" error.

What is my error? :) Thanks

rssnyder commented 2 years ago

localhost:8080/crypto is not correct, there is no crypto endpoint.

See the docs for the bot types: image

use /ticker

The service is on because when I stop it with "systemctl stop discord-stock-ticker.service" I have "Failed to connect to localhost port 8080: Connection refused" error.

well yeah, if you stop the service, its not running anymore, so you cant connect.

giga89 commented 2 years ago

You save me. Bad day today sorry..

But now I have another error (or maybe I'm doing another mistake :))

No error on this command -> curl -X POST -H "Content-type: application/json" -d @test.json localhost:8080/ticker

But ticker list is empy curl -X POST -H "Content-type: application/json" -d @test.json localhost:8080/ticker {}

Why? Thank u in advance

rssnyder commented 2 years ago

No error on this command -> curl -X POST -H "Content-type: application/json" -d @test.json localhost:8080/ticker

if this call is successful it will return a JSON of the bot. does it return anything? are you watching the logs for the service? the logs should tell you everything you need to know.

giga89 commented 2 years ago

Ok I'll try to check the log :) Where I can found it?

rssnyder commented 2 years ago

Ok I'll try to check the log :) Where I can found it?

journalctl -f -u discord-stock-ticker.service

giga89 commented 2 years ago

No journal files were found. :(

rssnyder commented 2 years ago

you never answered by first question:

if this call is successful it will return a JSON of the bot. does it return anything?

giga89 commented 2 years ago

It return anything :/

rssnyder commented 2 years ago

It return anything :/

ok then your JSON isnt correct. post it here and i will take a look.

giga89 commented 2 years ago

You are very kind.. thank u so much

This is my json { "name": "bitcoin", # string: name of the crypto from coingecko "crypto": true, # bool: always true for crypto "ticker": "1) BTC", # string/OPTIONAL: overwrites display name of bot "color": true, # bool/OPTIONAL: requires nickname "decorator": "@", # string/OPTIONAL: what to show instead of arrows "currency": "aud", # string/OPTIONAL: alternative curreny "currency_symbol": "AUD", # string/OPTIONAL: alternative curreny symbol "pair": "binancecoin", # string/OPTIONAL: pair the coin with another coin, replaces> "pair_flip": true, # bool/OPTIONAL: show <pair>/<coin> rather than <coin>/<pair> "activity": "Hello;Its;Me", # string/OPTIONAL: list of strings to show in activity secti> "decimals": 3, # int/OPTIONAL: set number of decimal places "nickname": true, # bool/OPTIONAL: display information in nickname vs activity "frequency": 10, # int/OPTIONAL: seconds between refresh "discord_bot_token": "" # string: dicord bot token }

{ "name": "bitcoin", # string: name of the crypto from coingecko "crypto": true, # bool: always true for crypto "ticker": "1) BTC", # string/OPTIONAL: overwrites display name of bot "color": true, # bool/OPTIONAL: requires nickname "decorator": "@", # string/OPTIONAL: what to show instead of arrows "currency": "aud", # string/OPTIONAL: alternative curreny "currency_symbol": "AUD", # string/OPTIONAL: alternative curreny symbol "pair": "binancecoin", # string/OPTIONAL: pair the coin with another coin, replaces> "pair_flip": true, # bool/OPTIONAL: show / rather than / "activity": "Hello;Its;Me", # string/OPTIONAL: list of strings to show in activity secti> "decimals": 3, # int/OPTIONAL: set number of decimal places "nickname": true, # bool/OPTIONAL: display information in nickname vs activity "frequency": 10, # int/OPTIONAL: seconds between refresh "discord_bot_token": "" # string: dicord bot token }

edit: bot token is just a try that I'll change with another bot, no secret to hide

rssnyder commented 2 years ago

JSON cannot have comments, you need to remove all the comments.

giga89 commented 2 years ago

HOLY SHIT. I have to remove comments.

rssnyder commented 2 years ago

You also just shared your bot token, please rotate it now.

giga89 commented 2 years ago

Thank you @rssnyder . you are an angel in a bad day. now it's work