jamiew / helium-discord-bot

Helium hotspot stats & leaderboards for your Discord server
13 stars 3 forks source link

Stats broken if hotspot has been added w/o owner #6

Closed Neilburt21 closed 3 years ago

Neilburt21 commented 3 years ago
helium-hotspots: GET https://api.helium.io/v1/hotspots/11fMRZhjyx9bvujDUz1qpg3Cx4jGN6JQAeUCtrJzLu81pdeCmtY
helium-hotspots: GET https://api.helium.io/v1/hotspots/11fMRZhjyx9bvujDUz1qpg3Cx4jGN6JQAeUCtrJzLu81pdeCmtY/rewards/sum?max_time=2021-06-23T00:24:09.296Z&min_time=2021-06-22T00:24:09.296Z
(node:2928) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'padEnd' of undefined
    at Object.fetchEverything (C:\Users\burtm\Desktop\DB\hotspots.js:139:87)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Client.<anonymous> (C:\Users\burtm\Desktop\DB\bot.js:34:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2928) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2928) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
jamiew commented 3 years ago

I think you caught us mid-documentation update. You need to use the hotspot add [address] commands interactively with the bot first

What do you get if you ask hotspot config? (feel free to censor actual addresses)

Neilburt21 commented 3 years ago

I actually just deleted .padEnd(10) from Line 139, 86 and it started working. BUT while I have your attention. a monthly stat would be cool if you added that too!

Neilburt21 commented 3 years ago

and for the record... it was adding address just fine. Just couldn't convert the data.

jamiew commented 3 years ago

got it, did you just use hotspot add {address} and not hotspot add {address} {owner_display_name}}? think that might be the bug

Neilburt21 commented 3 years ago

I did both but non worked. Here are the results after deleting that line 0.95 dancing-rainbow-swift @Test 0.12 low-concrete-baboon @undefined

jamiew commented 3 years ago

thx, think I know what the issue is, we'll take a look

jamiew commented 3 years ago

This is fixed now