mirror of
https://github.com/avipatilpro/FileStreamBot.git
synced 2026-01-15 14:22:53 -03:00
Minor Changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import time
|
||||
|
||||
__version__ = "1.0.1"
|
||||
__version__ = "1.1.0"
|
||||
StartTime = time.time()
|
||||
|
||||
|
||||
@@ -3,13 +3,12 @@ import asyncio
|
||||
import logging
|
||||
import traceback
|
||||
import logging.handlers as handlers
|
||||
from .config import Telegram, Server
|
||||
from FileStream.config import Telegram, Server
|
||||
from aiohttp import web
|
||||
from pyrogram import idle
|
||||
|
||||
from FileStream.bot import FileStream
|
||||
from FileStream.server import web_server
|
||||
from FileStream.utils import ping_server
|
||||
from FileStream.bot.clients import initialize_clients
|
||||
|
||||
logging.basicConfig(
|
||||
@@ -47,10 +46,6 @@ async def start_services():
|
||||
print("---------------------- Initializing Clients ----------------------")
|
||||
await initialize_clients()
|
||||
print("------------------------------ DONE ------------------------------")
|
||||
if Server.KEEP_ALIVE:
|
||||
print("------------------ Starting Keep Alive Service ------------------")
|
||||
print()
|
||||
asyncio.create_task(ping_server())
|
||||
print()
|
||||
print("--------------------- Initializing Web Server ---------------------")
|
||||
await server.setup()
|
||||
|
||||
@@ -20,6 +20,14 @@ async def start(bot: Client, message: Message):
|
||||
usr_cmd = message.text.split("_")[-1]
|
||||
|
||||
if usr_cmd == "/start":
|
||||
if Telegram.START_PIC:
|
||||
await message.reply_photo(
|
||||
photo=Telegram.START_PIC,
|
||||
caption=LANG.START_TEXT.format(message.from_user.mention, FileStream.username),
|
||||
parse_mode=ParseMode.HTML,
|
||||
reply_markup=BUTTON.START_BUTTONS
|
||||
)
|
||||
else:
|
||||
await message.reply_text(
|
||||
text=LANG.START_TEXT.format(message.from_user.mention, FileStream.username),
|
||||
parse_mode=ParseMode.HTML,
|
||||
@@ -70,17 +78,32 @@ async def start(bot: Client, message: Message):
|
||||
async def start(bot, message):
|
||||
if not await verify_user(bot, message):
|
||||
return
|
||||
if Telegram.START_PIC:
|
||||
await message.reply_photo(
|
||||
photo=Telegram.START_PIC,
|
||||
caption=LANG.ABOUT_TEXT.format(FileStream.fname, __version__),
|
||||
parse_mode=ParseMode.HTML,
|
||||
reply_markup=BUTTON.ABOUT_BUTTONS
|
||||
)
|
||||
else:
|
||||
await message.reply_text(
|
||||
text=LANG.ABOUT_TEXT.format(FileStream.fname, __version__),
|
||||
disable_web_page_preview=True,
|
||||
reply_markup=BUTTON.ABOUT_BUTTONS
|
||||
)
|
||||
|
||||
|
||||
@FileStream.on_message((filters.command('help')) & filters.private)
|
||||
async def help_handler(bot, message):
|
||||
if not await verify_user(bot, message):
|
||||
return
|
||||
if Telegram.START_PIC:
|
||||
await message.reply_photo(
|
||||
photo=Telegram.START_PIC,
|
||||
caption=LANG.HELP_TEXT.format(Telegram.OWNER_ID),
|
||||
parse_mode=ParseMode.HTML,
|
||||
reply_markup=BUTTON.HELP_BUTTONS
|
||||
)
|
||||
else:
|
||||
await message.reply_text(
|
||||
text=LANG.HELP_TEXT.format(Telegram.OWNER_ID),
|
||||
parse_mode=ParseMode.HTML,
|
||||
@@ -112,7 +135,7 @@ async def my_files(bot: Client, message: Message):
|
||||
[InlineKeyboardButton("ᴇᴍᴘᴛʏ", callback_data="N/A")],
|
||||
)
|
||||
file_list.append([InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")])
|
||||
await message.reply_photo(photo=Telegram.IMAGE_FILEID,
|
||||
await message.reply_photo(photo=Telegram.FILE_PIC,
|
||||
caption="Total files: {}".format(total_files),
|
||||
reply_markup=InlineKeyboardMarkup(file_list))
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ async def private_receive_handler(bot: Client, message: Message):
|
||||
except FloodWait as e:
|
||||
print(f"Sleeping for {str(e.value)}s")
|
||||
await asyncio.sleep(e.value)
|
||||
await bot.send_message(chat_id=Telegram.LOG_CHANNEL,
|
||||
text=f"Gᴏᴛ FʟᴏᴏᴅWᴀɪᴛ ᴏғ {str(e.value)}s from [{message.from_user.first_name}](tg://user?id={message.from_user.id})\n\n**𝚄𝚜𝚎𝚛 𝙸𝙳 :** `{str(message.from_user.id)}`",
|
||||
await bot.send_message(chat_id=Telegram.ULOG_CHANNEL,
|
||||
text=f"Gᴏᴛ FʟᴏᴏᴅWᴀɪᴛ ᴏғ {str(e.value)}s ғʀᴏᴍ [{message.from_user.first_name}](tg://user?id={message.from_user.id})\n\n**ᴜsᴇʀ ɪᴅ :** `{str(message.from_user.id)}`",
|
||||
disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
|
||||
|
||||
|
||||
@@ -86,10 +86,11 @@ async def channel_receive_handler(bot: Client, message: Message):
|
||||
except FloodWait as w:
|
||||
print(f"Sleeping for {str(w.x)}s")
|
||||
await asyncio.sleep(w.x)
|
||||
await bot.send_message(chat_id=Telegram.LOG_CHANNEL,
|
||||
text=f"ɢᴏᴛ ғʟᴏᴏᴅᴡᴀɪᴛ ᴏғ {str(w.x)}s FROM {message.chat.title}\n\n**CHANNEL ID:** `{str(message.chat.id)}`",
|
||||
await bot.send_message(chat_id=Telegram.ULOG_CHANNEL,
|
||||
text=f"ɢᴏᴛ ғʟᴏᴏᴅᴡᴀɪᴛ ᴏғ {str(w.x)}s ғʀᴏᴍ {message.chat.title}\n\n**ᴄʜᴀɴɴᴇʟ ɪᴅ :** `{str(message.chat.id)}`",
|
||||
disable_web_page_preview=True)
|
||||
except Exception as e:
|
||||
await bot.send_message(chat_id=Telegram.LOG_CHANNEL, text=f"**#EʀʀᴏʀTʀᴀᴄᴋᴇʙᴀᴄᴋ:** `{e}`",
|
||||
await bot.send_message(chat_id=Telegram.ULOG_CHANNEL, text=f"**#EʀʀᴏʀTʀᴀᴄᴋᴇʙᴀᴄᴋ:** `{e}`",
|
||||
disable_web_page_preview=True)
|
||||
print(f"Cᴀɴ'ᴛ Eᴅɪᴛ Bʀᴏᴀᴅᴄᴀsᴛ Mᴇssᴀɢᴇ!\nEʀʀᴏʀ: **Gɪᴠᴇ ᴍᴇ ᴇᴅɪᴛ ᴘᴇʀᴍɪssɪᴏɴ ɪɴ ᴜᴘᴅᴀᴛᴇs ᴀɴᴅ ʙɪɴ Cʜᴀɴɴᴇʟ!{e}**")
|
||||
|
||||
|
||||
@@ -15,11 +15,12 @@ class Telegram:
|
||||
FORCE_UPDATES_CHANNEL = env.get('FORCE_UPDATES_CHANNEL', False)
|
||||
FORCE_UPDATES_CHANNEL = True if str(FORCE_UPDATES_CHANNEL).lower() == "true" else False
|
||||
SLEEP_THRESHOLD = int(env.get("SLEEP_THRESHOLD", "60"))
|
||||
IMAGE_FILEID = env.get('IMAGE_FILEID', "https://telegra.ph/file/5bb9935be0229adf98b73.jpg")
|
||||
FILE_PIC = env.get('FILE_PIC', "https://graph.org/file/5bb9935be0229adf98b73.jpg")
|
||||
START_PIC = env.get('START_PIC', "https://graph.org/file/290af25276fa34fa8f0aa.jpg")
|
||||
VERIFY_PIC = env.get('VERIFY_PIC', "https://graph.org/file/736e21cc0efa4d8c2a0e4.jpg")
|
||||
MULTI_CLIENT = False
|
||||
LOG_CHANNEL = int(
|
||||
env.get("BIN_CHANNEL", None)
|
||||
) # you NEED to use a CHANNEL when you're using MULTI_CLIENT
|
||||
FLOG_CHANNEL = int(env.get("FLOG_CHANNEL", None)) # Logs channel for file logs
|
||||
ULOG_CHANNEL = int(env.get("ULOG_CHANNEL", None)) # Logs channel for user logs
|
||||
MODE = env.get("MODE", "primary")
|
||||
SECONDARY = True if MODE.lower() == "secondary" else False
|
||||
AUTH_USERS = list(set(int(x) for x in str(env.get("AUTH_USERS", "")).split()))
|
||||
@@ -27,13 +28,13 @@ class Telegram:
|
||||
class Server:
|
||||
PORT = int(env.get("PORT", 8080))
|
||||
BIND_ADDRESS = str(env.get("BIND_ADDRESS", "0.0.0.0"))
|
||||
PING_INTERVAL = int(env.get("PING_INTERVAL", "1200")) # 20 minutes
|
||||
PING_INTERVAL = int(env.get("PING_INTERVAL", "1200"))
|
||||
HAS_SSL = str(env.get("HAS_SSL", "0").lower()) in ("1", "true", "t", "yes", "y")
|
||||
NO_PORT = str(env.get("NO_PORT", "0").lower()) in ("1", "true", "t", "yes", "y")
|
||||
FQDN = str(env.get("FQDN", BIND_ADDRESS))
|
||||
URL = "http{}://{}{}/".format(
|
||||
"s" if HAS_SSL else "", FQDN, "" if NO_PORT else ":" + str(PORT)
|
||||
)
|
||||
KEEP_ALIVE = str(env.get("KEEP_ALIVE", "0").lower()) in ("1", "true", "t", "yes", "y")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,24 +5,22 @@
|
||||
<meta property="og:image" content="https://www.flaticon.com/premium-icon/icons/svg/2626/2626281.svg" itemprop="thumbnailUrl">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>%s</title>
|
||||
<title>{{file_name}}</title>
|
||||
<link rel="stylesheet" type='text/css' href="https://drive.google.com/uc?export=view&id=1pVLG4gZy7jdow3sO-wFS06aP_A9QX0O6">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Delius">
|
||||
<!-- <link rel="stylesheet" href="./style.css"> -->
|
||||
|
||||
</head>
|
||||
|
||||
<body class='cyber'>
|
||||
<header>
|
||||
<div class="toogle"></div>
|
||||
<div id="file-name" class="cyber">
|
||||
%s
|
||||
{{file_name}}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<a href=%s>
|
||||
<a href="{{file_url}}">
|
||||
<button class="cybr-btn">
|
||||
Download
|
||||
<span aria-hidden>_</span>
|
||||
@@ -31,16 +29,6 @@
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<span id="fork-text">Fork me on</span>
|
||||
<span>
|
||||
<a href="https://github.com/DeekshithSH/FileStreamBot" id='github-logo'>
|
||||
<svg id='octo' style="width: 1.2rem; padding-left: 5px; fill: var(--footer-icon-color)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
|
||||
</a>
|
||||
</span>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
const body = document.querySelector('body');
|
||||
const title = document.querySelector('#file-name');
|
||||
|
||||
171
FileStream/template/play.html
Normal file
171
FileStream/template/play.html
Normal file
@@ -0,0 +1,171 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>FileStreamBot | {{file_name}}</title>
|
||||
<link rel="icon" href="https://i.ibb.co/Hh4kF2b/icon.png" type="image/x-icon">
|
||||
<link rel="shortcut icon" href="https://i.ibb.co/Hh4kF2b/icon.png" type="image/x-icon">
|
||||
<link rel="stylesheet" href="https://unpkg.com/sheryjs/dist/Shery.css" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/proavipatil/data@main/fs/src/style.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/proavipatil/data@main/fs/src/plyr.css">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@500;700&display=swap" rel="stylesheet">
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav>
|
||||
<div class="nleft">
|
||||
<a href="#">
|
||||
<h3 id="heading" style="z-index: 100;" class="magnet title">FILE STREAM</h3>
|
||||
</a>
|
||||
</div>
|
||||
<div class="nryt">
|
||||
<a class="home-btn magnet" href="#main" onclick="toggleWidthnav(this)">HOME</a>
|
||||
|
||||
<a href="#abtus" class="about-btn magnet" onclick="toggleWidthnav(this)">ABOUT</a>
|
||||
</div>
|
||||
</nav>
|
||||
<center>
|
||||
<div class="about-nav">
|
||||
<a href="#abtus" class="wlcm magnet" onclick="toggleWidth(this)">WELCOME</a>
|
||||
<a href="#channels" class="abt-chnl magnet" onclick="toggleWidth(this)">CHANNELS</a>
|
||||
<a href="#contact" class="magnet contact-btn" onclick="toggleWidth(this)">CONTACT</a>
|
||||
</div>
|
||||
</center>
|
||||
|
||||
<div class="outer">
|
||||
<div class="inner">
|
||||
<div class="main" id="main">
|
||||
<video id="player" class="player" src="{{file_url}}" type="video/mp4" playsinline controls
|
||||
width="100%"></video>
|
||||
<div class="player"></div>
|
||||
<div class="file-name">
|
||||
<h4 style="display: inline;">File Name: </h4>
|
||||
<p style="display: inline;" id="myDiv">{{file_name}}</p><br>
|
||||
<h4 style="display: inline;">File Size: </h4>
|
||||
<p style="display: inline;">{{file_size}}</p>
|
||||
</div>
|
||||
<div class="downloadBtn">
|
||||
<button class="magnet" onclick="streamDownload()">
|
||||
<img style="height: 30px;" src="https://i.ibb.co/RjzYttX/dl.png" alt="">download video
|
||||
</button>
|
||||
<button class="magnet" onclick="copyStreamLink()">
|
||||
<img src="https://i.ibb.co/CM4Y586/link.png" alt="Copy Link">copy link
|
||||
</button>
|
||||
<button class="magnet" onclick="vlc_player()">
|
||||
<img src="https://i.ibb.co/px6fQs1/vlc.png" alt="">watch in VLC PLAYER
|
||||
</button>
|
||||
<button class="magnet" onclick="mx_player()">
|
||||
<img src="https://i.ibb.co/41WvtQ3/mx.png" alt="">watch in MX PLAYER
|
||||
</button>
|
||||
<button class="magnet" onclick="n_player()">
|
||||
<img src="https://i.ibb.co/Hd2dS4t/nPlayer.png" alt="">watch in nPlayer
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="abt">
|
||||
<div class="about">
|
||||
<div class="about-dets">
|
||||
|
||||
<div class="abt-sec" id="abtus" style="padding: 160px 30px;">
|
||||
<h1 style="text-align: center;">WELCOME TO OUR <Span>FILE STREAM</Span> BOT</h1>
|
||||
<p style="text-align: center; line-height: 2;word-spacing: 2px; letter-spacing: 0.8px;">
|
||||
This is a Telegram Bot to Stream <span>Movies</span> and <span>Series</span> directly on
|
||||
Telegram. You can also
|
||||
<span>download</span> them if you want. This bot is developed by <a
|
||||
href="https://github.com/AviPatilPro"><span style="font-weight: 700;">Avi</span></a>
|
||||
<br><br>If you like this bot, then don't
|
||||
forget to share it with your friends and family.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="abt-sec" id="channels">
|
||||
<h1>JOIN OUR <span>TELEGRAM</span> CHANNELS</h1>
|
||||
<div class="links chnl-link">
|
||||
<a class="magnet" href="https://t.me/CheapieDeals">
|
||||
<button>CHEAP DEALS</button>
|
||||
</a>
|
||||
<a class="magnet" href="https://t.me/FilmyPixel">
|
||||
<button>FILMYPIXEL</button>
|
||||
</a>
|
||||
<a class="magnet" href="https://t.me/PostersZone">
|
||||
<button>POSTERS ZONE</button>
|
||||
</a>
|
||||
<a class="magnet" href="https://t.me/EpitomeQuality">
|
||||
<button>EPITOME QUALITY</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="abt-sec" id="contact">
|
||||
<p style="text-align: center;">Report Bugs and Contact us on Telegram Below</p>
|
||||
<div class="links contact">
|
||||
<a href="https://t.me/AvishkarPatil">
|
||||
<button>CONTACT</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<center>
|
||||
|
||||
<div class="movie-cont">
|
||||
<div class="movieSug">
|
||||
<div class="movieDets">
|
||||
|
||||
</div>
|
||||
<div class="movieimg">
|
||||
<img src="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="low-width-movie-dets">
|
||||
<div class="movieStsBar">
|
||||
<div class="movieDets-mini">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="ranMovBtn" onclick="getDets()">Get More Movies Suggestion</button>
|
||||
</div>
|
||||
|
||||
</center>
|
||||
|
||||
<center>
|
||||
<div class="copyright">
|
||||
<h5 class="text-center">Copyright © 2024 <a href="https://github.com/AviPatilPro"><span
|
||||
style="font-weight: 700;">Avishkar Patil</span></a>. All
|
||||
Rights Reserved.</h5>
|
||||
</div>
|
||||
</center>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/0.155.0/three.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/automat/controlkit.js@master/bin/controlKit.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sheryjs/dist/Shery.js"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const uncopyableElement = document.querySelector(".uncopyable");
|
||||
|
||||
uncopyableElement.addEventListener("selectstart", function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="https://cdn.plyr.io/3.6.9/plyr.js"></script>
|
||||
<script src="https://proavipatil.github.io/data/fs/src/script.js"></script>
|
||||
|
||||
</html>
|
||||
@@ -1,154 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>streamHeading</title>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-Frame-Options" content="deny">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/3.7.8/plyr.css" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
||||
|
||||
<script src="https://cdn.plyr.io/3.7.8/plyr.polyfilled.js"></script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#stream-media {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#error-message {
|
||||
color: red;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.plyr__video-wrapper .plyr-download-button{
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
color: white;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.plyr__volume {
|
||||
max-width: initial;
|
||||
min-width: initial;
|
||||
width: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.plyr__video-wrapper .plyr-share-button{
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 10px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
color: white;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.plyr__video-wrapper .plyr-download-button:hover,
|
||||
.plyr__video-wrapper .plyr-share-button:hover{
|
||||
background-color: rgba(255, 255, 255, 0.7);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.plyr__video-wrapper .plyr-download-button:before {
|
||||
font-family: "Font Awesome 5 Free";
|
||||
content: "\f019";
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.plyr__video-wrapper .plyr-share-button:before {
|
||||
font-family: "Font Awesome 5 Free";
|
||||
content: "\f064";
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.plyr, .plyr__video-wrapper, .plyr__video-embed iframe {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<video id="stream-media" controls preload="auto">
|
||||
<source src="" type="">
|
||||
<p class="vjs-no-js">
|
||||
To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
|
||||
</p>
|
||||
</video>
|
||||
|
||||
<div id="error-message"></div>
|
||||
|
||||
<script>
|
||||
var player = new Plyr('#stream-media', {
|
||||
controls:['play-large', 'rewind', 'play', 'fast-forward', 'progress', 'current-time', 'mute', 'settings', 'pip', 'fullscreen'],
|
||||
settings:['speed','loop'],
|
||||
speed:{selected:1,options:[0.25,0.5,0.75,1,1.25,1.5,1.75,2]},
|
||||
seek: 10,
|
||||
keyboard: { focused: true, global: true },
|
||||
});
|
||||
|
||||
var mediaLink = "streamMediaLink";
|
||||
|
||||
if (mediaLink) {
|
||||
document.querySelector('#stream-media source').setAttribute('src', mediaLink);
|
||||
player.restart();
|
||||
|
||||
var downloadButton = document.createElement('div');
|
||||
downloadButton.className = 'plyr-download-button';
|
||||
|
||||
downloadButton.onclick = function() {
|
||||
event.stopPropagation();
|
||||
var link = document.createElement('a');
|
||||
link.href = mediaLink;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
|
||||
player.elements.container.querySelector('.plyr__video-wrapper').appendChild(downloadButton);
|
||||
|
||||
var shareButton = document.createElement('div');
|
||||
shareButton.className = 'plyr-share-button';
|
||||
|
||||
shareButton.onclick = function() {
|
||||
event.stopPropagation();
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: "Play",
|
||||
url: window.location.href
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
player.elements.container.querySelector('.plyr__video-wrapper').appendChild(shareButton);
|
||||
|
||||
} else {
|
||||
document.getElementById('error-message').textContent = 'Error: Media URL not provided';
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,3 @@
|
||||
from .keepalive import ping_server
|
||||
from .time_format import get_readable_time
|
||||
from .file_properties import get_name, get_file_ids
|
||||
from .custom_dl import ByteStreamer
|
||||
@@ -20,6 +20,18 @@ async def is_user_joined(bot, message: Message):
|
||||
)
|
||||
return False
|
||||
except UserNotParticipant:
|
||||
if Telegram.VERIFY_PIC:
|
||||
await message.reply_photo(
|
||||
photo=Telegram.VERIFY_PIC,
|
||||
caption="<i>Jᴏɪɴ ᴍʏ ᴜᴘᴅᴀᴛᴇ ᴄʜᴀɴɴᴇʟ ᴛᴏ ᴜsᴇ ᴍᴇ 🔐</i>",
|
||||
parse_mode=ParseMode.HTML,
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[
|
||||
InlineKeyboardButton("Jᴏɪɴ ɴᴏᴡ 🔓", url=f"https://t.me/{Telegram.UPDATES_CHANNEL}")
|
||||
]]
|
||||
)
|
||||
)
|
||||
else:
|
||||
await message.reply_text(
|
||||
text="<i>Jᴏɪɴ ᴍʏ ᴜᴘᴅᴀᴛᴇ ᴄʜᴀɴɴᴇʟ ᴛᴏ ᴜsᴇ ᴍᴇ 🔐</i>",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
@@ -134,7 +146,7 @@ async def is_user_authorized(message):
|
||||
|
||||
if not (user_id in Telegram.AUTH_USERS):
|
||||
await message.reply_text(
|
||||
text="You are not authorized to use this bot.",
|
||||
text="Yᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴜᴛʜᴏʀɪᴢᴇᴅ ᴛᴏ ᴜsᴇ ᴛʜɪs ʙᴏᴛ.",
|
||||
parse_mode=ParseMode.MARKDOWN,
|
||||
disable_web_page_preview=True
|
||||
)
|
||||
@@ -148,7 +160,7 @@ async def is_user_exist(bot, message):
|
||||
if not bool(await db.get_user(message.from_user.id)):
|
||||
await db.add_user(message.from_user.id)
|
||||
await bot.send_message(
|
||||
Telegram.LOG_CHANNEL,
|
||||
Telegram.ULOG_CHANNEL,
|
||||
f"**#NᴇᴡUsᴇʀ**\n**⬩ ᴜsᴇʀ ɴᴀᴍᴇ :** [{message.from_user.first_name}](tg://user?id={message.from_user.id})\n**⬩ ᴜsᴇʀ ɪᴅ :** `{message.from_user.id}`"
|
||||
)
|
||||
|
||||
@@ -157,7 +169,7 @@ async def is_channel_exist(bot, message):
|
||||
await db.add_user(message.chat.id)
|
||||
members = await bot.get_chat_members_count(message.chat.id)
|
||||
await bot.send_message(
|
||||
Telegram.LOG_CHANNEL,
|
||||
Telegram.ULOG_CHANNEL,
|
||||
f"**#NᴇᴡCʜᴀɴɴᴇʟ** \n**⬩ ᴄʜᴀᴛ ɴᴀᴍᴇ :** `{message.chat.title}`\n**⬩ ᴄʜᴀᴛ ɪᴅ :** `{message.chat.id}`\n**⬩ ᴛᴏᴛᴀʟ ᴍᴇᴍʙᴇʀs :** `{members}`"
|
||||
)
|
||||
|
||||
|
||||
@@ -18,9 +18,7 @@ class Database:
|
||||
return dict(
|
||||
id=id,
|
||||
join_date=time.time(),
|
||||
agreed_to_tos=False,
|
||||
Links=0,
|
||||
Plan="Free"
|
||||
Links=0
|
||||
)
|
||||
|
||||
# ---------------------[ ADD USER ]---------------------#
|
||||
@@ -119,15 +117,15 @@ class Database:
|
||||
await self.file.update_one({"_id": ObjectId(_id)}, {"$set": {"file_ids": file_ids}})
|
||||
|
||||
# ---------------------[ PAID SYS ]---------------------#
|
||||
async def link_available(self, id):
|
||||
user = await self.col.find_one({"id": id})
|
||||
if user.get("Plan") == "Plus":
|
||||
return "Plus"
|
||||
elif user.get("Plan") == "Free":
|
||||
files = await self.file.count_documents({"user_id": id})
|
||||
if files < 11:
|
||||
return True
|
||||
return False
|
||||
# async def link_available(self, id):
|
||||
# user = await self.col.find_one({"id": id})
|
||||
# if user.get("Plan") == "Plus":
|
||||
# return "Plus"
|
||||
# elif user.get("Plan") == "Free":
|
||||
# files = await self.file.count_documents({"user_id": id})
|
||||
# if files < 11:
|
||||
# return True
|
||||
# return False
|
||||
|
||||
async def count_links(self, id, operation: str):
|
||||
if operation == "-":
|
||||
|
||||
@@ -30,7 +30,7 @@ async def get_file_ids(client: Client | bool, db_id: str, multi_clients, message
|
||||
if not str(client.id) in file_id_info:
|
||||
logging.debug("Storing file_id in DB")
|
||||
log_msg = await send_file(FileStream, db_id, file_info['file_id'], message)
|
||||
msg = await client.get_messages(Telegram.LOG_CHANNEL, log_msg.id)
|
||||
msg = await client.get_messages(Telegram.FLOG_CHANNEL, log_msg.id)
|
||||
media = get_media_from_message(msg)
|
||||
file_id_info[str(client.id)] = getattr(media, "file_id", "")
|
||||
await db.update_file_ids(db_id, file_id_info)
|
||||
@@ -118,7 +118,7 @@ def get_file_info(message):
|
||||
async def update_file_id(msg_id, multi_clients):
|
||||
file_ids = {}
|
||||
for client_id, client in multi_clients.items():
|
||||
log_msg = await client.get_messages(Telegram.LOG_CHANNEL, msg_id)
|
||||
log_msg = await client.get_messages(Telegram.FLOG_CHANNEL, msg_id)
|
||||
media = get_media_from_message(log_msg)
|
||||
file_ids[str(client.id)] = getattr(media, "file_id", "")
|
||||
|
||||
@@ -126,10 +126,8 @@ async def update_file_id(msg_id, multi_clients):
|
||||
|
||||
|
||||
async def send_file(client: Client, db_id, file_id: str, message):
|
||||
file_caption = message.caption
|
||||
if file_caption is None:
|
||||
file_caption = message.file_name
|
||||
log_msg = await client.send_cached_media(chat_id=Telegram.LOG_CHANNEL, file_id=file_id,
|
||||
file_caption = getattr(message, 'caption', None) or get_name(message)
|
||||
log_msg = await client.send_cached_media(chat_id=Telegram.FLOG_CHANNEL, file_id=file_id,
|
||||
caption=f'**{file_caption}**')
|
||||
|
||||
if message.chat.type == ChatType.PRIVATE:
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import aiohttp
|
||||
import traceback
|
||||
from FileStream.config import Server
|
||||
|
||||
async def ping_server():
|
||||
sleep_time = Server.PING_INTERVAL
|
||||
while True:
|
||||
await asyncio.sleep(sleep_time)
|
||||
try:
|
||||
async with aiohttp.ClientSession(
|
||||
timeout=aiohttp.ClientTimeout(total=10)
|
||||
) as session:
|
||||
async with session.get(Server.URL) as resp:
|
||||
logging.info("Pinged server with response: {}".format(resp.status))
|
||||
except TimeoutError:
|
||||
logging.warning("Couldn't connect to the site URL..!")
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
@@ -1,5 +1,5 @@
|
||||
import aiohttp
|
||||
import aiofiles
|
||||
import jinja2
|
||||
import urllib.parse
|
||||
from FileStream.config import Telegram, Server
|
||||
from FileStream.utils.database import Database
|
||||
@@ -9,17 +9,22 @@ db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
|
||||
async def render_page(db_id):
|
||||
file_data=await db.get_file(db_id)
|
||||
src = urllib.parse.urljoin(Server.URL, f'dl/{file_data["_id"]}')
|
||||
file_size = humanbytes(file_data['file_size'])
|
||||
file_name = file_data['file_name'].replace("_", " ")
|
||||
|
||||
if str((file_data['mime_type']).split('/')[0].strip()) == 'video':
|
||||
async with aiofiles.open('FileStream/template/stream.html') as r:
|
||||
heading = 'Watch {}'.format(file_data['file_name'])
|
||||
html_template = await r.read()
|
||||
html = html_template.replace('streamMediaLink', src).replace('streamHeading', heading)
|
||||
template_file = "FileStream/template/play.html"
|
||||
else:
|
||||
async with aiofiles.open('FileStream/template/dl.html') as r:
|
||||
template_file = "FileStream/template/dl.html"
|
||||
async with aiohttp.ClientSession() as s:
|
||||
async with s.get(src) as u:
|
||||
heading = 'Download {}'.format(file_data['file_name'])
|
||||
file_size = humanbytes(int(u.headers.get('Content-Length')))
|
||||
html = (await r.read()) % (heading, file_data['file_name'], src, file_size)
|
||||
return html
|
||||
|
||||
with open(template_file) as f:
|
||||
template = jinja2.Template(f.read())
|
||||
|
||||
return template.render(
|
||||
file_name=file_name,
|
||||
file_url=src,
|
||||
file_size=file_size
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ class LANG(object):
|
||||
ABOUT_TEXT = """
|
||||
<b>⚜ ᴍʏ ɴᴀᴍᴇ : {}</b>\n
|
||||
<b>✦ ᴠᴇʀsɪᴏɴ : {}</b>
|
||||
<b>✦ ᴜᴘᴅᴀᴛᴇᴅ ᴏɴ : 19-November-2023</b>
|
||||
<b>✦ ᴜᴘᴅᴀᴛᴇᴅ ᴏɴ : 06-January-2024</b>
|
||||
<b>✦ ᴅᴇᴠᴇʟᴏᴘᴇʀ : <a href='https://telegram.me/AvishkarPatil'>Avishkar Patil</a></b>\n
|
||||
"""
|
||||
|
||||
|
||||
27
README.md
27
README.md
@@ -41,7 +41,7 @@
|
||||
- Press the below button to Fast deploy on Heroku
|
||||
|
||||
|
||||
[](https://heroku.com/deploy?template=https://github.com/avipatilpro/FileStreamBot)
|
||||
[](https://heroku.com/deploy)
|
||||
- Go to <a href="#mandatory-vars">variables tab</a> for more info on setting up environmental variables. </details>
|
||||
|
||||
<details>
|
||||
@@ -109,7 +109,8 @@ An example of `.env` file:
|
||||
API_ID = 789456
|
||||
API_HASH = ysx275f9638x896g43sfzx65
|
||||
BOT_TOKEN = 12345678:your_bot_token
|
||||
BIN_CHANNEL = -100xxxxxxxx
|
||||
ULOG_CHANNEL = -100123456789
|
||||
FLOG_CHANNEL = -100123456789
|
||||
DATABASE_URL = mongodb://admin:pass@192.168.27.1
|
||||
FQDN = 192.168.27.1
|
||||
HAS_SSL = False
|
||||
@@ -130,7 +131,8 @@ PORT = 8080
|
||||
* `API_HASH`: API hash of your Telegram account, can be obtained from [My Telegram](https://my.telegram.org). `str`
|
||||
* `OWNER_ID`: Your Telegram User ID, Send `/id` to [@missrose_bot](https://telegram.dog/MissRose_bot) to get Your Telegram User ID `int`
|
||||
* `BOT_TOKEN`: Telegram API token of your bot, can be obtained from [@BotFather](https://t.me/BotFather). `str`
|
||||
* `LOG_CHANNEL`: ID of the channel where bot will forward all files received from users. `int`.
|
||||
* `FLOG_CHANNEL`: ID of the channel where bot will store all Files from users `int`.
|
||||
* `ULOG_CHANNEL`: ID of the channel where bot will send logs of New Users`int`.
|
||||
* `BOT_WORKERS`: Number of updates bot should process from Telegram at once, by default to 10 updates. `int`
|
||||
* `DATABASE_URL`: MongoDB URI for saving User Data and Files List created by user. `str`
|
||||
* `FQDN`: A Fully Qualified Domain Name if present without http/s. Defaults to `BIND_ADDRESS`. `str`
|
||||
@@ -146,13 +148,13 @@ PORT = 8080
|
||||
* `AUTH_USERS`: Put authorized user IDs to use bot, separated by <kbd>Space</kbd>. `int`
|
||||
* `SLEEP_THRESHOLD`: Set global flood wait threshold, auto-retry requests under 60s. `int`
|
||||
* `SESSION_NAME`: Name for the Database created on your MongoDB. Defaults to `FileStream`. `str`
|
||||
* `IMAGE_FILEID`: To set Image at `/files` command. Defaults to pre-set image. `str`
|
||||
* `FILE_PIC`: To set Image at `/files` command. Defaults to pre-set image. `str`
|
||||
* `START_PIC`: To set Image at `/start` command. Defaults to pre-set image. `str`
|
||||
* `VERIFY_PIC`: To set Image at Force Sub Verification. Defaults to pre-set image. `str`
|
||||
* `WORKERS`: Number of maximum concurrent workers for handling incoming updates. Defaults to `6`. `int`
|
||||
* `PORT`: The port that you want your webapp to be listened to. Defaults to `8080`. `int`
|
||||
* `BIND_ADDRESS`: Your server bind adress. Defauls to `0.0.0.0`. `int`
|
||||
* `MODE`: Should be set to `secondary` if you only want to use the server for serving files. `str`
|
||||
* `PING_INTERVAL`: Heroku ping interval (ms), defaults to 1200 (20 minutes). `int`
|
||||
* `KEEP_ALIVE`: Self-ping server every PING_INTERVAL sec to avoid sleeping defaults to `False`.
|
||||
* `NO_PORT`: (True/False) Set PORT to 80 or 443 hide port display; ignore if on Heroku. Defaults to `False`.
|
||||
* `HAS_SSL`: (can be either `True` or `False`) If you want the generated links in https format. Defaults to `False`.
|
||||
|
||||
@@ -166,15 +168,15 @@ PORT = 8080
|
||||
#### ☠️ Bot Commands :
|
||||
|
||||
```sh
|
||||
/start : To check if the bot is alive or not.
|
||||
/start : To check the bot is alive or not.
|
||||
/help : To Get Help Message.
|
||||
/about : To check About the Bot.
|
||||
/files : To Get All Files List of User.
|
||||
/del : To Delete Files from DB with FileID.
|
||||
/ban : To Ban Any Channel or User to use bot.
|
||||
/unban : To Unban Any Channel or User to use bot.
|
||||
/status : To Get Bot Status and Total Users.
|
||||
/broadcast : To Broadcast any message to all users of bot.
|
||||
/del : To Delete Files from DB with FileID. [ADMIN]
|
||||
/ban : To Ban Any Channel or User to use bot. [ADMIN]
|
||||
/unban : To Unban Any Channel or User to use bot. [ADMIN]
|
||||
/status : To Get Bot Status and Total Users. [ADMIN]
|
||||
/broadcast : To Broadcast any message to all users of bot. [ADMIN]
|
||||
```
|
||||
|
||||
#### 🍟 Channel Support :
|
||||
@@ -188,6 +190,7 @@ PORT = 8080
|
||||
- [**Me**](https://github.com/AvishkarPatil) : Owner of This FileStreamBot
|
||||
- [**Deekshith SH**](https://github.com/DeekshithSH) : for some modules.
|
||||
- [**EverythingSuckz**](https://github.com/EverythingSuckz) : for his [FileStreamBot](https://github.com/EverythingSuckz/FileStreamBot)
|
||||
- [**Biisal**](https://github.com/biisal) : for Stream Page UI
|
||||
|
||||
---
|
||||
<h4 align='center'>© 2024 Aνιѕнкαя Pαтιℓ</h4>
|
||||
|
||||
2
app.json
2
app.json
@@ -33,7 +33,7 @@
|
||||
"description": "MongoDB URI for saving User Data and Files List created by user."
|
||||
},
|
||||
"AUTH_USERS": {
|
||||
"description": "Put IDs of Banned Channels where bot will not work. You can add multiple IDs & separate with Space.",
|
||||
"description": "Put IDs of Auth Usrs where bot will work. You can add multiple IDs & separate with Space.",
|
||||
"required": false
|
||||
},
|
||||
"UPDATES_CHANNEL": {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
aiohttp
|
||||
pyrogram
|
||||
pyrofork
|
||||
python-dotenv
|
||||
tgcrypto
|
||||
motor
|
||||
aiofiles
|
||||
dnspython
|
||||
requests
|
||||
jinja2
|
||||
|
||||
Reference in New Issue
Block a user