Create a Telegram class for handle chat_id, token and send mesage via Telegram API. Move Telegram object inside LoggerSettings - Create a Events enum class so we can handle color and Telegram message in this way

This commit is contained in:
Alessandro Maggio
2021-08-18 15:23:24 +02:00
parent 2b4575c0c3
commit f5ea160238
9 changed files with 180 additions and 111 deletions

View File

@@ -4,7 +4,8 @@ import logging
from colorama import Fore
from TwitchChannelPointsMiner import TwitchChannelPointsMiner
from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
from TwitchChannelPointsMiner.classes.Settings import Priority
from TwitchChannelPointsMiner.classes.Telegram import Telegram
from TwitchChannelPointsMiner.classes.Settings import Priority, Events
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings
@@ -28,6 +29,12 @@ twitch_miner = TwitchChannelPointsMiner(
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(
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)
)
),
streamer_settings=StreamerSettings(