Merge branch 'master' into improvement-drops

This commit is contained in:
Alessandro Maggio
2021-02-13 12:05:55 +01:00
12 changed files with 119 additions and 1 deletions

View File

@@ -38,6 +38,21 @@ logger = logging.getLogger(__name__)
class TwitchChannelPointsMiner:
__slots__ = [
"username",
"twitch",
"claim_drops_startup",
"streamers",
"events_predictions",
"minute_watcher_thread",
"ws_pool",
"session_id",
"running",
"start_datetime",
"original_streamers",
"logs_file",
]
def __init__(
self,
username: str,

View File

@@ -9,4 +9,4 @@ class Priority(Enum):
# Empty object shared between class
class Settings(object):
pass
__slots__ = ["logger", "streamer_settings"]

View File

@@ -30,6 +30,8 @@ logger = logging.getLogger(__name__)
class Twitch(object):
__slots__ = ["cookies_file", "user_agent", "twitch_login", "running"]
def __init__(self, username, user_agent):
cookies_path = os.path.join(Path().absolute(), "cookies")
Path(cookies_path).mkdir(parents=True, exist_ok=True)

View File

@@ -16,6 +16,18 @@ logger = logging.getLogger(__name__)
class TwitchLogin(object):
__self__ = [
"client_id",
"token",
"login_check_result",
"session",
"session",
"username",
"user_id",
"email",
"cookies",
]
def __init__(self, client_id, username, user_agent):
self.client_id = client_id
self.token = None

View File

@@ -23,6 +23,8 @@ logger = logging.getLogger(__name__)
class WebSocketsPool:
__slots__ = ["ws", "twitch", "streamers", "events_predictions"]
def __init__(self, twitch, streamers, events_predictions):
self.ws = []
self.twitch = twitch

View File

@@ -42,6 +42,12 @@ class OutcomeKeys(object):
class FilterCondition(object):
__slots__ = [
"by",
"where",
"value",
]
def __init__(self, by=None, where=None, value=None, decision=None):
self.by = by
self.where = where
@@ -52,6 +58,15 @@ class FilterCondition(object):
class BetSettings(object):
__slots__ = [
"strategy",
"percentage",
"percentage_gap",
"max_points",
"stealth_mode",
"filter_condition",
]
def __init__(
self,
strategy: Strategy = None,
@@ -80,6 +95,8 @@ class BetSettings(object):
class Bet(object):
__slots__ = ["outcomes", "decision", "total_users", "total_points", "settings"]
def __init__(self, outcomes: list, settings: BetSettings):
self.outcomes = outcomes
self.__clear_outcomes()

View File

@@ -5,6 +5,20 @@ from TwitchChannelPointsMiner.utils import float_round
class EventPrediction(object):
__slots__ = [
"streamer",
"event_id",
"title",
"created_at",
"prediction_window_seconds",
"status",
"final_result",
"box_fillable",
"bet_confirmed",
"bet_placed",
"bet",
]
def __init__(
self,
streamer: Streamer,

View File

@@ -4,6 +4,17 @@ from TwitchChannelPointsMiner.utils import server_time
class Message(object):
__slots__ = [
"topic",
"topic_user",
"message",
"type",
"data",
"timestamp",
"channel_id",
"identifier",
]
def __init__(self, data):
self.topic, self.topic_user = data["topic"].split(".")

View File

@@ -1,4 +1,6 @@
class PubsubTopic(object):
__slots__ = ["topic", "user_id", "streamer"]
def __init__(self, topic, user_id=None, streamer=None):
self.topic = topic
self.user_id = user_id

View File

@@ -1,4 +1,6 @@
class Raid(object):
__slots__ = ["raid_id", "target_login"]
def __init__(self, raid_id, target_login):
self.raid_id = raid_id
self.target_login = target_login

View File

@@ -10,6 +10,21 @@ logger = logging.getLogger(__name__)
class Stream(object):
__slots__ = [
"broadcast_id",
"title",
"game",
"tags",
"drops_enabled",
"viewers_count",
"__last_update",
"spade_url",
"payload",
"watch_streak_missing",
"minute_watched",
"__minute_watched_timestamp",
]
def __init__(self):
self.broadcast_id = None

View File

@@ -11,6 +11,14 @@ logger = logging.getLogger(__name__)
class StreamerSettings(object):
__slots__ = [
"make_predictions",
"follow_raid",
"claim_drops",
"watch_streak",
"bet",
]
def __init__(
self,
make_predictions: bool = None,
@@ -37,6 +45,24 @@ class StreamerSettings(object):
class Streamer(object):
__slots__ = [
"username",
"channel_id",
"settings",
"is_online",
"stream_up",
"online_at",
"offline_at",
"channel_points",
"minute_watched_requests",
"viewer_is_mod",
"stream",
"raid",
"history",
"streamer_url",
"chat_url",
]
def __init__(self, username, settings=None):
self.username = username.lower().strip()
self.channel_id = 0