Tkd-Alex / 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.22k stars 678 forks source link

[Analytics] Duplecate log or i did something wrong ? #175

Closed aVitomin closed 3 years ago

aVitomin commented 3 years ago

img

# -*- coding: utf-8 -*-

import logging
from colorama import Fore
from TwitchChannelPointsMiner import TwitchChannelPointsMiner
twitch_miner = TwitchChannelPointsMiner("***")
twitch_miner.analytics(host="0.0.0.0", port=5000, refresh=5)
from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
from TwitchChannelPointsMiner.classes.Settings import Priority
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings 

twitch_miner = TwitchChannelPointsMiner(
    username="***",
    password="***",           # If no password will be provided, the script will ask interactively
    claim_drops_startup=True,                  # If you want to auto claim all drops from Twitch inventory on the startup
    priority=[                                  # Custom priority in this case for example:
        Priority.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=False,                              # 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=False,                             # 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="CYAN",            # 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.GREEN                # 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.

# 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

twitch_miner.mine(
    [
    ],                                 # Array of streamers (order = priority)
    followers=True                    # Automatic download the list of your followers (unable to set custom settings for you followers list)
)

Is than a bug or i did something wrong ?

Rakambda commented 3 years ago

Duplicate of #157

aVitomin commented 3 years ago

It only happens if i don't use twitch_miner.mine (followers = True) after twitch_miner.analytics (host =" 0.0.0.0 ", port = 5000, refresh = 5) But if i use twitch_miner.mine (followers = True) bets dont wotks (i dont 100% shure, but in my 2-hour test, the bot did not place any bets)

aVitomin commented 3 years ago
from TwitchChannelPointsMiner import TwitchChannelPointsMiner
twitch_miner = TwitchChannelPointsMiner("your-twitch-username")
twitch_miner.analytics(host="0.0.0.0", port=5000, refresh=5)   # Analytics web-server
twitch_miner.mine(followers=True)
from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
from TwitchChannelPointsMiner.classes.Settings import Priority
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings

twitch_miner = TwitchChannelPointsMiner(
    username="***",
    ...
)

If i use that, bot probably ignore default setting from twitch_miner = TwitchChannelPointsMiner(...) code and use default from TwitchChannelPointsMiner.py and etc

Rakambda commented 3 years ago

Well yeah, as you create 2 different instances on line 2 and near the end.

aVitomin commented 3 years ago

Well yeah, as you create 2 different instances on line 2 and near the end.

How i can fix that ?

from TwitchChannelPointsMiner import TwitchChannelPointsMiner
twitch_miner = TwitchChannelPointsMiner("your-twitch-username")
twitch_miner.analytics(host="0.0.0.0", port=5000, refresh=5)   # Analytics web-server
from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
from TwitchChannelPointsMiner.classes.Settings import Priority
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings

twitch_miner = TwitchChannelPointsMiner(
    username="***",
    ...

just do this and ignore duplicate logs ?

aVitomin commented 3 years ago

I change all default settings and wanna use it, but i dont understand how to enable web stats and dont ruin my setts

Rakambda commented 3 years ago

I don't know. Just try and figure out what's the problem. Can do a PR if you figure it.

I personally have no problems with it (on windows & linux)

import logging
from TwitchChannelPointsMiner import TwitchChannelPointsMiner
from TwitchChannelPointsMiner.classes.Settings import Priority
from TwitchChannelPointsMiner.logger import LoggerSettings
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings

twitch_miner = TwitchChannelPointsMiner(
    username="",
    password="",
    claim_drops_startup=True,
    logger_settings=LoggerSettings(
        save=True,
        console_level=logging.INFO,
        file_level=logging.DEBUG,
        emoji=True,
        less=True,
        colored=True
    ),
    streamer_settings=StreamerSettings(
        make_predictions=True,
        follow_raid=True,
        claim_drops=True,
        watch_streak=True,
        bet=BetSettings(
            strategy=Strategy.SMART,
            percentage=10,
            percentage_gap=20,
            max_points=10,
        )
    ),
    priority=[  # Custom priority in this case for example:
        Priority.STREAK
        Priority.DROPS,
        Priority.ORDER
    ],
)

twitch_miner.analytics(host="0.0.0.0", port=5000)

twitch_miner.mine(
    followers=True  # Automatic download the list of your followers
)
aVitomin commented 3 years ago

I don't know. Just try and figure out what's the problem. Can do a PR if you figure it.

Ohhhhh. got it.... I need use analytics after twitch_miner = TwitchChannelPointsMiner setts and before twitch_miner.mine After that i dont get duble logs img Big thanks !