Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SpEcHiDe/tgfilestream
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: TGExplore/TG-Files-to-Link
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 12 commits
  • 5 files changed
  • 1 contributor

Commits on May 4, 2020

  1. Added Deploy Button

    TGExplore authored May 4, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ef17ed5 View commit details
  2. Added Deploy Button

    TGExplore authored May 4, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    060ce39 View commit details
  3. Added Deploy Button

    TGExplore authored May 4, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d693849 View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8a5f781 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9817c81 View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f34c11a View commit details
  7. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    663a602 View commit details
  8. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    31c8dd8 View commit details

Commits on May 11, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fa936fc View commit details

Commits on Jun 1, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    77c4fb1 View commit details

Commits on Aug 3, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b955457 View commit details
  2. Added 2 option

    TGExplore authored Aug 3, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e6370c View commit details
Showing with 84 additions and 3 deletions.
  1. +18 −0 GenerateStringSession.py
  2. +27 −1 README.md
  3. +37 −0 app.json
  4. +1 −1 requirements.txt
  5. +1 −1 tgfilestream/telegram.py
18 changes: 18 additions & 0 deletions GenerateStringSession.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
# (c) https://t.me/TelethonChat/37677
# This Source Code Form is subject to the terms of the GNU
# General Public License, v.3.0. If a copy of the GPL was not distributed with this
# file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html.

from telethon.sync import TelegramClient
from telethon.sessions import StringSession

print("""Please go-to my.telegram.org
Login using your Telegram account
Click on API Development Tools
Create a new application, by entering the required details""")
APP_ID = int(input("Enter APP ID here: "))
API_HASH = input("Enter API HASH here: ")

with TelegramClient(StringSession(), APP_ID, API_HASH) as client:
print(client.session.save())
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tgfilestream
# Telegram File To Link Generation Bot
A Telegram bot that can stream Telegram files to users over HTTP.

## Setup
@@ -9,10 +9,21 @@ A reverse proxy is recommended to add TLS. When using a reverse proxy, keep
`HOST` as-is, but add the publicly accessible URL to `PUBLIC_URL`. The URL
should include the protocol, e.g. `https://example.com`.

## You can also tap the Deploy To Heroku button below to deploy straight to Heroku!

### With Bot Token & Session String
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/TGExplore/TG-Files-to-Link)

### Without Session String
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/TGExplore/TG-Files-to-Link/tree/Merging)

Watch our YouTube video for more details - [How To Create Your Own Telegram File To Link Generation Bot](http://www.youtube.com/watch?v=H-bEuLjwdfY)

### Environment variables
* `TG_API_ID` (required) - Your Telegram API ID.
* `TG_API_HASH` (required) - Your Telegram API hash.
* `TG_SESSION_NAME` (defaults to `tgfilestream`) - The name of the Telethon session file to use.
* `TG_BOT_FATHER_TOKEN` - Your bot token, as a string..
* `PORT` (defaults to `8080`) - The port to listen at.
* `HOST` (defaults to `localhost`) - The host to listen at.
* `PUBLIC_URL` (defaults to `http://localhost:8080`) - The prefix for links that the bot gives.
@@ -22,3 +33,18 @@ should include the protocol, e.g. `https://example.com`.
* `REQUEST_LIMIT` (default 5) - The maximum number of requests a single IP can have active at a time.
* `CONNECTION_LIMIT` (default 20) - The maximum number of connections to a single Telegram datacenter.
* `TG_START_MESG` - The message that should be shown in Telegram chat, in case of non-media message.

## How to get TG_SESSION_NAME string

Run Console in Heroku `python3 GenerateStringSession.py` and follow.
* Note: When it will ask for Phone Number and Bot token Give `Bot token` value

### OR use online terminal

[![Run](https://img.shields.io/badge/Run%20Online-Black)](https://generatestringsession.tgexplore.repl.run/)


## Issue Bot stopped responding

If bot is not responding, open `https://<appname>.herokuapp.com/` and try again.
Issue - https://github.com/tulir/tgfilestream/issues/9
37 changes: 37 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "TG Files to Link",
"description": "Telegram files to Direct link!!",
"logo": "https://telegra.ph/file/c3d25aa057a3aa2282d50.png",
"keywords": [
"telegram",
"FiletoLinkBot"
],
"repository": "https://github.com/TGExplore/TG-Files-to-Link",
"env": {
"TG_API_ID": {
"description": "Your Telegram API ID. Get this value from my.telegram.org!",
"value": ""
},
"TG_API_HASH": {
"description": " Your Telegram API hash. Get this value from my.telegram.org!",
"value": ""
},
"TG_SESSION_NAME": {
"description": "Run Console this (python3 GenerateStringSession.py) ",
"value": ""
},
"HOST": {
"description": "Leave the Same Value",
"value": "0.0.0.0",
"required": false
},
"PUBLIC_URL": {
"description": "The Heroku App URL similar to https://<appname>.herokuapp.com/",
"value": ""
},
"TG_START_MESG": {
"description": "Set /start Message",
"value": ""
}
}
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp
yarl
telethon
telethon==1.15.0
cryptg
2 changes: 1 addition & 1 deletion tgfilestream/telegram.py
Original file line number Diff line number Diff line change
@@ -44,6 +44,6 @@ async def handle_message(evt: events.NewMessage.Event) -> None:
await evt.reply(start_message)
return
url = public_url / str(pack_id(evt)) / get_file_name(evt)
await evt.reply(f"Link to download file: [{url}]({url})")
await evt.reply(f"Link to download file: {url}")
log.info(f"Replied with link for {evt.id} to {evt.from_id} in {evt.chat_id}")
log.debug(f"Link to {evt.id} in {evt.chat_id}: {url}")