FranciscoAT / saltyboy

SaltyBet Betting Bot
https://salty-boy.com
MIT License
12 stars 5 forks source link

Implement fallback in the Event Waif4u bot is offline causing current match to be out of date #51

Open xzyxzy opened 1 year ago

xzyxzy commented 1 year ago

This link returns old match too https://salty-boy.com/current-match

FranciscoAT commented 1 year ago

Looks like the scraper ran into a different issue I haven't seen before. Leaving this issue open to investigate later. In the meantime kicked the server.

2023-04-24 01:59:56,547 - INFO - src.run:70 - Winner: Wild iori.
2023-04-24 02:00:02,573 - INFO - src.run:27 - New match. Chibiko VS. Go badaa ba. Tier: B. Format: tournament.
2023-04-24 02:00:52,586 - INFO - src.run:60 - Bets locked. Chibiko ($100443). Go badaa ba ($340583).
2023-04-24 02:02:16,908 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:07:00,385 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:11:05,308 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:15:38,419 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:19:46,625 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:24:14,053 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:29:13,938 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:33:42,182 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:38:04,785 - INFO - src.irc:82 - Received a PING, sending PONG.
2023-04-24 02:42:19,907 - INFO - src.irc:82 - Received a PING, sending PONG.
FranciscoAT commented 1 year ago

Actually, I popped open saltybet.com. It looks like the Waif4u bot in Twitch chat is dead? So the way I populate the GET /current-match on the server won't work until Waif4u is online.

I should probably code in a fail safe to just force the bot to query by name as a fall back. It won't be up to date data but should allow for a better uptime.

I'll leave this issue to implement this at some point. However, until then the Bot will unfortunately only bet $1 on Red until Waif4u is back online :/

xzyxzy commented 1 year ago

Sorry, my bad. I just woke up to check on saltybet, noticed $1 bets and instantly F12 to check in console.

Didn't even noticed what was happening in chat. Sorry, once again.

FranciscoAT commented 1 year ago

No need to apologize! Will definitely implement a fallback however in the future in case the current match is out of date :)

AaroPro commented 1 year ago

Currently Waifu4U is running, but the current match info is not updating and it is stuck betting $1 red now. Not sure of the timezone of the saltybet bet tracker but;

(Matchmaking) Salty's Dream Cast Casino 13280 | Xiayu cvs vs Lelouch lamperouge | 1 on Xiayu cvs | Xiayu cvs | 3 | May 02, 2023 3:32am -- | -- | -- | -- | -- | -- (Matchmaking) Salty's Dream Cast Casino 13280 | Wasp vs Robo-luigi | 5101 on Robo-luigi | Robo-luigi | 2760 | May 02, 2023 3:30am (Matchmaking) Salty's Dream Cast Casino 13280 [Xiayu cvs vs Lelouch lamperouge](https://www.saltybet.com/stats?match_id=1829825) 1 on Xiayu cvs Xiayu cvs 3 May 02, 2023 3:32am (Matchmaking) Salty's Dream Cast Casino 13280 [Wasp vs Robo-luigi](https://www.saltybet.com/stats?match_id=1829824) 5101 on Robo-luigi Robo-luigi 2760 May 02, 2023 3:30am Tha's where it started happening.
FranciscoAT commented 1 year ago

@AaroPro known issue. Bot sometimes hangs after a while. Gave it a kick.

FranciscoAT commented 1 year ago

Goals for this issue:

  1. Implement a fallback mechanism by which we query the GET /fighters endpoint directly in an attempt to get fighter data rather than relying on the more easy GET /current-match endpoint.
  2. Look into a more aggressive keepalive logic with the Bot.
FranciscoAT commented 4 months ago

Worth noting that with the release of 2.0 we'll need to construct a new endpoint to fetch detailed fighter data. Something like GET /api/current_match_info/?fighter_blue=<name>&fighter_red=<name>, which will override the default operation and instead grab information from the database tables match and fighter directly rather than initially querying from the current_match table to get the information necessary.

Also worth highlighting that the extension itself will have to have some smarts added to it in particular it'll need to determine the current format. This can likely be scraped from the #footer-alert element.

Although just kinda taking a look at things i'm not sure we can accurately determine tier with 100% confidence. ie. In the event that fighter has changed tier somehow. Therefore I think to enable this feature it should be a toggle that defaults to false. Then add a warning tooltip to indicating the potential risks where someone's tier betting feature might be not 100% accurate. But then just pull the current tier of the fighters as the tier of the match. Using the tier of the most recently updated fighter.