forked from EverythingSuckz/TG-FileStreamBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
132 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,4 @@ | ||
# This file is a part of TG-FileStreamBot | ||
# Coding : Jyothis Jayanth [@EverythingSuckz] | ||
|
||
from pyrogram import Client | ||
from ..vars import Var | ||
|
||
StreamBot = Client( | ||
session_name= 'Web Streamer', | ||
api_id=Var.API_ID, | ||
api_hash=Var.API_HASH, | ||
bot_token=Var.BOT_TOKEN, | ||
sleep_threshold=Var.SLEEP_THRESHOLD, | ||
workers=Var.WORKERS | ||
) | ||
from .clients import StreamBot, StreamQu, MultiQu1, MultiQu2, MultiQu3, MultiCli1, MultiCli2, MultiCli3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This file is a part of TG-FileStreamBot | ||
# Coding : Jyothis Jayanth [@EverythingSuckz] | ||
|
||
from pyrogram import Client | ||
from asyncio import Queue | ||
from ..vars import Var | ||
|
||
StreamBot = Client( | ||
session_name= 'WebStreamer', | ||
api_id=Var.API_ID, | ||
api_hash=Var.API_HASH, | ||
bot_token=Var.BOT_TOKEN, | ||
sleep_threshold=Var.SLEEP_THRESHOLD, | ||
workers=Var.WORKERS | ||
) | ||
StreamQu = Queue() | ||
for x in range(1): | ||
StreamQu.put_nowait(x) | ||
MultiQu1 = None | ||
MultiQu2 = None | ||
MultiQu3 = None | ||
MultiCli1 = None | ||
MultiCli2 = None | ||
MultiCli3 = None | ||
if Var.MULTI_CLIENT: | ||
if Var.MULTI_TOK1: | ||
MultiCli1 = Client( | ||
session_name= ':memory:', | ||
api_id=Var.API_ID, | ||
api_hash=Var.API_HASH, | ||
bot_token=Var.MULTI_TOK1, | ||
sleep_threshold=Var.SLEEP_THRESHOLD, | ||
no_updates=True | ||
) | ||
MultiQu1 = Queue() | ||
for x in range(1): | ||
MultiQu1.put_nowait(x) | ||
if MultiCli1 and Var.MULTI_TOK2: | ||
MultiCli2 = Client( | ||
session_name= ':memory:', | ||
api_id=Var.API_ID, | ||
api_hash=Var.API_HASH, | ||
bot_token=Var.MULTI_TOK2, | ||
sleep_threshold=Var.SLEEP_THRESHOLD, | ||
no_updates=True | ||
) | ||
MultiQu2 = Queue() | ||
for x in range(1): | ||
MultiQu2.put_nowait(x) | ||
if MultiCli2 and Var.MULTI_TOK3: | ||
MultiCli3 = Client( | ||
session_name= ':memory:', | ||
api_id=Var.API_ID, | ||
api_hash=Var.API_HASH, | ||
bot_token=Var.MULTI_TOK3, | ||
sleep_threshold=Var.SLEEP_THRESHOLD, | ||
no_updates=True | ||
) | ||
MultiQu3 = Queue() | ||
for x in range(1): | ||
MultiQu3.put_nowait(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
# This file is a part of TG-FileStreamBot | ||
# Coding : Jyothis Jayanth [@EverythingSuckz] | ||
|
||
from os import getenv, environ | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
from os import environ | ||
|
||
class Var(object): | ||
API_ID = int(getenv('API_ID')) | ||
API_HASH = str(getenv('API_HASH')) | ||
BOT_TOKEN = str(getenv('BOT_TOKEN')) | ||
SLEEP_THRESHOLD = int(getenv('SLEEP_THRESHOLD', '60')) | ||
WORKERS = int(getenv('WORKERS', '3')) | ||
BIN_CHANNEL = int(getenv('BIN_CHANNEL', None)) | ||
PORT = int(getenv('PORT', 8080)) | ||
BIND_ADDRESS = str(getenv('WEB_SERVER_BIND_ADDRESS', '0.0.0.0')) | ||
PING_INTERVAL = int(getenv('PING_INTERVAL', '1200')) # 20 minutes | ||
HAS_SSL = getenv('HAS_SSL', False) | ||
MULTI_CLIENT = bool(environ.get('MULTI_CLIENT', False)) | ||
MULTI_TOK1 = str(environ.get('MULTI_TOK1', None)) | ||
MULTI_TOK2 = str(environ.get('MULTI_TOK2', None)) | ||
MULTI_TOK3 = str(environ.get('MULTI_TOK3', None)) | ||
API_ID = int(environ.get('API_ID')) | ||
API_HASH = str(environ.get('API_HASH')) | ||
BOT_TOKEN = str(environ.get('BOT_TOKEN')) | ||
SLEEP_THRESHOLD = int(environ.get('SLEEP_THRESHOLD', '60')) # 1 minte | ||
WORKERS = int(environ.get('WORKERS', '')) # let pyrogram handle it | ||
BIN_CHANNEL = int(environ.get('BIN_CHANNEL', None)) | ||
PORT = int(environ.get('PORT', 8080)) | ||
BIND_ADDRESS = str(environ.get('WEB_SERVER_BIND_ADDRESS', '0.0.0.0')) | ||
PING_INTERVAL = int(environ.get('PING_INTERVAL', '1200')) # 20 minutes | ||
HAS_SSL = environ.get('HAS_SSL', False) | ||
HAS_SSL = True if str(HAS_SSL).lower() == 'true' else False | ||
NO_PORT = getenv('NO_PORT', False) | ||
NO_PORT = environ.get('NO_PORT', False) | ||
NO_PORT = True if str(NO_PORT).lower() == 'true' else False | ||
if 'DYNO' in environ: | ||
ON_HEROKU = True | ||
APP_NAME = str(getenv('APP_NAME')) | ||
APP_NAME = str(environ.get('APP_NAME')) | ||
else: | ||
ON_HEROKU = False | ||
FQDN = str(getenv('FQDN', BIND_ADDRESS)) if not ON_HEROKU or getenv('FQDN') else APP_NAME + '.herokuapp.com' | ||
FQDN = str(environ.get('FQDN', BIND_ADDRESS)) if not ON_HEROKU or environ.get('FQDN') else APP_NAME + '.herokuapp.com' | ||
if ON_HEROKU: | ||
URL = f"https://{FQDN}/" | ||
else: | ||
URL = "http{}://{}{}/".format('s' if HAS_SSL else '', FQDN, '' if NO_PORT else ':'+ str(PORT)) | ||
URL = "http{}://{}{}/".format('s' if HAS_SSL else '', FQDN, '' if NO_PORT else ':' + str(PORT)) |