rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.17k stars 340 forks source link

Bets doesn't work properly - failed integrity check #209

Open MAXOUXAX opened 1 year ago

MAXOUXAX commented 1 year ago

Describe the bug

So I've been scratching my head around this bug for a few days now, but whenever the bot says it's going to place a bet, I see no bet placed once the prediction gets closed on Twitch. It simply doesn't work. I found out after setting the log level to DEBUG that the bet couldn't be placed due to an error (please see the logs below)

Steps to reproduce

Here's my config inside the run.py file:

streamer_settings=StreamerSettings(
 make_predictions=True,                  # If you want to Bet / Make prediction
 follow_raid=True,                       # Follow raid to obtain more points
 claim_drops=True,                       # We can't filter rewards base on stream. Set to False for skip viewing counter increase and you will never obtain a drop reward from this script. Issue #21
 claim_moments=True,                     # If set to True, https://help.twitch.tv/s/article/moments will be claimed when available
 watch_streak=True,                      # If a streamer go online change the priority of streamers array and catch the watch screak. Issue #11
 chat=ChatPresence.ONLINE,               # Join irc chat to increase watch-time [ALWAYS, NEVER, ONLINE, OFFLINE]
 bet=BetSettings(
   strategy=Strategy.SMART,              # Choose you strategy!
     percentage=5,                       # Place the x% of your channel points
     percentage_gap=20,                  # Gap difference between outcomesA and outcomesB (for SMART stragegy)
     max_points=50000,                   # If the x percentage of your channel points is gt bet_max_points set this value
     stealth_mode=True,                  # If the calculated amount of channel points is GT the highest bet, place the highest value minus 1-2 points Issue #33
     delay_mode=DelayMode.FROM_END,      # When placing a bet, we will wait until `delay` seconds before the end of the timer
       delay=10,                         # I've tried increasing that delay from the 6s that it defaults with, with no luck
       minimum_points=4000,
       filter_condition=FilterCondition(
         by=OutcomeKeys.TOTAL_USERS,     # Where apply the filter. Allowed [PERCENTAGE_USERS, ODDS_PERCENTAGE, ODDS, TOP_POINTS, TOTAL_USERS, TOTAL_POINTS]
         where=Condition.GTE,            # 'by' must be [GT, LT, GTE, LTE] than value
           value=20
         )
     )
)

Expected behavior

Bets should be placed without any issue

Operating system

Debian 12

Python version

3.9

Miner version

1.7.9

Other relevant software versions

No response

Logs

INFO - [make_predictions]: Going to complete bet for EventPrediction(event_id=?, streamer=Streamer(username=?, channel_id=?, channel_points=?), title=?)
INFO - [make_predictions]: Place ? channel points on: ? (BLUE), Points: 4M, Users: 497 (63.64%), Odds: 1.52 (65.79%)
DEBUG - TwitchChannelPointsMiner.classes.Twitch - [post_gql_request]: Data: {'operationName': 'MakePrediction', 'extensions': {'persistedQuery': {'version': 1, 'sha256Hash': '?'}}, 'variables': {'input': {'eventID': '?', 'outcomeID': '?', 'points': 11331, 'transactionID': '?'}}}, Status code: 200, Content: {"errors":[{"message":"failed integrity check"}],"extensions":{"challenge":{"type":"integrity"},"durationMilliseconds":2,"operationName":"MakePrediction","requestID":"?"}}

Additional context

No response

MAXOUXAX commented 1 year ago

Managed to fix the problem by deleting the cookies/ folder and logging back in again.

Let's keep this issue open since I think the error (failed integrity check) should be handled and logged by default (instead of having to set the log level to DEBUG which makes the logs barely readable). You could also include in that log message basic troubleshooting steps (such as trying to log back in).

I think those changes would make the UX much better :)