diff --git a/README.md b/README.md index 9dc50ab..7bb5997 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@
A Telegram bot to stream files to web
- BOT Demo »
+ Telegram Bot »
Report a Bug
|
@@ -121,6 +121,8 @@ FQDN=yourserverip
`WEB_SERVER_BIND_ADDRESS` : Your server bind adress. Defauls to `0.0.0.0`
+`NO_PORT` : If you don't want your port to be displayed. You should point your `PORT` to `80` (http) or `443` (https) for the links to work. Ignore this if you're on Heroku.
+
`FQDN` : A Fully Qualified Domain Name if present. Defaults to `WEB_SERVER_BIND_ADDRESS`
## How to use the bot
@@ -146,4 +148,4 @@ You can contact either via my [Telegram Chat](https://xn--r1a.click/WhyThisUsern
- Me
- [eyaadh](https://github.com/eyaadh) for his awesome [Megatron Bot](https://github.com/eyaadh/megadlbot_oss)
-- [Dan Tès](https://telegram.dog/haskell) for his [Pyrogram Library](https://github.com/pyrogram/pyrogram)
+- [Dan Tès](https://telegram.dog/haskell) for his [Pyrogram Library](https://github.com/pyrogram/pyrogram)
\ No newline at end of file
diff --git a/WebStreamer/bot/plugins/stream.py b/WebStreamer/bot/plugins/stream.py
index 05a941b..4c0e089 100644
--- a/WebStreamer/bot/plugins/stream.py
+++ b/WebStreamer/bot/plugins/stream.py
@@ -10,10 +10,11 @@ from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
@StreamBot.on_message(filters.private & (filters.document | filters.video | filters.audio), group=4)
async def media_receive_handler(c: Client, m: Message):
log_msg = await m.copy(chat_id=Var.BIN_CHANNEL)
- stream_link = "https://{}/{}".format(Var.FQDN, log_msg.message_id) if Var.ON_HEROKU else \
+ stream_link = "https://{}/{}".format(Var.FQDN, log_msg.message_id) if Var.ON_HEROKU or Var.NO_PORT else \
"http://{}:{}/{}".format(Var.FQDN,
Var.PORT,
log_msg.message_id)
await m.reply_text(
- text="`{}`".format(stream_link)
+ text="`{}`".format(stream_link),
+ quote=True
)
\ No newline at end of file
diff --git a/WebStreamer/vars.py b/WebStreamer/vars.py
index 4129bfe..3ede535 100644
--- a/WebStreamer/vars.py
+++ b/WebStreamer/vars.py
@@ -15,7 +15,8 @@ class Var(object):
BIN_CHANNEL = int(getenv('BIN_CHANNEL', None))
PORT = int(getenv('PORT', 8080))
BIND_ADRESS = str(getenv('WEB_SERVER_BIND_ADDRESS', '0.0.0.0'))
- OWNER_ID = int(getenv('OWNER_ID', None)) #TODO
+ OWNER_ID = int(getenv('OWNER_ID')) #TODO
+ NO_PORT = bool(getenv('NO_PORT', False))
if 'DYNO' in environ:
ON_HEROKU = True
APP_NAME = str(getenv('APP_NAME'))
diff --git a/app.json b/app.json
index 5cb1b1b..acbd704 100644
--- a/app.json
+++ b/app.json
@@ -1,69 +1,74 @@
{
- "name": "TG-FileStreamBot",
- "description": "A Pyrogram Telegram bot to Stream Telegram files to web.",
- "keywords": [
- "telegram",
- "stream",
- "web",
- "pyrogram",
- "aiohttp",
- "python",
- "plugin",
- "modular",
- "media"
- ],
- "repository": "https://github.com/EverythingSuckz/TG-FileStreamBot",
- "success_url": "/",
- "logo": "https://telegra.ph/file/9d63060a06c6fc6def1da.png",
- "website": "stream.wrench.gq",
- "env": {
- "ENV": {
- "description": "Set this to True if you don't want to crash the bot",
- "value": "True"
+ "name": "TG-FileStreamBot",
+ "description": "A Pyrogram Telegram bot to Stream Telegram files to web.",
+ "keywords": [
+ "telegram",
+ "stream",
+ "web",
+ "pyrogram",
+ "aiohttp",
+ "python",
+ "plugin",
+ "modular",
+ "media"
+ ],
+ "repository": "https://github.com/EverythingSuckz/TG-FileStreamBot",
+ "success_url": "/",
+ "logo": "https://telegra.ph/file/9d63060a06c6fc6def1da.png",
+ "website": "stream.wrench.gq",
+ "env": {
+ "ENV": {
+ "description": "Set this to True if you don't want to crash the bot",
+ "value": "True"
+ },
+ "APP_NAME": {
+ "description": "Copy-Paste the app name that you just typed above."
+ },
+ "API_ID": {
+ "description": "Get this value from https://my.telegram.org"
+ },
+ "API_HASH": {
+ "description": "Get this value from https://my.telegram.org"
+ },
+ "BOT_TOKEN": {
+ "description": "Get this value from @BotFather"
+ },
+ "BIN_CHANNEL": {
+ "description": "The BIN Channel ID. Read the readme for more info about this var"
+ },
+ "SLEEP_THRESHOLD": {
+ "description": "Floodwait Sleep timer. Read the readme for more info about this var",
+ "required": false
+ },
+ "WORKERS": {
+ "description": "No. of workers that is to be assigned. Read the readme for more info about this var",
+ "required": false
+ },
+ "PORT": {
+ "description": "Port that you want your webapp to be listened to. Read the readme for more info about this var",
+ "required": false
+ },
+ "NO_PORT": {
+ "description": "If you don't want your port to be displayed. Read the readme for more info about this var",
+ "value": "False",
+ "required": false
+ },
+ "BIND_ADRESS": {
+ "description": "Read the readme for more info about this var",
+ "required": false
+ },
+ "FQDN": {
+ "description": "Read the readme for more info about this var",
+ "required": false
+ }
},
- "APP_NAME": {
- "description": "Copy-Paste the app name that you just typed above."
- },
- "API_ID": {
- "description": "Get this value from https://my.telegram.org"
- },
- "API_HASH": {
- "description": "Get this value from https://my.telegram.org"
- },
- "BOT_TOKEN": {
- "description": "Get this value from @BotFather"
- },
- "BIN_CHANNEL": {
- "description": "The BIN Channel ID. Read the readme for more info about this var"
- },
- "SLEEP_THRESHOLD": {
- "description": "Floodwait Sleep timer. Read the readme for more info about this var",
- "required": false
- },
- "WORKERS": {
- "description": "No. of workers that is to be assigned. Read the readme for more info about this var",
- "required": false
- },
- "PORT": {
- "description": "Port that you want your webapp to be listened to. Read the readme for more info about this var",
- "required": false
- },
- "BIND_ADRESS": {
- "description": "Read the readme for more info about this var",
- "required": false
- },
- "FQDN": {
- "description": "Read the readme for more info about this var",
- "required": false
+ "buildpacks": [{
+ "url": "heroku/python"
+ }],
+ "formation": {
+ "web": {
+ "quantity": 1,
+ "size": "free"
+ }
}
- },
- "buildpacks": [{
- "url": "heroku/python"
- }],
- "formation": {
- "web": {
- "quantity": 1,
- "size": "free"
- }
- }
}
\ No newline at end of file