Fix EVERYTHING after a good night's rest
This commit is contained in:
@@ -11,7 +11,7 @@ import uuid
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime
|
||||
|
||||
from TwitchChannelPointsMiner.utils import get_user_agent, Millify
|
||||
from TwitchChannelPointsMiner.utils import get_user_agent, _millify
|
||||
from TwitchChannelPointsMiner.classes.Bet import BetSettings
|
||||
from TwitchChannelPointsMiner.classes.Exceptions import StreamerDoesNotExistException
|
||||
from TwitchChannelPointsMiner.classes.Logger import LoggerSettings, configure_loggers
|
||||
@@ -258,7 +258,7 @@ class TwitchChannelPointsMiner:
|
||||
for streamer_index in range(0, len(self.streamers)):
|
||||
self.streamers[streamer_index].set_less_printing(False)
|
||||
logger.info(
|
||||
f"{self.streamers[streamer_index]}, Total Points Gained (after farming - before farming): {Millify(self.streamers[streamer_index].channel_points - self.original_streamers[streamer_index].channel_points)}",
|
||||
f"{self.streamers[streamer_index]}, Total Points Gained (after farming - before farming): {_millify(self.streamers[streamer_index].channel_points - self.original_streamers[streamer_index].channel_points)}",
|
||||
extra={"emoji": ":robot:"},
|
||||
)
|
||||
if self.streamers[streamer_index].history != {}:
|
||||
|
||||
@@ -3,7 +3,7 @@ import logging
|
||||
|
||||
from enum import Enum, auto
|
||||
|
||||
from TwitchChannelPointsMiner.utils import Millify, float_round
|
||||
from TwitchChannelPointsMiner.utils import _millify, float_round
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -73,11 +73,11 @@ class Bet:
|
||||
self.__clear_outcomes()
|
||||
|
||||
def __repr__(self):
|
||||
return f"Bet(TotalUsers={Millify(self.total_users)}, TotalPoints={Millify(self.total_points)}), Decision={self.decision})\n\t\tOutcome0({self.get_outcome(0)})\n\t\tOutcome1({self.get_outcome(1)})"
|
||||
return f"Bet(TotalUsers={_millify(self.total_users)}, TotalPoints={_millify(self.total_points)}), Decision={self.decision})\n\t\tOutcome0({self.get_outcome(0)})\n\t\tOutcome1({self.get_outcome(1)})"
|
||||
|
||||
def get_outcome(self, index):
|
||||
outcome = self.outcomes[index]
|
||||
return f"{outcome['title']} ({outcome['color']}), Points: {Millify(outcome['total_points'])}, Users: {Millify(outcome['total_users'])} ({outcome['percentage_users']}%), Odds: {outcome['odds']} ({outcome['odds_percentage']}%)"
|
||||
return f"{outcome['title']} ({outcome['color']}), Points: {_millify(outcome['total_points'])}, Users: {_millify(outcome['total_users'])} ({outcome['percentage_users']}%), Odds: {outcome['odds']} ({outcome['odds_percentage']}%)"
|
||||
|
||||
def __clear_outcomes(self):
|
||||
for index in range(0, len(self.outcomes)):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
import time
|
||||
|
||||
from TwitchChannelPointsMiner.utils import Millify
|
||||
from TwitchChannelPointsMiner.utils import _millify
|
||||
|
||||
from TwitchChannelPointsMiner.classes.Stream import Stream
|
||||
from TwitchChannelPointsMiner.constants.twitch import URL
|
||||
@@ -33,16 +33,16 @@ class Streamer:
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"{self.username} ({Millify(self.channel_points)} points)"
|
||||
f"{self.username} ({_millify(self.channel_points)} points)"
|
||||
if self.less_printing is True
|
||||
else f"Streamer(username={self.username}, channel_id={self.channel_id}, channel_points={Millify(self.channel_points)})"
|
||||
else f"Streamer(username={self.username}, channel_id={self.channel_id}, channel_points={_millify(self.channel_points)})"
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
f"{self.username} ({Millify(self.channel_points)} points)"
|
||||
f"{self.username} ({_millify(self.channel_points)} points)"
|
||||
if self.less_printing is True
|
||||
else f"Streamer(username={self.username}, channel_id={self.channel_id}, channel_points={Millify(self.channel_points)})"
|
||||
else f"Streamer(username={self.username}, channel_id={self.channel_id}, channel_points={_millify(self.channel_points)})"
|
||||
)
|
||||
|
||||
def set_offline(self):
|
||||
@@ -63,7 +63,7 @@ class Streamer:
|
||||
def print_history(self):
|
||||
return ", ".join(
|
||||
[
|
||||
f"{key}({self.history[key]['counter']} times, {Millify(self.history[key]['amount'])} gained)"
|
||||
f"{key}({self.history[key]['counter']} times, {_millify(self.history[key]['amount'])} gained)"
|
||||
for key in self.history
|
||||
]
|
||||
)
|
||||
|
||||
@@ -17,7 +17,11 @@ from selenium.webdriver.support.ui import WebDriverWait
|
||||
from TwitchChannelPointsMiner.classes.EventPrediction import EventPrediction
|
||||
from TwitchChannelPointsMiner.constants.browser import Javascript, Selectors
|
||||
from TwitchChannelPointsMiner.constants.twitch import URL
|
||||
from TwitchChannelPointsMiner.utils import bet_condition, get_user_agent, Millify
|
||||
from TwitchChannelPointsMiner.utils import (
|
||||
bet_condition,
|
||||
get_user_agent,
|
||||
_millify
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -339,7 +343,7 @@ class TwitchBrowser:
|
||||
|
||||
try:
|
||||
logger.info(
|
||||
f"Going to write: {Millify(decision['amount'])} channel points on input {decision['choice']}",
|
||||
f"Going to write: {_millify(decision['amount'])} channel points on input {decision['choice']}",
|
||||
extra={"emoji": ":wrench:"},
|
||||
)
|
||||
if (
|
||||
|
||||
@@ -16,7 +16,7 @@ from TwitchChannelPointsMiner.utils import (
|
||||
bet_condition,
|
||||
calculate_start_after,
|
||||
get_streamer_index,
|
||||
Millify,
|
||||
_millify,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -268,7 +268,7 @@ class WebSocketsPool:
|
||||
if message.type == "prediction-result":
|
||||
event_result = message.data["prediction"]["result"]
|
||||
logger.info(
|
||||
f"{ws.events_predictions[event_id]} - Result: {event_result['type']}, Points won: {Millify(event_result['points_won']) if event_result['points_won'] else 0}",
|
||||
f"{ws.events_predictions[event_id]} - Result: {event_result['type']}, Points won: {_millify(event_result['points_won']) if event_result['points_won'] else 0}",
|
||||
extra={"emoji": ":bar_chart:"},
|
||||
)
|
||||
points_won = (
|
||||
|
||||
@@ -3,12 +3,12 @@ import re
|
||||
import time
|
||||
from datetime import datetime, timezone
|
||||
from random import randrange
|
||||
import millify
|
||||
from millify import millify
|
||||
|
||||
from TwitchChannelPointsMiner.constants.browser import USER_AGENTS
|
||||
|
||||
|
||||
def Millify(input, precision=2):
|
||||
def _millify(input, precision=2):
|
||||
return millify.millify(input, precision)
|
||||
|
||||
|
||||
|
||||
42
example.py
42
example.py
@@ -8,32 +8,32 @@ from TwitchChannelPointsMiner.classes.TwitchBrowser import Browser, BrowserSetti
|
||||
|
||||
twitch_miner = TwitchChannelPointsMiner(
|
||||
username="your-twitch-username",
|
||||
make_predictions=True, # If you want to Bet / Make prediction | The browser will never start
|
||||
follow_raid=True, # Follow raid to obtain more points
|
||||
watch_streak=True, # If a streamer go online change the priotiry of streamers array and catch the watch screak. Issue #11
|
||||
drops_events=True, # If you want to auto claim game drops from Twitch inventory Issue #21
|
||||
claim_drops_startup=False, # If you want to auto claim all drops from Twitch inventory on startup
|
||||
make_predictions=True, # If you want to Bet / Make prediction | The browser will never start
|
||||
follow_raid=True, # Follow raid to obtain more points
|
||||
watch_streak=True, # If a streamer go online change the priotiry of streamers array and catch the watch screak. Issue #11
|
||||
drops_events=True, # If you want to auto claim game drops from Twitch inventory Issue #21
|
||||
claim_drops_startup=False, # If you want to auto claim all drops from Twitch inventory on startup
|
||||
logger_settings=LoggerSettings(
|
||||
save=True, # If you want to save logs in file (suggested)
|
||||
console_level=logging.INFO, # Level of logs - use logging.DEBUG for more info)
|
||||
file_level=logging.DEBUG, # Level of logs - If you think the log file it's too big use logging.INFO
|
||||
emoji=True, # On Windows we have a problem to print emoji. Set to false if you have a problem
|
||||
less=False, # If you think that the logs are too much verborse set this to True
|
||||
save=True, # If you want to save logs in file (suggested)
|
||||
console_level=logging.INFO, # Level of logs - use logging.DEBUG for more info)
|
||||
file_level=logging.DEBUG, # Level of logs - If you think the log file it's too big use logging.INFO
|
||||
emoji=True, # On Windows we have a problem to print emoji. Set to false if you have a problem
|
||||
less=False # If you think that the logs are too much verborse set this to True
|
||||
),
|
||||
browser_settings=BrowserSettings(
|
||||
browser=Browser.FIREFOX, # Choose if you want to use Chrome or Firefox as browser
|
||||
show=False, # Show the browser during bet else headless mode
|
||||
do_screenshot=False, # Do screenshot during the bet
|
||||
browser=Browser.FIREFOX, # Choose if you want to use Chrome or Firefox as browser
|
||||
show=False, # Show the browser during bet else headless mode
|
||||
do_screenshot=False, # Do screenshot during the bet
|
||||
),
|
||||
bet_settings=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
|
||||
),
|
||||
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
|
||||
)
|
||||
)
|
||||
|
||||
twitch_miner.mine(
|
||||
["streamer1", "streamer2"], # Array of streamers (order = priority)
|
||||
followers=False, # Automatic download the list of your followers
|
||||
)
|
||||
["streamer1", "streamer2"], # Array of streamers (order = priority)
|
||||
followers=False # Automatic download the list of your followers
|
||||
)
|
||||
Reference in New Issue
Block a user