Example #1
0
    def __init__(
        self,
        username: str,
        password: str = None,
        claim_drops_startup: bool = False,
        # Settings for logging and selenium as you can see.
        priority: list = [Priority.STREAK, Priority.DROPS, Priority.ORDER],
        # This settings will be global shared trought Settings class
        logger_settings: LoggerSettings = LoggerSettings(),
        # Default values for all streamers
        streamer_settings: StreamerSettings = StreamerSettings(),
    ):
        Settings.analytics_path = os.path.join(Path().absolute(), "analytics",
                                               username)
        Path(Settings.analytics_path).mkdir(parents=True, exist_ok=True)

        self.username = username

        # Set as global config
        Settings.logger = logger_settings

        # Init as default all the missing values
        streamer_settings.default()
        streamer_settings.bet.default()
        Settings.streamer_settings = streamer_settings

        user_agent = get_user_agent("FIREFOX")
        self.twitch = Twitch(self.username, user_agent, password)

        self.claim_drops_startup = claim_drops_startup
        self.priority = priority if isinstance(priority, list) else [priority]

        self.streamers = []
        self.events_predictions = {}
        self.minute_watcher_thread = None
        self.sync_campaigns_thread = None
        self.ws_pool = None

        self.session_id = str(uuid.uuid4())
        self.running = False
        self.start_datetime = None
        self.original_streamers = []

        self.logs_file, self.queue_listener = configure_loggers(
            self.username, logger_settings)

        # Check for the latest version of the script
        current_version, github_version = check_versions()
        if github_version == "0.0.0":
            logger.error(
                "Unable to detect if you have the latest version of this script"
            )
        elif current_version != github_version:
            logger.info(
                f"You are running the version {current_version} of this script"
            )
            logger.info(f"The latest version on GitHub is: {github_version}")

        for sign in [signal.SIGINT, signal.SIGSEGV, signal.SIGTERM]:
            signal.signal(sign, self.end)
Example #2
0
    def __init__(
        self,
        username: str,
        password: str = None,
        claim_drops_startup: bool = False,
        # Settings for logging and selenium as you can see.
        priority: list = [Priority.STREAK, Priority.DROPS, Priority.ORDER],
        # This settings will be global shared trought Settings class
        logger_settings: LoggerSettings = LoggerSettings(),
        # Default values for all streamers
        streamer_settings: StreamerSettings = StreamerSettings(),
    ):
        Settings.analytics_path = os.path.join(Path().absolute(), "analytics",
                                               username)
        Path(Settings.analytics_path).mkdir(parents=True, exist_ok=True)

        self.username = username

        # Set as global config
        Settings.logger = logger_settings

        # Init as default all the missing values
        streamer_settings.default()
        streamer_settings.bet.default()
        Settings.streamer_settings = streamer_settings

        user_agent = get_user_agent("FIREFOX")
        self.twitch = Twitch(self.username, user_agent, password)

        self.claim_drops_startup = claim_drops_startup
        self.priority = priority if isinstance(priority, list) else [priority]

        self.streamers = []
        self.events_predictions = {}
        self.minute_watcher_thread = None
        self.sync_campaigns_thread = None
        self.ws_pool = None

        self.session_id = str(uuid.uuid4())
        self.running = False
        self.start_datetime = None
        self.original_streamers = []

        self.logs_file = configure_loggers(self.username, logger_settings)

        for sign in [signal.SIGINT, signal.SIGSEGV, signal.SIGTERM]:
            signal.signal(sign, self.end)
    def __init__(
        self,
        username: str,
        claim_drops_startup: bool = False,
        # Settings for logging and selenium as you can see.
        # This settings will be global shared trought Settings class
        logger_settings: LoggerSettings = LoggerSettings(),
        browser_settings: BrowserSettings = BrowserSettings(),
        # Default values for all streamers
        streamer_settings: StreamerSettings = StreamerSettings(),
    ):
        self.username = username

        # Set as globally config
        Settings.logger = logger_settings
        Settings.browser = browser_settings

        # Init as default all the missing values
        streamer_settings.default()
        streamer_settings.bet.default()
        Settings.streamer_settings = streamer_settings

        user_agent = get_user_agent(browser_settings.browser)
        self.twitch = Twitch(self.username, user_agent)

        self.twitch_browser = None
        self.claim_drops_startup = claim_drops_startup
        self.streamers = []
        self.events_predictions = {}
        self.minute_watcher_thread = None
        self.ws_pool = None

        self.session_id = str(uuid.uuid4())
        self.running = False
        self.start_datetime = None
        self.original_streamers = []

        self.logs_file = configure_loggers(self.username, logger_settings)

        for sign in [signal.SIGINT, signal.SIGSEGV, signal.SIGTERM]:
            signal.signal(sign, self.end)
            MAGENTA  # Color allowed are: [BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET].
        )),
    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
        watch_streak=
        True,  # If a streamer go online change the priotiry of streamers array and catch the watch screak. Issue #11
        join_chat=True,  # Join irc chat to increase watch-time
        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=6,
            minimum_points=
            2000,  # Place the bet only if we have at least 20k points. Issue #113
            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.
                LTE,  # 'by' must be [GT, LT, GTE, LTE] than value
                value=800))))

# You can customize the settings for each streamer. If not settings were provided, the script would use the streamer_settings from TwitchChannelPointsMiner.
Example #5
0
            streamer_offline="red",  # Read more in README.md
            BET_wiN=Fore.
            MAGENTA  # Color allowed are: [BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET].
        )),
    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
        watch_streak=
        True,  # If a streamer go online change the priotiry of streamers array and catch the watch screak. Issue #11
        join_chat=True,  # Join irc chat to increase watch-time
        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 #33
            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.
                LTE,  # 'by' must be [GT, LT, GTE, LTE] than value
                value=800))))

# You can customize the settings for each streamer. If not settings were provided, the script would use the streamer_settings from TwitchChannelPointsMiner.
# If no streamer_settings are provided in TwitchChannelPointsMiner the script will use default settings.
# The streamers array can be a String -> username or Streamer instance.
        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
    ),
    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
        watch_streak=
        True,  # If a streamer go online change the priotiry of streamers array and catch the watch screak. Issue #11
        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
        )))

# You can customize the settings for each streamer. If not settings was provided the script will use the streamer_settings from TwitchChannelPointsMiner.
# If no streamer_settings provided in TwitchChannelPointsMiner the script will use default settings.
# The streamers array can be a String -> username or Streamer instance.

# The settings priority are: settings in mine function, settings in TwitchChannelPointsMiner instance, default settings.
# For example if in the mine function you don't provide any value for 'make_prediction' but you have set it on TwitchChannelPointsMiner instance the script will take the value from here.
# If you haven't set any value even in the instance the default one will be used