-
-
Notifications
You must be signed in to change notification settings - Fork 804
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
29 changed files
with
1,091 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
<!-- markdownlint-disable --> | ||
|
||
<p align="center"> | ||
<a href = "https://github.com/aahnik/tgcf" > <img src = "https://user-images.githubusercontent.com/66209958/115183360-3fa4d500-a0f9-11eb-9c0f-c5ed03a9ae17.png" alt = "tgcf logo" width=120> </a> | ||
</p> | ||
|
||
<h1 align="center"> tgcf </h1> | ||
|
||
<p align="center"> | ||
The ultimate tool to automate custom telegram message forwarding. | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://github.com/aahnik/tgcf/blob/main/LICENSE"><img src="https://img.shields.io/github/license/aahnik/tgcf" alt="GitHub license"></a> | ||
<a href="https://github.com/aahnik/tgcf/stargazers"><img src="https://img.shields.io/github/stars/aahnik/tgcf?style=social" alt="GitHub stars"></a> | ||
<a href="https://github.com/aahnik/tgcf/issues"><img src="https://img.shields.io/github/issues/aahnik/tgcf" alt="GitHub issues"></a> | ||
<img src="https://img.shields.io/pypi/v/tgcf" alt="PyPI"> | ||
<a href="https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Faahnik%2Ftgcf"><img src="https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Faahnik%2Ftgcf" alt="Twitter"></a> | ||
</p> | ||
<p align="center"> | ||
<a href="https://github.com/aahnik/tgcf/actions/workflows/quality.yml"><img src="https://github.com/aahnik/tgcf/actions/workflows/quality.yml/badge.svg" alt="Code Quality"></a> | ||
</p> | ||
<!-- markdownlint-enable --> | ||
|
||
</br> | ||
|
||
--- | ||
! warning ! this is the readme for version 0.2 (old version), and many information may not be true for present version. | ||
--- | ||
--- | ||
|
||
</br> | ||
Live-syncer, Auto-poster, backup-bot, cloner, chat-forwarder, duplicator, ... | ||
|
||
Call it whatever you like! tgcf can fulfill your custom needs. | ||
|
||
The *key features* are: | ||
|
||
1. Forward messages as "forwarded" or | ||
send a copy of the messages from source to destination chats. | ||
|
||
> A chat can be anything: a group, channel, person or even another bot. | ||
|
||
2. Supports two [modes](https://github.com/aahnik/tgcf/wiki/Past-vs-Live-modes-explained) | ||
of operation _past_ or _live_. | ||
|
||
> The past mode deals with all existing messages, | ||
> while the live mode is for upcoming ones. | ||
|
||
3. You may [login](https://github.com/aahnik/tgcf/wiki/Login-with-a-bot-or-user-account) | ||
with a _bot_ or an _user_ account. | ||
|
||
> Telegram imposes certain | ||
[limitations](https://github.com/aahnik/tgcf/wiki/Using-bot-accounts#limitations) | ||
on bot accounts. | ||
You may use an user account to perform the forwards if you wish. | ||
|
||
4. Perform custom manipulation on messages. | ||
|
||
> You can | ||
[filter](https://github.com/aahnik/tgcf/wiki/How-to-use-filters-%3F), | ||
[format](https://github.com/aahnik/tgcf/wiki/Format-text-before-sending-to-destination), | ||
[replace](https://github.com/aahnik/tgcf/wiki/Text-Replacement-feature-explained), | ||
[watermark](https://github.com/aahnik/tgcf/wiki/How-to-use--watermarking-%3F), | ||
[ocr](https://github.com/aahnik/tgcf/wiki/You-can-do-OCR) | ||
and do whatever else you need ! | ||
|
||
5. Detailed [wiki](https://github.com/aahnik/tgcf/wiki) + | ||
Video tutorial. | ||
> You can also [get help](#getting-help) from the community. | ||
|
||
6. If you are a python developer, writing | ||
[plugins](https://github.com/aahnik/tgcf/wiki/How-to-write-a-plugin-for-tgcf-%3F) | ||
for tgcf is like stealing candy from a baby. | ||
> Plugins modify the message before they are sent to the destination chat. | ||
|
||
What are you waiting for? Star the repo and click Watch to recieve updates. | ||
|
||
<!-- markdownlint-disable --> | ||
## Video Tutorial | ||
|
||
A youtube video is coming soon. [Subscribe](https://www.youtube.com/channel/UCcEbN0d8iLTB6ZWBE_IDugg) to get notified. | ||
|
||
<!-- markdownlint-enable --> | ||
|
||
## Installation | ||
|
||
- If you are an **Windows** user, who is not familiar with the command line, the | ||
[Windows guide](https://github.com/aahnik/tgcf/wiki/Run-tgcf-on-Windows) | ||
is for you. | ||
|
||
- To install tgcf on **Android** (Termux), there exists an installer script, | ||
that allows you to install all dependencies by running just a single line command. | ||
Read the | ||
[guide for android](https://github.com/aahnik/tgcf/wiki/Run-on-Android-using-Termux) | ||
to learn. | ||
|
||
- If you are familiar with **Docker**, you may read the | ||
[docker guide](https://github.com/aahnik/tgcf/wiki/Install-and-run-using-docker) | ||
for an isolated installation. | ||
|
||
- Otherwise for **Linux/Mac**, | ||
you may install `tgcf` via python's package manager `pip`. | ||
|
||
> **Note:** Make sure you have Python 3.8 or above installed. | ||
Go to [python.org](https://python.org) to download python. | ||
|
||
Open your terminal and run the following commands. | ||
|
||
```shell | ||
pip install --upgrade tgcf | ||
``` | ||
|
||
To check if the installation succeeded, run | ||
|
||
```shell | ||
tgcf --version | ||
``` | ||
|
||
## Usage | ||
|
||
Configuring `tgcf` is easy. You just need two files in your present directory | ||
(from which tgcf is invoked). | ||
|
||
- [`.env`](https://github.com/aahnik/tgcf/wiki/Environment-Variables) | ||
: To define your environment variables easily. | ||
|
||
- [`tgcf.config.yml`](https://github.com/aahnik/tgcf/wiki/How-to-configure-tgcf-%3F) | ||
: An `yaml` file to configure how `tgcf` behaves. | ||
|
||
In your terminal, just run `tgcf live` or `tgcf past` to start `tgcf`. | ||
It will prompt you to enter your phone no. or bot token, when you run it | ||
for the first time. | ||
|
||
For more details run `tgcf --help` or [read wiki](https://github.com/aahnik/tgcf/wiki/CLI-Usage). | ||
|
||
## Deploy to Cloud | ||
|
||
Click on [this link](https://m.do.co/c/98b725055148) and get **free 100$** | ||
on Digital Ocean. | ||
|
||
[![DigitalOcean Referral Badge](https://web-platforms.sfo2.digitaloceanspaces.com/WWW/Badge%203.svg)](https://www.digitalocean.com/?refcode=98b725055148&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge) | ||
|
||
> **NOTE** You will get nothing if you directly sign up from Digital Ocean Home Page. | ||
> **Use the link** above, or **click on the big fat button** above to get free 100$. | ||
|
||
Deploying to a cloud server is an easier alternative if you cannot install | ||
on your own machine. | ||
Cloud servers are very reliable and great for running `tgcf` in live mode | ||
for a long time. | ||
|
||
You can enjoy smooth one-click deploys to the major cloud providers. | ||
|
||
- [Heroku](https://github.com/aahnik/tgcf/wiki/Deploy-to-Heroku) | ||
- [Digital Ocean](https://github.com/aahnik/tgcf/wiki/Deploy-to-Digital-Ocean) | ||
- [Gitpod](https://github.com/aahnik/tgcf/wiki/Run-for-free-on-Gitpod") | ||
- [Python Anywhere](https://github.com/aahnik/tgcf/wiki/Run-on-PythonAnywhere) | ||
- [Google Cloud Run](https://github.com/aahnik/tgcf/wiki/Run-on-Google-Cloud) | ||
- [GitHub Actions](https://github.com/aahnik/tgcf/wiki/Run-tgcf-in-past-mode-periodically) | ||
## Getting Help | ||
- First of all [read the wiki](https://github.com/aahnik/tgcf/wiki) | ||
and [watch the videos](https://www.youtube.com/channel/UCcEbN0d8iLTB6ZWBE_IDugg) | ||
to get started. | ||
- Type your question in GitHub's Search bar on the top left of this page, | ||
and click "In this repository". | ||
Go through the issues, discussions and wiki pages that appear in the result. | ||
Try re-wording your query a few times before you give up. | ||
- If your question does not already exist, | ||
feel free to ask your questions in the | ||
[Discussion forum](https://github.com/aahnik/tgcf/discussions/new). | ||
Please avoid duplicates. | ||
- For reporting bugs or requesting a new feature please use the [issue tracker](https://github.com/aahnik/tgcf/issues/new) | ||
of the repo. | ||
## Contributing | ||
PRs are most welcome! Read the [contributing guidelines](/.github/CONTRIBUTING.md) | ||
to get started. | ||
If you are not a developer, you may also contribute financially to | ||
incentivise the development of any custom feature you need. |
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,13 @@ | ||
The application `tgcf` offers a minimal command-line interface to start it. Most of the configuration is done by using the [`tgcf.config.yml`](https://github.com/aahnik/tgcf/wiki/How-to-configure-tgcf-%3F) file. | ||
|
||
```shell | ||
Arguments: | ||
MODE:[past|live] Choose the mode in which you want to run tgcf. [env var: | ||
TGCF_MODE;required] | ||
|
||
|
||
Options: | ||
-l, --loud Increase output verbosity. [env var: LOUD] | ||
-v, --version Show version and exit. | ||
--help Show this message and exit. | ||
``` |
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,40 @@ | ||
DigitalOcean infrastructure is a leading cloud service provider based in the United States of America. Their headquarter operates from New York City, and their data centers are prevalent in every corner of the world in order to provide seamless cloud services across the globe. | ||
|
||
|
||
## App Platform | ||
|
||
|
||
![create-app](https://user-images.githubusercontent.com/66209958/113475188-aab3a200-9491-11eb-8649-9c4111d05a1b.png) | ||
|
||
Click **Create** -> *Apps* | ||
|
||
|
||
![source-is-docker-hub](https://user-images.githubusercontent.com/66209958/113475207-c1f28f80-9491-11eb-84d1-5b90e6a4ee3c.png) | ||
|
||
Choose **Docker Hub** as the source. | ||
Choose the **type** as _"Worker"_ (as we are not making any web app). | ||
|
||
In the next step,the **repository** path is _"aahnik/tgcf"_. | ||
|
||
![type-worker](https://user-images.githubusercontent.com/66209958/113475243-fbc39600-9491-11eb-9c2e-96fb0487d43d.png) | ||
|
||
You can now set the values of the [environment variables](https://github.com/aahnik/tgcf/wiki/Environment-Variables) from this beautiful interface provided by Digital Ocean. | ||
|
||
|
||
Give any name to your app. After this, you will be lead to a pricing page. Choose a pricing plan suitable for you and click "Launch basic app". | ||
|
||
|
||
|
||
## Ubuntu Droplet | ||
|
||
If you want more control, you may run `tgcf` on a VPS like DigitalOcean's ubuntu droplets. | ||
|
||
Steps: | ||
- Create a Droplet | ||
- SSH into it | ||
- Update packages | ||
- Install python | ||
- Install `tgcf` | ||
- Use `tgcf` CLI | ||
|
||
Details coming soon! |
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,50 @@ | ||
Heroku is a cloud platform that lets companies build, deliver, monitor, and scale apps, it is one of the fastest ways to go from idea to URL, bypassing all those infrastructure headaches. | ||
|
||
You can deploy `tgcf` to Heroku very easily. | ||
|
||
## Limitations | ||
|
||
- Heroku has an ephemeral file system. | ||
- Thus you cant store your files here. | ||
- `tgcf.config.yml` can't be created here. | ||
- Instead, you can use an environment variable named `TGCF_CONFIG` to store the contents of the configuration file. | ||
- `tgcf` in past mode won't work properly in Heroku, as the environment variable TGCF_CONFIG can't be updated. | ||
|
||
## Pros | ||
|
||
- `tgcf` will work **perfectly fine** in `live` mode in Heroku. | ||
- Heroku offers a great free tier of 450 hrs/mo | ||
|
||
## One-click deploy | ||
|
||
1. Make sure you have a Heroku account and then click on this button. | ||
|
||
<a href="https://heroku.com/deploy?template=https://github.com/aahnik/tgcf"> <img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku" width=155></a> | ||
|
||
2. A Heroku page will open where you can set all the environment variables. | ||
|
||
- Set the name of the app whatever you want. | ||
|
||
![image](https://user-images.githubusercontent.com/66209958/115880520-7287f980-a468-11eb-9bfc-5a72cbe668d9.png) | ||
|
||
- Set your API ID and API HASH obtained from [my.telegram.org](https://my.telegram.org). Set the mode to `live`. | ||
|
||
|
||
- You may keep your `SESSION_STRING` and `TGCF_CONFIG` empty for now. | ||
|
||
|
||
- Now click the deploy app button. | ||
|
||
|
||
3. It will take some time to build and deploy. After the deployment is complete, click on the manage app button. | ||
![image](https://user-images.githubusercontent.com/66209958/115881849-cb0bc680-a469-11eb-8b35-6bf5c6a5eca4.png) | ||
|
||
4. How to get the session string? [Read this](https://github.com/aahnik/tgcf/wiki/Login-with-a-bot-or-user-account#generate-session-string). | ||
|
||
5. Now go to the settings tab and click Reveal config vars. Click on the pencil button for the session string and config var, and then paste the session string the value of that. | ||
|
||
6. Learn [how to configure tgcf](https://github.com/aahnik/tgcf/wiki/How-to-configure-tgcf-%3F), and then write your configuration in the `TGCF_CONFIG` env var. | ||
|
||
7. Go to the resources tab, and turn on the worker and click confirm. | ||
|
||
![image](https://user-images.githubusercontent.com/66209958/115882913-dc090780-a46a-11eb-980b-6b0f49ff45f5.png) |
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,37 @@ | ||
An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. | ||
|
||
The secret credentials like `API_ID` and `API_HASH` are stored as environment variables. | ||
|
||
## All env vars | ||
|
||
| Env Var | Value | Requirement | | ||
| ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ||
| **`API_ID`** | obtain it from [my.telegram.org](https://my.telegram.org) | always required | | ||
| **`API_HASH`** | obtain it from [my.telegram.org](https://my.telegram.org) | always required | | ||
| `TGCF_MODE` | [`past` or `live`](https://github.com/aahnik/tgcf/wiki/Past-vs-Live-modes-explained) | only required if you don't have interactive shell while running `tgcf`. | | ||
| `BOT_TOKEN` | obtained from [@BotFather](https://telegram.me/BotFather) | required if you are running`tgcf`with a bot account. | | ||
| `SESSION_STRING` | obtained after [login](https://github.com/aahnik/tgcf/wiki/Login-with-a-bot-or-user-account#generate-session-string) | only required if you are using `tgcf`with user account. | | ||
| `TGCF_CONFIG` | contents of [`tgcf.config.yml`](https://github.com/aahnik/tgcf/wiki/How-to-configure-tgcf-%3F) | only required if you cant edit files in your cloud deploy (digital ocean app or heroku dyno) | | ||
|
||
|
||
|
||
|
||
## Setting env vars | ||
|
||
There are various methods to set env vars | ||
|
||
### `.env` File | ||
|
||
You can easily set environment variables for `tgcf` using a `.env` file in the directory from which `tgcf` is invoked. | ||
|
||
```shell | ||
API_ID=543213 | ||
API_HASH=uihfuiwruiw28490238huawfiuhf | ||
# put your real values here | ||
``` | ||
|
||
### Cloud Deploys | ||
|
||
When you are deploying to a cloud platform, and you cant create files (Heroku or digital ocean apps), you can set environment variables using the GUI provided by the platforms. Please read platform-specific guides in the wiki for more details. | ||
|
||
When you are deploying on a cloud platform, you can configure tgcf using environment variables. The contents of `tgcf.config.yml` can be put inside the environment variable called `TGCF_CONFIG`. |
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,6 @@ | ||
Flood wait errors are imposed by telegram. Telegram has a rate limit of how many messages you can send. | ||
|
||
When a flood wait error occurs, tgcf waits for the required time and then resumes. | ||
|
||
More info to be added soon! | ||
|
17 changes: 17 additions & 0 deletions
17
.github/archives/tgcf_0.2_wiki/Format-text-before-sending-to-destination.md
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,17 @@ | ||
The `format` plugin allows you to force a style before sending the messages to destination chat. | ||
|
||
Make sure you have read | ||
- [How to configure tgcf](https://github.com/aahnik/tgcf/wiki/How-to-configure-tgcf-%3F) | ||
- [Plugins](https://github.com/aahnik/tgcf/wiki/Plugins) | ||
|
||
|
||
To use the `format` plugin, put the following in your configuration file. | ||
|
||
```yaml | ||
plugins: | ||
# ... your other plugins here | ||
format: | ||
style: bold # choose from [ bold, italics, code, strike, plain, preserve ] | ||
# ... other plugins | ||
|
||
``` |
Oops, something went wrong.