diff --git a/.github/workflows/YOURACTION.yml b/.github/workflows/YOURACTION.yml deleted file mode 100644 index 4f8df5f..0000000 --- a/.github/workflows/YOURACTION.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Heroku Awake - -on: - schedule: - - cron: "*/30 * * * *" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: mikeesto/heroku-awake@1.0.0 - with: - URL: "https://HEROKU_APP_NAME.herokuapp.com" - - # Put Your Heroke App Name As it is in above line - # Don't Change Any other Thing than App Name diff --git a/README.md b/README.md index 4773b28..50e3c33 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@
-
+
+
A Telegram bot to stream files to web.
@@ -37,14 +38,7 @@ Either you could locally host or deploy on [Heroku](https://heroku.com)
### Deploy on Heroku
1. Fork This Repo
-2. In .github/workflow/YOURACTION.yml
-3. edit this file and at last line in file replace the app name with your heroku app name
-
- 4.```URL: "https://HEROKU_APP_NAME.herokuapp.com"```
-
-5. change this name 😑😑😑
-
-6. If You nota Do this bot will not work
+2. Click on Deploy Easily
### So Follow Above Steps 👆 and then also deply other wise not work
diff --git a/WebStreamer/__init__.py b/WebStreamer/__init__.py
index 16aacb5..2c34819 100644
--- a/WebStreamer/__init__.py
+++ b/WebStreamer/__init__.py
@@ -1,3 +1,5 @@
-# This file is a part of TG-FileStreamBot
-# Coding : Jyothis Jayanth [@EverythingSuckz]
+
# Maintained By : Avishkar Patil [ @Avishkarpatil ] [ Telegram ]
+
+import time
+StartTime = time.time()
diff --git a/WebStreamer/__main__.py b/WebStreamer/__main__.py
index 1c793c7..88c7e1e 100644
--- a/WebStreamer/__main__.py
+++ b/WebStreamer/__main__.py
@@ -1,6 +1,3 @@
-# This file is a part of TG-FileStreamBot
-# Coding: @AvishkarPatil & @EverythingSuckz & @AbirHasan2005
-
import os
import sys
import glob
@@ -13,6 +10,15 @@ from .bot import StreamBot
from .vars import Var
from aiohttp import web
from .server import web_server
+from .utils.keepalive import ping_server
+from apscheduler.schedulers.background import BackgroundScheduler
+
+logging.basicConfig(
+ level=logging.INFO,
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
+)
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+logging.getLogger("apscheduler").setLevel(logging.WARNING)
ppath = "WebStreamer/bot/plugins/*.py"
files = glob.glob(ppath)
@@ -24,10 +30,9 @@ async def start_services():
print('\n')
print('------------------- Initalizing Telegram Bot -------------------')
await StreamBot.start()
+ print('----------------------------- DONE -----------------------------')
print('\n')
- print('---------------------- DONE ----------------------')
- print('\n')
- print('------------------- Importing -------------------')
+ print('--------------------------- Importing ---------------------------')
for name in files:
with open(name) as a:
patt = Path(a.name)
@@ -39,12 +44,18 @@ async def start_services():
spec.loader.exec_module(load)
sys.modules["WebStreamer.bot.plugins." + plugin_name] = load
print("Imported => " + plugin_name)
- print('\n')
- print('------------------- Initalizing Web Server -------------------')
+ if Var.ON_HEROKU:
+ print('------------------ Starting Keep Alive Service ------------------')
+ print('\n')
+ scheduler = BackgroundScheduler()
+ scheduler.add_job(ping_server, "interval", seconds=1200)
+ scheduler.start()
+ print('-------------------- Initalizing Web Server --------------------')
app = web.AppRunner(await web_server())
await app.setup()
bind_address = "0.0.0.0" if Var.ON_HEROKU else Var.FQDN
await web.TCPSite(app, bind_address, Var.PORT).start()
+ print('----------------------------- DONE -----------------------------')
print('\n')
print('----------------------- Service Started -----------------------')
print(' bot =>> {}'.format((await StreamBot.get_me()).first_name))
@@ -58,4 +69,4 @@ if __name__ == '__main__':
try:
loop.run_until_complete(start_services())
except KeyboardInterrupt:
- print('----------------------- Service Stopped -----------------------')
+ logging.info('----------------------- Service Stopped -----------------------')
diff --git a/WebStreamer/server/stream_routes.py b/WebStreamer/server/stream_routes.py
index 81622dc..f67b902 100644
--- a/WebStreamer/server/stream_routes.py
+++ b/WebStreamer/server/stream_routes.py
@@ -1,6 +1,4 @@
-# Taken from megadlbot_oss