Skip to content

Commit 9de3197

Browse files
committed
Update To V1.0.0 πŸ”₯ @RknDeveloper
1 parent 883d769 commit 9de3197

File tree

13 files changed

+766
-333
lines changed

13 files changed

+766
-333
lines changed

β€ŽLICENSEβ€Ž

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Biisal
3+
Copyright (c) 2024 RknDeveloper
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,20 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
πŸ“ The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

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.
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+
23+
---
24+
25+
πŸ“Œ Note:
26+
This project was originally developed by RknDeveloper.
27+
If you use or fork this project, please retain credit and include a link to the original repository:
28+
https://github.com/RknDeveloper/Rkn-AutoCaptionBot

β€ŽProcfileβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
web: python bot.py
2-
worker: python bot.py
1+
web: python3 bot.py
2+
worker: python3 bot.py

β€ŽREADME.mdβ€Ž

Lines changed: 90 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1+
> ⚠️ **Note:** This repo has been built with ruff error handling.
2+
> Please make any changes only after careful consideration β€” otherwise, it may lead to errors.
3+
>
4+
> πŸ‘‰ Join your very own [#RknFamily](https://t.me/Rkn_Bots_Updates)
5+
6+
17
<img src="https://telegra.ph/file/21a8e96b45cd6ac4d3da6.jpg" alt="logo" target="/blank">
28

39
<img src="https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif">
4-
<h1 align= center>Auto Caption Bot</h1>
10+
<p align=center><img src="https://readme-typing-svg.herokuapp.com?lines=Auto+Caption+Bot&color=FF0000&font=Fira+Code&size=48&width=700&height=80&duration=2&pause=100000&center=true" alt="Auto Caption Bot" /></p>
511
<img src="https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif">
612

713
<p align="center">πŸ’œ Thanks for Being Here πŸ’œ</p>
814

9-
<p align='center'><b><li>This bot can edit the captions of the videos, audios, or documents when they are uploaded to the channel</b></p>
15+
<p align='center'><b><li>This bot automatically updates captions for videos, audios, and documents uploaded to your channel.</b></p>
1016
<br>
1117

1218
## <li> Deployment Methods
1319

1420
<details><summary>πŸ“Œ Deploy to Koyeb </summary>
1521

16-
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=git&repository=github.com/RknDeveloper/Rkn-AutoCaptionBot&env[BOT_TOKEN]&env[API_ID]&env[API_HASH]&env[ADMIN]&env[DB_NAME]&env[DB_URI]&env[FORCE_SUB]&env[RKN_PIC]=https://graph.org/file/f6c15009bce07058f1edb.jpg&env[DEF_CAP]&run_command=python%20bot.py&branch=main&name=Rkn-AutoCaptionBot)
17-
</details>
22+
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](
23+
https://app.koyeb.com/deploy?type=git
24+
&repository=github.com/RknDeveloper/Rkn-AutoCaptionBot
25+
&branch=main
26+
&run_command=python%20bot.py
27+
&name=Rkn-AutoCaptionBot
28+
&env[BOT_TOKEN]
29+
&env[API_ID]
30+
&env[API_HASH]
31+
&env[ADMIN]
32+
&env[DB_NAME]
33+
&env[DB_URI]
34+
&env[FORCE_SUB]
35+
&env[RKN_PIC]
36+
&env[DEFAULT_CAPTION]=%3Cb%3E%3Ca%20href%3D%27https%3A%2F%2Ft.me%2FRkn_Botz%27%3E%7Bfile_name%7D%20Main%20Telegram%20Channel%3A%20%40Rkn_Bots_Updates%3C%2Fa%3E%3C%2Fb%3E
37+
&env[PORT]=8080
38+
)
39+
1840

1941
<details><summary>πŸ“Œ Deploy to Render </summary>
2042

@@ -27,11 +49,11 @@
2749
<a href="https://heroku.com/deploy?template=https://github.com/RknDeveloper/Rkn-AutoCaptionBot"> <img src="https://img.shields.io/badge/Deploy%20To%20Heroku-black?style=for-the-badge&logo=heroku" width="220" height="38.45"></p></a>
2850
</details>
2951

30-
<details><summary>πŸ“Œ Deploy to Railway </summary>
31-
32-
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/w7jSPk)
52+
<details><summary>πŸ“Œ Deploy To Railway </summary>
53+
<a href="https://graph.org/file/fabd75cd5043d2cfdc13d.jpg"><img src="https://railway.app/button.svg" alt="Deploy"></a>
3354
</details>
3455

56+
3557
## πŸ₯° Features
3658

3759
* Channel Auto Caption Edit.
@@ -45,15 +67,42 @@
4567
* Deploy to Koyeb + Heroku + Railway + Render + Vps.
4668
* Developer Service 24x7. πŸ”₯
4769

48-
## <li> Configs
49-
* `BOT_TOKEN` - Get Bot Token From @BotFather
50-
* `API_ID` - From my.telegram.org
51-
* `API_HASH` - From my.telegram.org
52-
* `ADMIN` - AUTH Or Bot Controllers Id's Multiple Id Use Space To Split
53-
* `DB_URL` - Mongo Database URL From https://cloud.mongodb.com
54-
* `DB_NAME` - Your Database Name From Mongodb.
55-
* `FORCE_SUB` - Your Force Sub Channel Username Without @
56-
* `DEF_CAP` - Set Your Custom Caption (Without Using Any Commands) Exam.. `{filename}`
70+
## πŸ”§ Configuration Guide
71+
72+
Set the following environment variables before deploying:
73+
74+
- **`BOT_TOKEN`**
75+
Get it from [@BotFather](https://t.me/BotFather) after creating your bot.
76+
77+
- **`API_ID`**
78+
Available at [my.telegram.org](https://my.telegram.org) β†’ Login and go to "API Development Tools or use bot [@ApiScrapManBot](https://t.me/ApiScrapManBot) to fetch easily".
79+
80+
- **`API_HASH`**
81+
Available at [my.telegram.org](https://my.telegram.org) β†’ Login and go to "API Development Tools or use bot [@ApiScrapManBot](https://t.me/ApiScrapManBot) to fetch easily".
82+
83+
- **`ADMIN`**
84+
Telegram user ID(s) of the bot admin(s).
85+
➀ For Do not add multiple admins β€” space-separated IDs are not supported.",
86+
**Example:** `123456789`
87+
88+
- **`DB_URL`**
89+
MongoDB connection URL.
90+
➀ Get it from [MongoDB Atlas](https://cloud.mongodb.com).
91+
92+
- **`DB_NAME`**
93+
Your MongoDB database name.
94+
**Example:** `mybotdb`
95+
96+
- **`FORCE_SUB`**
97+
Telegram channel username **without** `@`.
98+
➀ Used to force users to join your channel before using the bot. (only public chat username required)
99+
**Example:** `MyChannel`
100+
101+
- **`DEFAULT_CAPTION`**
102+
Default caption for files sent by the bot.
103+
➀ Use `{filename}` to insert the file name automatically.
104+
**Example:** `<b>πŸ“‚ File:</b> {filename}\n<b>πŸ”— Join:</b> @MyChannel`
105+
57106

58107
## Botfather Commands
59108
```
@@ -66,8 +115,29 @@ broadcast - sᴇɴᴅ ᴍᴀssᴀɒᴇ ᴛᴏ α΄€ΚŸΚŸ ᴜsᴇʀs (ᴀᴅᴍΙͺΙ΄
66115
```
67116

68117
## Support
69-
* [![Support](https://img.shields.io/static/v1?label=Support&message=Group&color=critical)](https://t.me/Rkn_Bots_Support)
70-
* [![Updates](https://img.shields.io/static/v1?label=Updates&message=Channel&color=critical)](https://t.me/Rkn_Bots)
118+
* [![Telegram Updates](https://img.shields.io/badge/Telegram-%231DA1F2.svg?style=for-the-badge&logo=telegram&logoColor=white&label=Latest%20Updates&color=0088cc)](https://t.me/Rkn_Bots_Updates)
119+
* [![Telegram Support](https://img.shields.io/badge/Telegram-%231DA1F2.svg?style=for-the-badge&logo=telegram&logoColor=white&label=Join%20Support&color=0057b7)](https://t.me/Rkn_Bots_Support)
120+
121+
122+
123+
## πŸ“œ License
124+
125+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
126+
127+
This project is licensed under the [MIT License](./LICENSE).
128+
129+
You are free to:
130+
131+
- βœ… Use this code in your own projects
132+
- βœ… Modify or enhance it
133+
- βœ… Fork and share it
134+
- βœ… Use it commercially
135+
136+
### ⚠️ Under the following conditions:
137+
138+
- πŸ“ **You must include proper credit** to the original author: [`RknDeveloper`](https://github.com/RknDeveloper)
139+
- πŸ“„ **You must retain the original LICENSE file**
140+
- ❌ **Do not claim this project as your own**
71141

72-
## Credits
73-
* [![RknDeveloper](https://img.shields.io/static/v1?label=Rkn&message=Developer&color=critical)](https://t.me/RknDeveloper)
142+
> Example of credit:
143+
> `Project originally developed by RknDeveloper (https://github.com/RknDeveloper/Rkn-AutoCaptionBot)`

β€ŽRkn_Botz/Force_Sub.pyβ€Ž

Lines changed: 79 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,84 @@
1-
from pyrogram import Client, filters, enums
2-
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
1+
# AutoCaptionBot by RknDeveloper
2+
# Copyright (c) 2024 RknDeveloper
3+
# Licensed under the MIT License
4+
# https://github.com/RknDeveloper/Rkn-AutoCaptionBot/blob/main/LICENSE
5+
# Please retain this credit when using or forking this code.
6+
7+
# Developer Contacts:
8+
# Telegram: @RknDeveloperr
9+
# Updates Channel: @Rkn_Bots_Updates & @Rkn_Botz
10+
# Special Thanks To: @ReshamOwner
11+
# Update Channels: @Digital_Botz & @DigitalBotz_Support
12+
13+
# ⚠️ Please do not remove this credit!
14+
15+
16+
from pyrogram import Client, filters, enums
17+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
318
from pyrogram.errors import UserNotParticipant
4-
from config import Rkn_Bots as Config
5-
from .database import insert
6-
7-
async def not_subscribed(_, client, message):
8-
user_id = int(message.from_user.id)
9-
await insert(user_id)
10-
if not Config.FORCE_SUB:
11-
return False
12-
13-
try:
14-
user = await client.get_chat_member(Config.FORCE_SUB, message.from_user.id)
15-
if user.status == enums.ChatMemberStatus.BANNED:
16-
return True
17-
else:
18-
return False
19+
from config import Rkn_Botz
20+
from .database import rkn_botz
21+
22+
# 🧠 Async callable filter class
23+
class ForceSubCheck:
24+
def __init__(self, channel: str):
25+
self.channel = channel.lstrip("@")
26+
27+
async def __call__(self, _, client: Client, message: Message) -> bool:
28+
user_id = message.from_user.id
29+
30+
# Register user in DB if not already
31+
await rkn_botz.register_user(user_id)
32+
33+
if not self.channel:
34+
return False # No force sub set
35+
36+
try:
37+
member = await client.get_chat_member(self.channel, user_id)
38+
return member.status in [enums.ChatMemberStatus.LEFT, enums.ChatMemberStatus.BANNED]
39+
except UserNotParticipant:
40+
return True
41+
except Exception:
42+
return False
43+
44+
45+
# πŸ“© Handler for blocked users / unsubscribed
46+
@Client.on_message(filters.private & filters.create(ForceSubCheck(Config.FORCE_SUB)))
47+
async def handle_force_sub(client: Client, message: Message):
48+
user_id = message.from_user.id
49+
chat_link = f"https://t.me/{Config.FORCE_SUB.lstrip('@')}"
50+
51+
# πŸ“’ Button UI
52+
button = InlineKeyboardMarkup(
53+
[[InlineKeyboardButton("πŸ”” Join Update Channel", url=chat_link)]]
54+
)
55+
56+
try:
57+
member = await client.get_chat_member(Config.FORCE_SUB, user_id)
58+
if member.status == enums.ChatMemberStatus.BANNED:
59+
return await message.reply_text(
60+
"**🚫 You are banned from using this bot.**\nContact admin if this is a mistake."
61+
)
1962
except UserNotParticipant:
2063
pass
21-
return True
64+
except Exception as e:
65+
return await message.reply_text(f"⚠️ Unexpected error: `{e}`")
2266

67+
# Default reply if not joined
68+
return await message.reply_text(
69+
"**Hey buddy! πŸ” You need to join our updates channel before using me.**",
70+
reply_markup=button
71+
)
72+
73+
# β€”β€”β€”β€”
74+
# End of file
75+
# Original author: @RknDeveloperr
76+
# GitHub: https://github.com/RknDeveloper
2377

24-
@Client.on_message(filters.private & filters.create(not_subscribed))
25-
async def forces_sub(client, message):
26-
buttons = [[InlineKeyboardButton(text="πŸ“’ Join Update Channel πŸ“’", url=f"https://t.me/{Config.FORCE_SUB}") ]]
27-
text = "**Sᴏʀʀy Dα΄œα΄…α΄‡ Yᴏᴜ'ʀᴇ Nᴏᴛ JᴏΙͺɴᴇᴅ My CΚœα΄€Ι΄Ι΄α΄‡ΚŸ 😐. Sᴏ PΚŸα΄‡α΄€κœ±α΄‡ 'JᴏΙͺΙ΄ Oα΄œΚ€ Uᴩᴅᴀᴛᴇ CΚœα΄€Ι΄Ι΄α΄‡ΚŸ' Tᴏ CᴄᴏɴᴛΙͺΙ΄α΄œα΄‡**"
28-
try:
29-
user = await client.get_chat_member(Config.FORCE_SUB, message.from_user.id)
30-
if user.status == enums.ChatMemberStatus.BANNED:
31-
return await client.send_message(message.from_user.id, text="Sᴏʀʀy Yᴏᴜ'ʀᴇ Bᴀɴɴᴇᴅ Tᴏ Uκœ±α΄‡ Mᴇ")
32-
elif user.status == enums.ChatMemberStatus.LEFT:
33-
return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons))
34-
except UserNotParticipant:
35-
return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons))
36-
return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons))
37-
78+
# Developer Contacts:
79+
# Telegram: @RknDeveloperr
80+
# Updates Channel: @Rkn_Bots_Updates & @Rkn_Botz
81+
# Special Thanks To: @ReshamOwner
82+
# Update Channels: @Digital_Botz & @DigitalBotz_Support
83+
84+
# ⚠️ Please do not remove this credit!

β€ŽRkn_Botz/__init__.pyβ€Ž

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# AutoCaptionBot by RknDeveloper
2+
# Copyright (c) 2024 RknDeveloper
3+
# Licensed under the MIT License
4+
# https://github.com/RknDeveloper/Rkn-AutoCaptionBot/blob/main/LICENSE
5+
# Please retain this credit when using or forking this code.
6+
7+
# Developer Contacts:
8+
# Telegram: @RknDeveloperr
9+
# Updates Channel: @Rkn_Bots_Updates & @Rkn_Botz
10+
# Special Thanks To: @ReshamOwner
11+
# Update Channels: @Digital_Botz & @DigitalBotz_Support
12+
13+
# ⚠️ Please do not remove this credit!
14+
15+
__name__ = "Rkn-AutoCaptionBot"
16+
__version__ = "1.0.0"
17+
__license__ = "MIT License"
18+
__copyright__ = "Copyright (C) 2024-present Rkn Developer <https://github.com/RknDeveloper>"
19+
__programmer__ = "<a href=https://github.com/RknDeveloper/Rkn-AutoCaptionBot>AutoCaptionBot</a>"
20+
__library__ = "<a href=https://github.com/pyrogram>Pyʀᴏɒʀᴀᴍ</a>"
21+
__language__ = "<a href=https://www.python.org/>Pyα΄›Κœα΄Ι΄</a>"
22+
__database__ = "<a href=https://cloud.mongodb.com/>Mᴏɴɒᴏ DB</a>"
23+
__developer__ = "<a href=https://t.me/Digital_Botz>Digital Botz</a>"
24+
__maindeveloper__ = "<a href=https://t.me/Rkn_Bots_Updates>Rkn Developer</a>"
25+
26+
# main copyright herders (©️)
27+
# I have been working on this repo since 2024
28+
29+
"""
30+
πŸ“ Rkn-AutoCaptionBot-main/
31+
β”œβ”€β”€ 🐍 Python Files/
32+
β”‚ β”œβ”€β”€ πŸ“„ bot.py
33+
β”‚ β”œβ”€β”€ πŸ“„ config.py
34+
β”‚ └── πŸ“ Rkn_Botz/
35+
β”‚ β”œβ”€β”€ πŸ“„ __init__.py
36+
β”‚ β”œβ”€β”€ πŸ“„ caption.py
37+
β”‚ β”œβ”€β”€ πŸ“„ database.py
38+
β”‚ β”œβ”€β”€ πŸ“„ Force_Sub.py
39+
β”‚ └── πŸ“„ web_support.py
40+
β”‚
41+
β”œβ”€β”€ πŸ“„ Documentation/
42+
β”‚ β”œβ”€β”€ πŸ“˜ README.md
43+
β”‚ β”œβ”€β”€ πŸ“¦ requirements.txt
44+
β”‚ └── πŸ§ͺ runtime.txt
45+
β”‚
46+
β”œβ”€β”€ βš™οΈ Configuration Files/
47+
β”‚ β”œβ”€β”€ 🧾 app.json
48+
β”‚ └── πŸ“‘ render.yaml
49+
β”‚
50+
β”œβ”€β”€ πŸ› οΈ Other Files/
51+
β”‚ β”œβ”€β”€ 🐳 Dockerfile
52+
β”‚ β”œβ”€β”€ πŸ“œ LICENSE
53+
β”‚ └── πŸš€ Procfile
54+
"""
55+
56+
# β€”β€”β€”β€”
57+
# End of file
58+
# Original author: @RknDeveloperr
59+
# GitHub: https://github.com/RknDeveloper
60+
61+
# Developer Contacts:
62+
# Telegram: @RknDeveloperr
63+
# Updates Channel: @Rkn_Bots_Updates & @Rkn_Botz
64+
# Special Thanks To: @ReshamOwner
65+
# Update Channels: @Digital_Botz & @DigitalBotz_Support
66+
67+
# ⚠️ Please do not remove this credit!

0 commit comments

Comments
Β (0)