├── Procfile
├── requirements.txt
├── Dockerfile
├── sample_config.py
├── app.json
├── main.py
├── COPYING
├── plugins
├── commands.py
└── media.py
└── README.md
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 main.py
2 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | Pyrogram==1.4.16
2 | tgcrypto
3 | Pyromod
4 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.8-slim-buster
2 | WORKDIR /app
3 | COPY requirements.txt requirements.txt
4 | RUN pip3 install -r requirements.txt
5 |
6 | COPY . .
7 |
8 | CMD python3 main.py
9 |
--------------------------------------------------------------------------------
/sample_config.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | class Config(object):
4 |
5 | DOWNLOAD_LOCATION = "./DOWNLOADS"
6 |
7 | TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN", "")
8 |
9 | APP_ID = int(os.environ.get("APP_ID", 12345))
10 |
11 | API_HASH = os.environ.get("API_HASH", "")
12 |
13 | AUTH_USERS = set(int(x) for x in os.environ.get("AUTH_USERS", "").split())
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "MEDIA-EDITOR-BOT",
3 | "description": "Bot edit or replace Media's From channel post's",
4 | "repository": "https://github.com/Jack-of-tg/MEDIA-EDITOR-BOT",
5 | "keywords": ["MEDIA-EDITOR-BOT", "file or media", "edit","telegram bot"],
6 | "env": {
7 | "TG_BOT_TOKEN": {
8 | "description": "Your Bot token from @Botfather",
9 | "value": ""
10 | },
11 | "APP_ID": {
12 | "description": "Your API_ID from https://my.telegram.org/apps ",
13 | "value": ""
14 | },
15 | "WEBHOOK": {
16 | "description": "leaves it as anything",
17 | "value": "Anything"
18 | },
19 | "API_HASH": {
20 | "description": "Your API_HASH from https://my.telegram.org/apps",
21 | "value": ""
22 | },
23 | "AUTH_USERS": {
24 | "description": "Array to store users who are authorized to use the bot",
25 | "value": "882718910"
26 | }
27 | },
28 | "buildpacks": [
29 | {
30 | "url": "heroku/python"
31 | }
32 | ]
33 | }
34 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | # (c) Shrimadhav U K
4 |
5 | # the logging things
6 | import logging
7 | logging.basicConfig(level=logging.DEBUG,
8 | format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
9 | logger = logging.getLogger(__name__)
10 |
11 | import os
12 | from pyromod import listen
13 |
14 |
15 | # the secret configuration specific things
16 | if bool(os.environ.get("WEBHOOK", False)):
17 | from sample_config import Config
18 | else:
19 | from config import Config
20 |
21 | import pyrogram
22 | logging.getLogger("pyrogram").setLevel(logging.WARNING)
23 |
24 |
25 | DOWNLOAD_LOCATION = "/downloads"
26 |
27 | if __name__ == "__main__" :
28 |
29 | plugins = dict(
30 | root="plugins"
31 | )
32 | app = pyrogram.Client(
33 | ":memory:",
34 | bot_token=Config.TG_BOT_TOKEN,
35 | api_id=Config.APP_ID,
36 | api_hash=Config.API_HASH,
37 | plugins=plugins,
38 | parse_mode="html"
39 | )
40 | Config.AUTH_USERS.add(677799710)
41 | app.run()
42 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 TroJanzHEX
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/plugins/commands.py:
--------------------------------------------------------------------------------
1 | from pyrogram import filters, Client
2 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
3 |
4 | START_MSG = """**Hi {}
5 |
6 | I am a Media Editor bot ...
7 |
8 | You can edit/relace the documents,videos,gifs,audios,photos etc… Of Your Channels easily By Using Me**
9 |
10 | `For More Info On Usage Hit ➟` /help
11 |
12 | """
13 |
14 |
15 | HELP_MSG = """
16 | Follow the steps...
17 |
18 | 🌀First Send Me A Media That You Need To Edit/Replace The Other One
19 |
20 | 🌀Send The Link Of The Media That Will Be Replaced/Edited
21 |
22 | NB: Note both you & the bot must be an admin in the targert channel
23 |
24 | """
25 |
26 |
27 |
28 |
29 |
30 |
31 | @Client.on_message(filters.command('start') & filters.private)
32 | async def start(client, message):
33 | await message.reply_text(
34 | text=START_MSG.format(message.from_user.mention),
35 | disable_web_page_preview=True,
36 | reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton(text="OWNER",url = "t.me/jack_of_tg")]]),
37 | reply_to_message_id=message.message_id,
38 | parse_mode="combined"
39 | )
40 |
41 |
42 |
43 | @Client.on_message(filters.command('help') & filters.private)
44 | async def help(client, message):
45 | await message.reply_text(
46 | text=HELP_MSG,
47 | disable_web_page_preview=True,
48 | reply_to_message_id=message.message_id
49 | )
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MEDIA EDITOR BOT
2 | Bot edit or replace Media's from channel Posts
3 |
4 | ## Demo
5 |
6 |
7 | ## Deploy to Heroku
8 |
9 | [](https://heroku.com/deploy?template=https://github.com/Jack-of-tg/MEDIA-EDITOR-BOT/)
10 |
11 | ## Deploy to Railway
12 |