├── runtime.txt
├── Procfile
├── run cmd.txt
├── requirements.txt
├── Dockerfile
├── app.py
├── README.md
├── LICENSE
└── main.py
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.10.8
2 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 main.py
2 |
--------------------------------------------------------------------------------
/run cmd.txt:
--------------------------------------------------------------------------------
1 | gunicorn app:app & python3 main.py
2 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pyrofork
2 | TgCrypto
3 | aiohttp
4 | Flask==1.1.2
5 | gunicorn==20.1.0
6 | Jinja2==3.0.3
7 | werkzeug==2.0.2
8 | itsdangerous==2.0.1
9 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10.8
2 |
3 | WORKDIR /app
4 |
5 | COPY requirements.txt /app/
6 |
7 | RUN pip3 install -r requirements.txt
8 |
9 | COPY . /app
10 |
11 | CMD python3 main.py
12 |
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 | app = Flask(__name__)
3 |
4 | @app.route('/')
5 | def hello_world():
6 | return 'VJBotz'
7 |
8 |
9 | if __name__ == "__main__":
10 | app.run()
11 |
12 | # Don't Remove Credit @VJ_Botz
13 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ
14 | # Ask Doubt on telegram @KingVJ01
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## VJ Auto Caption Bot
2 |
3 | ### How To Deploy [Video Tutorial](https://youtu.be/LRfr24vBCA8).
4 |
5 | ### Simple Variables 😉
6 |
7 | * `app_id` : Get this value from [telegram.org](https://my.telegram.org/apps).
8 | * `api_hash` : Get this value from [telegram.org](https://my.telegram.org/apps) .
9 | * `bot_token` : Create a bot using [@BotFather](https://telegram.dog/BotFather), and get the Telegram API token.
10 | * `custom_caption` : your caption. add {file_name} to get file original name. More info to watch [YT TUTORIAL](https://youtu.be/LRfr24vBCA8).
11 |
12 | ### Credits
13 |
14 | - [Tech VJ](https://youtube.com/@Tech_VJ)
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Muhammed
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 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | # Don't Remove Credit @VJ_Botz
2 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ
3 | # Ask Doubt on telegram @KingVJ01
4 |
5 | import pyrogram, os, asyncio
6 |
7 | app_id = int(os.environ.get("app_id", ""))
8 | api_hash = os.environ.get("api_hash", "")
9 | bot_token = os.environ.get("bot_token", "")
10 | custom_caption = os.environ.get("custom_caption", "`{file_name}`\n\n**Powered By - @VJ_Botz**") # Here You Can Give Anything, if You Want Real File Name Then Use {file_name}
11 |
12 | AutoCaptionBotV1 = pyrogram.Client(name="AutoCaptionBotV1", api_id=app_id, api_hash=api_hash, bot_token=bot_token)
13 |
14 | start_message = """
15 | 👋Hello {}
16 | I am an AutoCaption bot
17 | All you have to do is to add me to your channel as admin and I will show you my power
18 | @VJ_Botz"""
19 |
20 | about_message = """
21 | • Name : VJ AutoCaption
22 | • Developer : [VJ UPDATES]
23 | • Language : Python3
24 | • Library : Pyrogram v{version}
25 | • Updates : Click Here
26 | • Source Code : Click Here"""
27 |
28 | @AutoCaptionBotV1.on_message(pyrogram.filters.private & pyrogram.filters.command(["start"]))
29 | def start_command(bot, update):
30 | update.reply(start_message.format(update.from_user.mention), reply_markup=start_buttons(bot, update), parse_mode=pyrogram.enums.ParseMode.HTML, disable_web_page_preview=True)
31 |
32 | @AutoCaptionBotV1.on_callback_query(pyrogram.filters.regex("start"))
33 | def strat_callback(bot, update):
34 | update.message.edit(start_message.format(update.from_user.mention), reply_markup=start_buttons(bot, update.message), parse_mode=pyrogram.enums.ParseMode.HTML, disable_web_page_preview=True)
35 |
36 | @AutoCaptionBotV1.on_callback_query(pyrogram.filters.regex("about"))
37 | def about_callback(bot, update):
38 | bot = bot.get_me()
39 | update.message.edit(about_message.format(version=pyrogram.__version__, username=bot.mention), reply_markup=about_buttons(bot, update.message), parse_mode=pyrogram.enums.ParseMode.HTML, disable_web_page_preview=True)
40 |
41 | @AutoCaptionBotV1.on_message(pyrogram.filters.channel)
42 | def edit_caption(bot, update: pyrogram.types.Message):
43 | techvj, _ = get_file_details(update)
44 | try:
45 | try:
46 | update.edit(custom_caption.format(file_name=techvj.file_name))
47 | except pyrogram.errors.FloodWait as FloodWait:
48 | asyncio.sleep(FloodWait.value)
49 | update.edit(custom_caption.format(file_name=techvj.file_name))
50 | except:
51 | pass
52 | except pyrogram.errors.MessageNotModified:
53 | pass
54 |
55 | def get_file_details(update: pyrogram.types.Message):
56 | if update.media:
57 | for message_type in (
58 | "photo",
59 | "animation",
60 | "audio",
61 | "document",
62 | "video",
63 | "video_note",
64 | "voice",
65 | "sticker"
66 | ):
67 | obj = getattr(update, message_type)
68 | if obj:
69 | return obj, obj.file_id
70 |
71 | def start_buttons(bot, update):
72 | bot = bot.get_me()
73 | buttons = [[
74 | pyrogram.types.InlineKeyboardButton("Updates", url="t.me/VJ_Botz"),
75 | pyrogram.types.InlineKeyboardButton("About 🤠", callback_data="about")
76 | ],[
77 | pyrogram.types.InlineKeyboardButton("➕️ Add To Your Channel ➕️", url=f"http://t.me/{bot.username}?startchannel=true")
78 | ]]
79 | return pyrogram.types.InlineKeyboardMarkup(buttons)
80 |
81 | def about_buttons(bot, update):
82 | buttons = [[
83 | pyrogram.types.InlineKeyboardButton("🏠 Back To Home 🏠", callback_data="start")
84 | ]]
85 | return pyrogram.types.InlineKeyboardMarkup(buttons)
86 |
87 | print("Telegram AutoCaption V1 Bot Start")
88 | print("Bot Created By @VJ_Botz")
89 |
90 | AutoCaptionBotV1.run()
91 |
92 | # Don't Remove Credit @VJ_Botz
93 | # Subscribe YouTube Channel For Amazing Bot @Tech_VJ
94 | # Ask Doubt on telegram @KingVJ01
95 |
--------------------------------------------------------------------------------