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)
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)
STREAK, # - We want first of all to catch all watch streak from all streamers Priority. DROPS, # - When we don't have anymore watch streak to catch, wait until all drops are collected over the streamers Priority. ORDER # - When we have all of the drops claimed and no watch-streak available, use the order priority (POINTS_ASCENDING, POINTS_DESCEDING) ], logger_settings=LoggerSettings( save=True, # If you want to save logs in a 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 printing emoji. Set to false if you have a problem less= False, # If you think that the logs are too verbose, set this to True colored=True, # If you want to print colored text color_palette= ColorPalette( # You can also create a custom palette color (for the common message). STREAMER_online= "GREEN", # Don't worry about lower/upper case. The script will parse all the values. 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=
import logging from TwitchChannelPointsMiner import TwitchChannelPointsMiner from TwitchChannelPointsMiner.logger import LoggerSettings from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings twitch_miner = TwitchChannelPointsMiner( username="******", claim_drops_startup= False, # If you want to auto claim all drops from Twitch inventory on the startup logger_settings=LoggerSettings( save=True, # If you want to save logs in a 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 printing emoji. Set to false if you have a problem less= False # If you think that the logs are too verbose, set this to True ), 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
logger_settings=LoggerSettings( save=True, # If you want to save logs in a 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 printing emoji. Set to false if you have a problem less= False, # If you think that the logs are too verbose, set this to True colored=True, # If you want to print colored text color_palette= ColorPalette( # You can also create a custom palette color (for the common message). STREAMER_online= "GREEN", # Don't worry about lower/upper case. The script will parse all the values. streamer_offline="red", # Read more in README.md BET_wiN=Fore. MAGENTA # Color allowed are: [BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET]. ), telegram= Telegram( # You can omit or leave None if you don't want to receive updates on Telegram chat_id=123456789, # Chat ID to send messages @GiveChatId token= "123456789:shfuihreuifheuifhiu34578347", # Telegram API token @BotFather events=[ Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE, "BET_LOSE" ], # Only these events will be sent to the chat disable_notification= True, # Revoke the notification (sound/vibration) ), discord=Discord( webhook_api= "https://discord.com/api/webhooks/0123456789/0a1B2c3D4e5F6g7H8i9J", # Discord Webhook URL events=[ Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE, Events.BET_LOSE ], # Only these events will be sent to the chat )),