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

Is it possibile to have the same endpoint pointing two different bots? #115

Closed robertocommit closed 2 years ago

robertocommit commented 2 years ago

First of all, many thanks for this beauty.

I would love to display BTC price on two different servers.

It seems at the moment is not possible, without creating a new instance on a new port.

Something like this would be amazin:

curl -X POST -H "Content-Type: application/json" --data '{
  "name": "bitcoin",
  "crypto": true,
  "set_nickname": true,
  "frequency": 10,
  "discord_bot_token": [TOKEN_1, TOKEN_2]
}' localhost:8080/ticker
rssnyder commented 2 years ago

You can add one bot to a few servers, 2-3, without issues.

When it comes to hosting multiple coin tickers on the same instance, that is coming soon. I will keep this issue open and reference it when I get it implemented.

FWIW the id here is what needs to be changed to allow multiples of the same crypto: https://github.com/rssnyder/discord-stock-ticker/blob/master/ticker_request.go#L187

I will have to think of some way to make the id's unique, while still keeping the name reliant/clean.

rssnyder commented 2 years ago

update: have a working version with this patch, PR incoming:

{
  "ETHEREUM": {
    "ticker": "",
    "name": "ethereum",
    "nickname": true,
    "frequency": 3,
    "color": false,
    "decorator": "⬊",
    "currency": "USD",
    "currency_symbol": "$",
    "decimals": 0,
    "activity": "",
    "pair": "",
    "pair_flip": false,
    "multiplier": 0,
    "client_id": "xxxx",
    "crypto": true
  },
  "ETHEREUM1": {
    "ticker": "",
    "name": "ethereum",
    "nickname": true,
    "frequency": 3,
    "color": false,
    "decorator": "⬊",
    "currency": "USD",
    "currency_symbol": "$",
    "decimals": 0,
    "activity": "",
    "pair": "",
    "pair_flip": false,
    "multiplier": 0,
    "client_id": "xxxxxx",
    "crypto": true
  },
  "ETHEREUM2": {
    "ticker": "",
    "name": "ethereum",
    "nickname": true,
    "frequency": 3,
    "color": false,
    "decorator": "",
    "currency": "USD",
    "currency_symbol": "$",
    "decimals": 0,
    "activity": "",
    "pair": "",
    "pair_flip": false,
    "multiplier": 0,
    "client_id": "xxxxx",
    "crypto": true
  }
}
rssnyder commented 2 years ago

with https://github.com/rssnyder/discord-stock-ticker/pull/118 you can have multiple if they are different currencies. i will further extend this later to allow multiple of the same currency,