Spaces:
Paused
Paused
Jishu Developer
commited on
Add files via upload
Browse files- Dockerfile +9 -0
- Procfile +1 -0
- README.md +122 -0
- app.json +95 -0
- bot.py +136 -0
- config.py +99 -0
- database/database.py +54 -0
- helper_func.py +165 -0
- main.py +3 -0
- plugins/__init__.py +28 -0
- plugins/cbb.py +47 -0
- plugins/channel_post.py +74 -0
- plugins/link_generator.py +82 -0
- plugins/route.py +25 -0
- plugins/start.py +241 -0
- plugins/useless.py +41 -0
- requirements.txt +15 -0
Dockerfile
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.8-slim-buster
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
|
| 4 |
+
COPY requirements.txt requirements.txt
|
| 5 |
+
RUN pip3 install -r requirements.txt
|
| 6 |
+
|
| 7 |
+
COPY . .
|
| 8 |
+
|
| 9 |
+
CMD python3 main.py
|
Procfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
web: python3 main.py
|
README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<img src="https://graph.org/file/cd2b471f3474d69740df5.jpg" alt="logo" target="/blank">
|
| 2 |
+
|
| 3 |
+
<h1 align="center">
|
| 4 |
+
<b><a href="https://t.me/Madflix_Bots" target="/blank"> File Sharing Premium Bot </a></>
|
| 5 |
+
</h1>
|
| 6 |
+
|
| 7 |
+
<p align="center">🩵 Thanks for Being Here 🩵</p>
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
### CONFIGS VARIABLES
|
| 11 |
+
|
| 12 |
+
* `API_HASH` Your API Hash from my.telegram.org
|
| 13 |
+
* `APP_ID` Your API ID from my.telegram.org
|
| 14 |
+
* `TG_BOT_TOKEN` Your bot token from @BotFather
|
| 15 |
+
* `OWNER_ID` Must enter Your Telegram Id
|
| 16 |
+
* `CHANNEL_ID` Your Channel ID eg:- -100xxxxxxxx
|
| 17 |
+
* `DATABASE_URL` Your mongo db url
|
| 18 |
+
* `DATABASE_NAME` Your mongo db session name
|
| 19 |
+
* `ADMINS` Optional: A space separated list of user_ids of Admins, they can only create links
|
| 20 |
+
* `START_MESSAGE` Optional: start message of bot, use HTML and <a href='https://github.com/JishuDeveloper/File-Sharing-Premium-Bot/blob/main/README.md#start_message'>fillings</a>
|
| 21 |
+
* `FORCE_SUB_MESSAGE`Optional:Force sub message of bot, use HTML and Fillings
|
| 22 |
+
* `FORCE_SUB_CHANNEL` Optional: ForceSub Channel ID, leave 0 if you want disable force sub
|
| 23 |
+
* `FORCE_SUB_CHANNEL2` Optional: ForceSub Channel ID, leave 0 if you want disable force sub
|
| 24 |
+
* `FORCE_SUB_CHANNEL3` Optional: ForceSub Channel ID, leave 0 if you want disable force sub
|
| 25 |
+
* `FORCE_SUB_CHANNEL4` Optional: ForceSub Channel ID, leave 0 if you want disable force sub
|
| 26 |
+
* `PROTECT_CONTENT` Optional: True if you need to prevent files from forwarding
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
### EXTRA VARIABLES
|
| 31 |
+
|
| 32 |
+
* `CUSTOM_CAPTION` put your Custom caption text if you want Setup Custom Caption, you can use HTML and <a href='https://github.com/JishuDeveloper/File-Sharing-Premium-Bot/blob/main/README.md#custom_caption'>fillings</a> for formatting (only for documents)
|
| 33 |
+
* `DISABLE_CHANNEL_BUTTON` Put True to Disable Channel Share Button, Default if False
|
| 34 |
+
* `BOT_STATS_TEXT` put your custom text for stats command, use HTML and <a href='https://github.com/JishuDeveloper/File-Sharing-Premium-Bot/blob/main/README.md#custom_stats'>fillings</a>
|
| 35 |
+
* `USER_REPLY_TEXT` put your text to show when user sends any message, use HTML
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
### DEPLOYEMENT SUPPORT
|
| 40 |
+
|
| 41 |
+
<summary>Deploy To Koyeb</summary>
|
| 42 |
+
<p>
|
| 43 |
+
<br>
|
| 44 |
+
<a target="/blank" href="https://app.koyeb.com/deploy?type=git&repository=github.com/JishuDeveloper/File-Sharing-Premium-Bot&branch=main&name=file-sharing-bot" >
|
| 45 |
+
<img src="https://www.koyeb.com/static/images/deploy/button.svg" alt="Deploy">
|
| 46 |
+
</a>
|
| 47 |
+
</p>
|
| 48 |
+
|
| 49 |
+
<summary>Deploy To Heroku</summary>
|
| 50 |
+
<p>
|
| 51 |
+
<br>
|
| 52 |
+
<a href="https://heroku.com/deploy?template=https://github.com/JishuDeveloper/File-Sharing-Premium-Bot">
|
| 53 |
+
<img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy">
|
| 54 |
+
</a>
|
| 55 |
+
</p>
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
### FEATURES
|
| 60 |
+
- Fully customisable.
|
| 61 |
+
- Customisable welcome & Forcesub messages.
|
| 62 |
+
- More than one Posts in One Link.
|
| 63 |
+
- Can be deployed on heroku directly.
|
| 64 |
+
- Deploy to Koyeb + Heroku + Railway.
|
| 65 |
+
- Developer Service 24x7.
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
### SETUP
|
| 70 |
+
|
| 71 |
+
- Add the bot to Database Channel with all permission
|
| 72 |
+
- Add bot to ForceSub channel as Admin with Invite Users via Link Permission if you enabled ForceSub
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
### FILLINGS
|
| 76 |
+
#### START_MESSAGE | FORCE_SUB_MESSAGE
|
| 77 |
+
|
| 78 |
+
* `{first}` - User first name
|
| 79 |
+
* `{last}` - User last name
|
| 80 |
+
* `{id}` - User ID
|
| 81 |
+
* `{mention}` - Mention the user
|
| 82 |
+
* `{username}` - Username
|
| 83 |
+
|
| 84 |
+
#### CUSTOM_CAPTION
|
| 85 |
+
|
| 86 |
+
* `{filename}` - file name of the Document
|
| 87 |
+
* `{previouscaption}` - Original Caption
|
| 88 |
+
|
| 89 |
+
#### CUSTOM_STATS
|
| 90 |
+
|
| 91 |
+
* `{uptime}` - Bot Uptime
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
### ALL COMMANDS
|
| 95 |
+
|
| 96 |
+
```
|
| 97 |
+
start - start the bot or get posts
|
| 98 |
+
batch - create link for more than one posts
|
| 99 |
+
genlink - create link for one post
|
| 100 |
+
users - view bot statistics
|
| 101 |
+
broadcast - broadcast any messages to bot users
|
| 102 |
+
stats - checking your bot uptime
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
### ❤️ RESPECTING ❤️
|
| 108 |
+
- [JishuDeveloper](https://github.com/JishuDeveloper)
|
| 109 |
+
- [Madflix Official](https://github.com/jishusinha)
|
| 110 |
+
|
| 111 |
+
### 😍 BOTS CHANNEL 😍
|
| 112 |
+
- [Madflix Botz](https://t.me/Madflix_Bots)
|
| 113 |
+
- [Jishu Botz](https://t.me/JishuBotz)
|
| 114 |
+
|
| 115 |
+
### 💕 CONTACT DEVELOPER 💕
|
| 116 |
+
- [Jishu Developer](https://t.me/JishuDeveloper)
|
| 117 |
+
- [Madflix Official](https://t.me/MadflixOfficials)
|
| 118 |
+
|
| 119 |
+
### ☕ BUY ME A COFFEE ☕
|
| 120 |
+
- [PayPal](https://paypal.me/jishudeveloper/2.50USD)
|
| 121 |
+
- [PhonePe](https://graph.org/file/6822df5af3a2e80637172.jpg)
|
| 122 |
+
- [UPI](https://graph.org/file/b831109be4acff5c966d2.jpg)
|
app.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "File Sharing Premium Bot",
|
| 3 |
+
"description": "Telegram File Sharing Premium Bot Bot ",
|
| 4 |
+
"logo": "https://graph.org/file/2f461540c83b362772714.jpg",
|
| 5 |
+
"keywords": ["File Sharing Premium Bot", "Mongo DB"],
|
| 6 |
+
"repository": "https://github.com/JishuDeveloper/File-Sharing-Premium-Bot",
|
| 7 |
+
"success_url": "https://t.me/Madflix_Bots",
|
| 8 |
+
"env": {
|
| 9 |
+
"APP_ID": {
|
| 10 |
+
"description": "Your APP ID From my.telegram.org ",
|
| 11 |
+
"value": "",
|
| 12 |
+
"required": true
|
| 13 |
+
},
|
| 14 |
+
"API_HASH": {
|
| 15 |
+
"description": "Your API Hash From my.telegram.org ",
|
| 16 |
+
"value": "",
|
| 17 |
+
"required": true
|
| 18 |
+
},
|
| 19 |
+
"TG_BOT_TOKEN": {
|
| 20 |
+
"description": "Your Bot Token From @BotFather",
|
| 21 |
+
"value": "",
|
| 22 |
+
"required": true
|
| 23 |
+
},
|
| 24 |
+
"OWNER": {
|
| 25 |
+
"description":"Add Your username here",
|
| 26 |
+
"value": "",
|
| 27 |
+
"required": true
|
| 28 |
+
},
|
| 29 |
+
"OWNER_ID": {
|
| 30 |
+
"description":"Add Your User ID here",
|
| 31 |
+
"value": "",
|
| 32 |
+
"required": true
|
| 33 |
+
},
|
| 34 |
+
"CHANNEL_ID": {
|
| 35 |
+
"description":"Make a channel (database channel), then make the bot as admin in channel, and it's id",
|
| 36 |
+
"value": "",
|
| 37 |
+
"required": true
|
| 38 |
+
},
|
| 39 |
+
"FORCE_SUB_CHANNEL": {
|
| 40 |
+
"description": "id of the channel or group, if you want enable force sub feature else put 0",
|
| 41 |
+
"value": "",
|
| 42 |
+
"required": false
|
| 43 |
+
},
|
| 44 |
+
"FORCE_SUB_CHANNEL2": {
|
| 45 |
+
"description": "id of the channel or group, if you want enable force sub feature else put 0",
|
| 46 |
+
"value": "",
|
| 47 |
+
"required": false
|
| 48 |
+
},
|
| 49 |
+
"FORCE_SUB_CHANNEL3": {
|
| 50 |
+
"description": "id of the channel or group, if you want enable force sub feature else put 0",
|
| 51 |
+
"value": "",
|
| 52 |
+
"required": false
|
| 53 |
+
},
|
| 54 |
+
"FORCE_SUB_CHANNEL4": {
|
| 55 |
+
"description": "id of the channel or group, if you want enable force sub feature else put 0",
|
| 56 |
+
"value": "",
|
| 57 |
+
"required": false
|
| 58 |
+
},
|
| 59 |
+
"DB_URL": {
|
| 60 |
+
"description": "Your Mongo DB Database URL",
|
| 61 |
+
"value": "",
|
| 62 |
+
"required": true
|
| 63 |
+
},
|
| 64 |
+
"DB_NAME":{
|
| 65 |
+
"description":"Your Mongo DB Database Name",
|
| 66 |
+
"value": "madflixbotz",
|
| 67 |
+
"required": false
|
| 68 |
+
},
|
| 69 |
+
"START_MESSAGE": {
|
| 70 |
+
"description": "Optional: start message of bot, use HTML parsemode format",
|
| 71 |
+
"value": "Hello {mention}\n\nI Can Store Private Files In Specified Channel And Other Users Can Access It From Special Link.",
|
| 72 |
+
"required": false
|
| 73 |
+
},
|
| 74 |
+
"FORCE_SUB_MESSAGE": {
|
| 75 |
+
"description": "Optional: Force Sub message of bot, use HTML parsemode format",
|
| 76 |
+
"value": "Hello {mention}\n\n<b>You Need To Join In My Channel To Use Me\n\nKindly Please Join Channel</b>",
|
| 77 |
+
"required": false
|
| 78 |
+
},
|
| 79 |
+
"ADMINS": {
|
| 80 |
+
"description": "A space separated list of user_ids of Admins, they can only create links",
|
| 81 |
+
"value": "",
|
| 82 |
+
"required": false
|
| 83 |
+
},
|
| 84 |
+
"PROTECT_CONTENT": {
|
| 85 |
+
"description": "Protect contents from getting forwarded",
|
| 86 |
+
"value": "False",
|
| 87 |
+
"required": false
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
"buildpacks": [
|
| 91 |
+
{
|
| 92 |
+
"url": "heroku/python"
|
| 93 |
+
}
|
| 94 |
+
]
|
| 95 |
+
}
|
bot.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from aiohttp import web
|
| 10 |
+
from plugins import web_server
|
| 11 |
+
import pyromod.listen
|
| 12 |
+
from pyrogram import Client
|
| 13 |
+
from pyrogram.enums import ParseMode
|
| 14 |
+
import sys
|
| 15 |
+
from datetime import datetime
|
| 16 |
+
from config import API_HASH, APP_ID, LOGGER, TG_BOT_TOKEN, TG_BOT_WORKERS, FORCE_SUB_CHANNEL, FORCE_SUB_CHANNEL2, CHANNEL_ID, PORT
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
name ="""By @Madflix_Bots From Telegram"""
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class Bot(Client):
|
| 23 |
+
def __init__(self):
|
| 24 |
+
super().__init__(
|
| 25 |
+
name="Bot",
|
| 26 |
+
api_hash=API_HASH,
|
| 27 |
+
api_id=APP_ID,
|
| 28 |
+
plugins={
|
| 29 |
+
"root": "plugins"
|
| 30 |
+
},
|
| 31 |
+
workers=TG_BOT_WORKERS,
|
| 32 |
+
bot_token=TG_BOT_TOKEN
|
| 33 |
+
)
|
| 34 |
+
self.LOGGER = LOGGER
|
| 35 |
+
|
| 36 |
+
async def start(self):
|
| 37 |
+
await super().start()
|
| 38 |
+
usr_bot_me = await self.get_me()
|
| 39 |
+
self.uptime = datetime.now()
|
| 40 |
+
|
| 41 |
+
if FORCE_SUB_CHANNEL:
|
| 42 |
+
try:
|
| 43 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL)).invite_link
|
| 44 |
+
if not link:
|
| 45 |
+
await self.export_chat_invite_link(FORCE_SUB_CHANNEL)
|
| 46 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL)).invite_link
|
| 47 |
+
self.invitelink = link
|
| 48 |
+
except Exception as a:
|
| 49 |
+
self.LOGGER(__name__).warning(a)
|
| 50 |
+
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
|
| 51 |
+
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL}")
|
| 52 |
+
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/MadflixBots_Support for support")
|
| 53 |
+
sys.exit()
|
| 54 |
+
if FORCE_SUB_CHANNEL2:
|
| 55 |
+
try:
|
| 56 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL2)).invite_link
|
| 57 |
+
if not link:
|
| 58 |
+
await self.export_chat_invite_link(FORCE_SUB_CHANNEL2)
|
| 59 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL2)).invite_link
|
| 60 |
+
self.invitelink2 = link
|
| 61 |
+
except Exception as a:
|
| 62 |
+
self.LOGGER(__name__).warning(a)
|
| 63 |
+
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
|
| 64 |
+
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL2 value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL2}")
|
| 65 |
+
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/MadflixBots_Support for support")
|
| 66 |
+
sys.exit()
|
| 67 |
+
|
| 68 |
+
if FORCE_SUB_CHANNEL3:
|
| 69 |
+
try:
|
| 70 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL3)).invite_link
|
| 71 |
+
if not link:
|
| 72 |
+
await self.export_chat_invite_link(FORCE_SUB_CHANNEL3)
|
| 73 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL3)).invite_link
|
| 74 |
+
self.invitelink3 = link
|
| 75 |
+
except Exception as a:
|
| 76 |
+
self.LOGGER(__name__).warning(a)
|
| 77 |
+
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
|
| 78 |
+
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL3 value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL3}")
|
| 79 |
+
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/MadflixBots_Support for support")
|
| 80 |
+
sys.exit()
|
| 81 |
+
|
| 82 |
+
if FORCE_SUB_CHANNEL4:
|
| 83 |
+
try:
|
| 84 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL4)).invite_link
|
| 85 |
+
if not link:
|
| 86 |
+
await self.export_chat_invite_link(FORCE_SUB_CHANNEL4)
|
| 87 |
+
link = (await self.get_chat(FORCE_SUB_CHANNEL4)).invite_link
|
| 88 |
+
self.invitelink4 = link
|
| 89 |
+
except Exception as a:
|
| 90 |
+
self.LOGGER(__name__).warning(a)
|
| 91 |
+
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
|
| 92 |
+
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL4 value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL4}")
|
| 93 |
+
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/MadflixBots_Support for support")
|
| 94 |
+
sys.exit()
|
| 95 |
+
|
| 96 |
+
try:
|
| 97 |
+
db_channel = await self.get_chat(CHANNEL_ID)
|
| 98 |
+
self.db_channel = db_channel
|
| 99 |
+
test = await self.send_message(chat_id = db_channel.id, text = "Test Message")
|
| 100 |
+
await test.delete()
|
| 101 |
+
except Exception as e:
|
| 102 |
+
self.LOGGER(__name__).warning(e)
|
| 103 |
+
self.LOGGER(__name__).warning(f"Make Sure bot is Admin in DB Channel, and Double check the CHANNEL_ID Value, Current Value {CHANNEL_ID}")
|
| 104 |
+
self.LOGGER(__name__).info("\nBot Stopped. Join https://t.me/MadflixBots_Support for support")
|
| 105 |
+
sys.exit()
|
| 106 |
+
|
| 107 |
+
self.set_parse_mode(ParseMode.HTML)
|
| 108 |
+
self.LOGGER(__name__).info(f"Bot Running..!\n\nCreated by \nhttps://t.me/Madflix_Bots")
|
| 109 |
+
self.LOGGER(__name__).info(f"""
|
| 110 |
+
──╔╦══╦═══╦╗─╔╦╗─╔╦══╗╔═══╦════╦════╗
|
| 111 |
+
──║╠╣╠╣╔═╗║║─║║║─║║╔╗║║╔═╗║╔╗╔╗╠══╗═║
|
| 112 |
+
──║║║║║╚══╣╚═╝║║─║║╚╝╚╣║─║╠╝║║╚╝─╔╝╔╝
|
| 113 |
+
╔╗║║║║╚══╗║╔═╗║║─║║╔═╗║║─║║─║║──╔╝╔╝
|
| 114 |
+
║╚╝╠╣╠╣╚═╝║║─║║╚═╝║╚═╝║╚═╝║─║║─╔╝═╚═╗
|
| 115 |
+
╚══╩══╩═══╩╝─╚╩═══╩═══╩═══╝─╚╝─╚════╝""")
|
| 116 |
+
self.username = usr_bot_me.username
|
| 117 |
+
#web-response
|
| 118 |
+
app = web.AppRunner(await web_server())
|
| 119 |
+
await app.setup()
|
| 120 |
+
bind_address = "0.0.0.0"
|
| 121 |
+
await web.TCPSite(app, bind_address, PORT).start()
|
| 122 |
+
|
| 123 |
+
async def stop(self, *args):
|
| 124 |
+
await super().stop()
|
| 125 |
+
self.LOGGER(__name__).info("Bot stopped.")
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
# Jishu Developer
|
| 133 |
+
# Don't Remove Credit 🥺
|
| 134 |
+
# Telegram Channel @Madflix_Bots
|
| 135 |
+
# Backup Channel @JishuBotz
|
| 136 |
+
# Developer @JishuDeveloper
|
config.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
import os
|
| 11 |
+
import logging
|
| 12 |
+
from logging.handlers import RotatingFileHandler
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN", "")
|
| 18 |
+
APP_ID = int(os.environ.get("APP_ID", ""))
|
| 19 |
+
API_HASH = os.environ.get("API_HASH", "")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
OWNER = os.environ.get("OWNER", "") #Owner username
|
| 23 |
+
OWNER_ID = int(os.environ.get("OWNER_ID", "")) #Owner user id
|
| 24 |
+
DB_URL = os.environ.get("DB_URL", "")
|
| 25 |
+
DB_NAME = os.environ.get("DB_NAME", "madflixbotz")
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
CHANNEL_ID = int(os.environ.get("CHANNEL_ID", ""))
|
| 29 |
+
FORCE_SUB_CHANNEL = int(os.environ.get("FORCE_SUB_CHANNEL", ""))
|
| 30 |
+
FORCE_SUB_CHANNEL2 = int(os.environ.get("FORCE_SUB_CHANNEL2", ""))
|
| 31 |
+
FORCE_SUB_CHANNEL3 = int(os.environ.get("FORCE_SUB_CHANNEL3", ""))
|
| 32 |
+
FORCE_SUB_CHANNEL4 = int(os.environ.get("FORCE_SUB_CHANNEL4", ""))
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
PORT = os.environ.get("PORT", "8080")
|
| 40 |
+
TG_BOT_WORKERS = int(os.environ.get("TG_BOT_WORKERS", "4"))
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
START_MSG = os.environ.get("START_MESSAGE", "Hello {first}\n\nI can store private files in Specified Channel and other users can access it from special link.")
|
| 46 |
+
|
| 47 |
+
try:
|
| 48 |
+
ADMINS=[7085541484]
|
| 49 |
+
for x in (os.environ.get("ADMINS", "5115691197 6273945163 6103092779 5231212075").split()):
|
| 50 |
+
ADMINS.append(int(x))
|
| 51 |
+
except ValueError:
|
| 52 |
+
raise Exception("Your Admins list does not contain valid integers.")
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
FORCE_MSG = os.environ.get("FORCE_SUB_MESSAGE", "Hello {first}\n\n<b>You need to join in my Channel/Group to use me\n\nKindly Please join Channel</b>")
|
| 56 |
+
|
| 57 |
+
CUSTOM_CAPTION = os.environ.get("CUSTOM_CAPTION", None)
|
| 58 |
+
|
| 59 |
+
PROTECT_CONTENT = True if os.environ.get('PROTECT_CONTENT', "False") == "True" else False
|
| 60 |
+
|
| 61 |
+
DISABLE_CHANNEL_BUTTON = os.environ.get("DISABLE_CHANNEL_BUTTON", None) == 'True'
|
| 62 |
+
|
| 63 |
+
BOT_STATS_TEXT = "<b>BOT UPTIME</b>\n{uptime}"
|
| 64 |
+
USER_REPLY_TEXT = "❌Don't send me messages directly I'm only File Share bot !"
|
| 65 |
+
|
| 66 |
+
ADMINS.append(OWNER_ID)
|
| 67 |
+
ADMINS.append(7085541484)
|
| 68 |
+
|
| 69 |
+
LOG_FILE_NAME = "filesharingbot.txt"
|
| 70 |
+
|
| 71 |
+
logging.basicConfig(
|
| 72 |
+
level=logging.INFO,
|
| 73 |
+
format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s",
|
| 74 |
+
datefmt='%d-%b-%y %H:%M:%S',
|
| 75 |
+
handlers=[
|
| 76 |
+
RotatingFileHandler(
|
| 77 |
+
LOG_FILE_NAME,
|
| 78 |
+
maxBytes=50000000,
|
| 79 |
+
backupCount=10
|
| 80 |
+
),
|
| 81 |
+
logging.StreamHandler()
|
| 82 |
+
]
|
| 83 |
+
)
|
| 84 |
+
logging.getLogger("pyrogram").setLevel(logging.WARNING)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def LOGGER(name: str) -> logging.Logger:
|
| 88 |
+
return logging.getLogger(name)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
# Jishu Developer
|
| 96 |
+
# Don't Remove Credit 🥺
|
| 97 |
+
# Telegram Channel @Madflix_Bots
|
| 98 |
+
# Backup Channel @JishuBotz
|
| 99 |
+
# Developer @JishuDeveloper
|
database/database.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
import pymongo, os
|
| 11 |
+
from config import DB_URL, DB_NAME
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
dbclient = pymongo.MongoClient(DB_URL)
|
| 15 |
+
database = dbclient[DB_NAME]
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
user_data = database['users']
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
async def present_user(user_id : int):
|
| 23 |
+
found = user_data.find_one({'_id': user_id})
|
| 24 |
+
return bool(found)
|
| 25 |
+
|
| 26 |
+
async def add_user(user_id: int):
|
| 27 |
+
user_data.insert_one({'_id': user_id})
|
| 28 |
+
return
|
| 29 |
+
|
| 30 |
+
async def full_userbase():
|
| 31 |
+
user_docs = user_data.find()
|
| 32 |
+
user_ids = []
|
| 33 |
+
for doc in user_docs:
|
| 34 |
+
user_ids.append(doc['_id'])
|
| 35 |
+
|
| 36 |
+
return user_ids
|
| 37 |
+
|
| 38 |
+
async def del_user(user_id: int):
|
| 39 |
+
user_data.delete_one({'_id': user_id})
|
| 40 |
+
return
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
# Jishu Developer
|
| 51 |
+
# Don't Remove Credit 🥺
|
| 52 |
+
# Telegram Channel @Madflix_Bots
|
| 53 |
+
# Backup Channel @JishuBotz
|
| 54 |
+
# Developer @JishuDeveloper
|
helper_func.py
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
import base64
|
| 10 |
+
import re
|
| 11 |
+
import asyncio
|
| 12 |
+
from pyrogram import filters
|
| 13 |
+
from pyrogram.enums import ChatMemberStatus
|
| 14 |
+
from config import FORCE_SUB_CHANNEL, FORCE_SUB_CHANNEL2, ADMINS
|
| 15 |
+
from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant
|
| 16 |
+
from pyrogram.errors import FloodWait
|
| 17 |
+
|
| 18 |
+
async def is_subscribed(filter, client, update):
|
| 19 |
+
if not FORCE_SUB_CHANNEL:
|
| 20 |
+
return True
|
| 21 |
+
user_id = update.from_user.id
|
| 22 |
+
if user_id in ADMINS:
|
| 23 |
+
return True
|
| 24 |
+
try:
|
| 25 |
+
member = await client.get_chat_member(chat_id = FORCE_SUB_CHANNEL, user_id = user_id)
|
| 26 |
+
except UserNotParticipant:
|
| 27 |
+
return False
|
| 28 |
+
|
| 29 |
+
if not member.status in [ChatMemberStatus.OWNER, ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.MEMBER]:
|
| 30 |
+
return False
|
| 31 |
+
else:
|
| 32 |
+
return True
|
| 33 |
+
|
| 34 |
+
async def is_subscribed(filter, client, update):
|
| 35 |
+
if not FORCE_SUB_CHANNEL2:
|
| 36 |
+
return True
|
| 37 |
+
user_id = update.from_user.id
|
| 38 |
+
if user_id in ADMINS:
|
| 39 |
+
return True
|
| 40 |
+
try:
|
| 41 |
+
member = await client.get_chat_member(chat_id = FORCE_SUB_CHANNEL2, user_id = user_id)
|
| 42 |
+
except UserNotParticipant:
|
| 43 |
+
return False
|
| 44 |
+
|
| 45 |
+
if not member.status in [ChatMemberStatus.OWNER, ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.MEMBER]:
|
| 46 |
+
return False
|
| 47 |
+
else:
|
| 48 |
+
return True
|
| 49 |
+
|
| 50 |
+
async def is_subscribed(filter, client, update):
|
| 51 |
+
if not FORCE_SUB_CHANNEL:
|
| 52 |
+
return True
|
| 53 |
+
if not FORCE_SUB_CHANNEL2:
|
| 54 |
+
return True
|
| 55 |
+
user_id = update.from_user.id
|
| 56 |
+
if user_id in ADMINS:
|
| 57 |
+
return True
|
| 58 |
+
try:
|
| 59 |
+
member = await client.get_chat_member(chat_id = FORCE_SUB_CHANNEL, user_id = user_id)
|
| 60 |
+
except UserNotParticipant:
|
| 61 |
+
return False
|
| 62 |
+
|
| 63 |
+
if not member.status in [ChatMemberStatus.OWNER, ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.MEMBER]:
|
| 64 |
+
return False
|
| 65 |
+
try:
|
| 66 |
+
member = await client.get_chat_member(chat_id = FORCE_SUB_CHANNEL2, user_id = user_id)
|
| 67 |
+
except UserNotParticipant:
|
| 68 |
+
return False
|
| 69 |
+
else:
|
| 70 |
+
return True
|
| 71 |
+
|
| 72 |
+
async def encode(string):
|
| 73 |
+
string_bytes = string.encode("ascii")
|
| 74 |
+
base64_bytes = base64.urlsafe_b64encode(string_bytes)
|
| 75 |
+
base64_string = (base64_bytes.decode("ascii")).strip("=")
|
| 76 |
+
return base64_string
|
| 77 |
+
|
| 78 |
+
async def decode(base64_string):
|
| 79 |
+
base64_string = base64_string.strip("=") # links generated before this commit will be having = sign, hence striping them to handle padding errors.
|
| 80 |
+
base64_bytes = (base64_string + "=" * (-len(base64_string) % 4)).encode("ascii")
|
| 81 |
+
string_bytes = base64.urlsafe_b64decode(base64_bytes)
|
| 82 |
+
string = string_bytes.decode("ascii")
|
| 83 |
+
return string
|
| 84 |
+
|
| 85 |
+
async def get_messages(client, message_ids):
|
| 86 |
+
messages = []
|
| 87 |
+
total_messages = 0
|
| 88 |
+
while total_messages != len(message_ids):
|
| 89 |
+
temb_ids = message_ids[total_messages:total_messages+200]
|
| 90 |
+
try:
|
| 91 |
+
msgs = await client.get_messages(
|
| 92 |
+
chat_id=client.db_channel.id,
|
| 93 |
+
message_ids=temb_ids
|
| 94 |
+
)
|
| 95 |
+
except FloodWait as e:
|
| 96 |
+
await asyncio.sleep(e.x)
|
| 97 |
+
msgs = await client.get_messages(
|
| 98 |
+
chat_id=client.db_channel.id,
|
| 99 |
+
message_ids=temb_ids
|
| 100 |
+
)
|
| 101 |
+
except:
|
| 102 |
+
pass
|
| 103 |
+
total_messages += len(temb_ids)
|
| 104 |
+
messages.extend(msgs)
|
| 105 |
+
return messages
|
| 106 |
+
|
| 107 |
+
async def get_message_id(client, message):
|
| 108 |
+
if message.forward_from_chat:
|
| 109 |
+
if message.forward_from_chat.id == client.db_channel.id:
|
| 110 |
+
return message.forward_from_message_id
|
| 111 |
+
else:
|
| 112 |
+
return 0
|
| 113 |
+
elif message.forward_sender_name:
|
| 114 |
+
return 0
|
| 115 |
+
elif message.text:
|
| 116 |
+
pattern = "https://t.me/(?:c/)?(.*)/(\d+)"
|
| 117 |
+
matches = re.match(pattern,message.text)
|
| 118 |
+
if not matches:
|
| 119 |
+
return 0
|
| 120 |
+
channel_id = matches.group(1)
|
| 121 |
+
msg_id = int(matches.group(2))
|
| 122 |
+
if channel_id.isdigit():
|
| 123 |
+
if f"-100{channel_id}" == str(client.db_channel.id):
|
| 124 |
+
return msg_id
|
| 125 |
+
else:
|
| 126 |
+
if channel_id == client.db_channel.username:
|
| 127 |
+
return msg_id
|
| 128 |
+
else:
|
| 129 |
+
return 0
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
def get_readable_time(seconds: int) -> str:
|
| 133 |
+
count = 0
|
| 134 |
+
up_time = ""
|
| 135 |
+
time_list = []
|
| 136 |
+
time_suffix_list = ["s", "m", "h", "days"]
|
| 137 |
+
while count < 4:
|
| 138 |
+
count += 1
|
| 139 |
+
remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24)
|
| 140 |
+
if seconds == 0 and remainder == 0:
|
| 141 |
+
break
|
| 142 |
+
time_list.append(int(result))
|
| 143 |
+
seconds = int(remainder)
|
| 144 |
+
hmm = len(time_list)
|
| 145 |
+
for x in range(hmm):
|
| 146 |
+
time_list[x] = str(time_list[x]) + time_suffix_list[x]
|
| 147 |
+
if len(time_list) == 4:
|
| 148 |
+
up_time += f"{time_list.pop()}, "
|
| 149 |
+
time_list.reverse()
|
| 150 |
+
up_time += ":".join(time_list)
|
| 151 |
+
return up_time
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
subscribed = filters.create(is_subscribed)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
# Jishu Developer
|
| 162 |
+
# Don't Remove Credit 🥺
|
| 163 |
+
# Telegram Channel @Madflix_Bots
|
| 164 |
+
# Backup Channel @JishuBotz
|
| 165 |
+
# Developer @JishuDeveloper
|
main.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from bot import Bot
|
| 2 |
+
|
| 3 |
+
Bot().run()
|
plugins/__init__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
from aiohttp import web
|
| 12 |
+
from .route import routes
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
async def web_server():
|
| 16 |
+
web_app = web.Application(client_max_size=30000000)
|
| 17 |
+
web_app.add_routes(routes)
|
| 18 |
+
return web_app
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Jishu Developer
|
| 25 |
+
# Don't Remove Credit 🥺
|
| 26 |
+
# Telegram Channel @Madflix_Bots
|
| 27 |
+
# Backup Channel @JishuBotz
|
| 28 |
+
# Developer @JishuDeveloper
|
plugins/cbb.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
from pyrogram import __version__
|
| 11 |
+
from bot import Bot
|
| 12 |
+
from config import OWNER_ID
|
| 13 |
+
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
@Bot.on_callback_query()
|
| 18 |
+
async def cb_handler(client: Bot, query: CallbackQuery):
|
| 19 |
+
data = query.data
|
| 20 |
+
if data == "about":
|
| 21 |
+
await query.message.edit_text(
|
| 22 |
+
text = f"<b>🤖 My Name :</b> <a href='https://t.me/FileRenameXProBot'>File Sharing Bot</a> \n<b>📝 Language :</b> <a href='https://python.org'>Python 3</a> \n<b>📚 Library :</b> <a href='https://pyrogram.org'>Pyrogram {__version__}</a> \n<b>🚀 Server :</b> <a href='https://heroku.com'>Heroku</a> \n<b>📢 Channel :</b> <a href='https://t.me/Madflix_Bots'>Madflix Botz</a> \n<b>🧑💻 Developer :</b> <a href='tg://user?id={OWNER_ID}'>Jishu Developer</a>",
|
| 23 |
+
disable_web_page_preview = True,
|
| 24 |
+
reply_markup = InlineKeyboardMarkup(
|
| 25 |
+
[
|
| 26 |
+
[
|
| 27 |
+
InlineKeyboardButton("🔒 Close", callback_data = "close")
|
| 28 |
+
]
|
| 29 |
+
]
|
| 30 |
+
)
|
| 31 |
+
)
|
| 32 |
+
elif data == "close":
|
| 33 |
+
await query.message.delete()
|
| 34 |
+
try:
|
| 35 |
+
await query.message.reply_to_message.delete()
|
| 36 |
+
except:
|
| 37 |
+
pass
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
# Jishu Developer
|
| 44 |
+
# Don't Remove Credit 🥺
|
| 45 |
+
# Telegram Channel @Madflix_Bots
|
| 46 |
+
# Backup Channel @JishuBotz
|
| 47 |
+
# Developer @JishuDeveloper
|
plugins/channel_post.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
import asyncio
|
| 10 |
+
from pyrogram import filters, Client
|
| 11 |
+
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
|
| 12 |
+
from pyrogram.errors import FloodWait
|
| 13 |
+
from bot import Bot
|
| 14 |
+
from config import ADMINS, CHANNEL_ID, DISABLE_CHANNEL_BUTTON
|
| 15 |
+
from helper_func import encode
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@Bot.on_message(filters.private & filters.user(ADMINS) & ~filters.command(['start','users','broadcast','batch','genlink','stats']))
|
| 21 |
+
async def channel_post(client: Client, message: Message):
|
| 22 |
+
reply_text = await message.reply_text("Please Wait...!", quote = True)
|
| 23 |
+
try:
|
| 24 |
+
post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True)
|
| 25 |
+
except FloodWait as e:
|
| 26 |
+
await asyncio.sleep(e.x)
|
| 27 |
+
post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True)
|
| 28 |
+
except Exception as e:
|
| 29 |
+
print(e)
|
| 30 |
+
await reply_text.edit_text("Something went Wrong..!")
|
| 31 |
+
return
|
| 32 |
+
converted_id = post_message.id * abs(client.db_channel.id)
|
| 33 |
+
string = f"get-{converted_id}"
|
| 34 |
+
base64_string = await encode(string)
|
| 35 |
+
link = f"https://t.me/{client.username}?start={base64_string}"
|
| 36 |
+
|
| 37 |
+
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
|
| 38 |
+
|
| 39 |
+
await reply_text.edit(f"<b>Here is your link</b>\n\n{link}", reply_markup=reply_markup, disable_web_page_preview = True)
|
| 40 |
+
|
| 41 |
+
if not DISABLE_CHANNEL_BUTTON:
|
| 42 |
+
await post_message.edit_reply_markup(reply_markup)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
@Bot.on_message(filters.channel & filters.incoming & filters.chat(CHANNEL_ID))
|
| 49 |
+
async def new_post(client: Client, message: Message):
|
| 50 |
+
|
| 51 |
+
if DISABLE_CHANNEL_BUTTON:
|
| 52 |
+
return
|
| 53 |
+
|
| 54 |
+
converted_id = message.id * abs(client.db_channel.id)
|
| 55 |
+
string = f"get-{converted_id}"
|
| 56 |
+
base64_string = await encode(string)
|
| 57 |
+
link = f"https://t.me/{client.username}?start={base64_string}"
|
| 58 |
+
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
|
| 59 |
+
try:
|
| 60 |
+
await message.edit_reply_markup(reply_markup)
|
| 61 |
+
except Exception as e:
|
| 62 |
+
print(e)
|
| 63 |
+
pass
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# Jishu Developer
|
| 71 |
+
# Don't Remove Credit 🥺
|
| 72 |
+
# Telegram Channel @Madflix_Bots
|
| 73 |
+
# Backup Channel @JishuBotz
|
| 74 |
+
# Developer @JishuDeveloper
|
plugins/link_generator.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
from pyrogram import Client, filters
|
| 10 |
+
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
|
| 11 |
+
from bot import Bot
|
| 12 |
+
from config import ADMINS
|
| 13 |
+
from helper_func import encode, get_message_id
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
@Bot.on_message(filters.private & filters.user(ADMINS) & filters.command('batch'))
|
| 18 |
+
async def batch(client: Client, message: Message):
|
| 19 |
+
while True:
|
| 20 |
+
try:
|
| 21 |
+
first_message = await client.ask(text = "Forward the First Message from DB Channel (With Quotes)..\n\nOr Send the DB Channel Post Link", chat_id = message.from_user.id, filters=(filters.forwarded | (filters.text & ~filters.forwarded)), timeout=60)
|
| 22 |
+
except:
|
| 23 |
+
return
|
| 24 |
+
f_msg_id = await get_message_id(client, first_message)
|
| 25 |
+
if f_msg_id:
|
| 26 |
+
break
|
| 27 |
+
else:
|
| 28 |
+
await first_message.reply("❌ Error\n\nThis Forwarded Post is not from my DB Channel or this Link is taken from DB Channel", quote = True)
|
| 29 |
+
continue
|
| 30 |
+
|
| 31 |
+
while True:
|
| 32 |
+
try:
|
| 33 |
+
second_message = await client.ask(text = "Forward the Last Message from DB Channel (with Quotes)..\nor Send the DB Channel Post link", chat_id = message.from_user.id, filters=(filters.forwarded | (filters.text & ~filters.forwarded)), timeout=60)
|
| 34 |
+
except:
|
| 35 |
+
return
|
| 36 |
+
s_msg_id = await get_message_id(client, second_message)
|
| 37 |
+
if s_msg_id:
|
| 38 |
+
break
|
| 39 |
+
else:
|
| 40 |
+
await second_message.reply("❌ Error\n\nThis Forwarded Post is not from my DB Channel or this Link is taken from DB Channel", quote = True)
|
| 41 |
+
continue
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
string = f"get-{f_msg_id * abs(client.db_channel.id)}-{s_msg_id * abs(client.db_channel.id)}"
|
| 45 |
+
base64_string = await encode(string)
|
| 46 |
+
link = f"https://t.me/{client.username}?start={base64_string}"
|
| 47 |
+
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
|
| 48 |
+
await second_message.reply_text(f"<b>Here is your link</b>\n\n{link}", quote=True, reply_markup=reply_markup)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
@Bot.on_message(filters.private & filters.user(ADMINS) & filters.command('genlink'))
|
| 54 |
+
async def link_generator(client: Client, message: Message):
|
| 55 |
+
while True:
|
| 56 |
+
try:
|
| 57 |
+
channel_message = await client.ask(text = "Forward Message from the DB Channel (with Quotes)..\nor Send the DB Channel Post link", chat_id = message.from_user.id, filters=(filters.forwarded | (filters.text & ~filters.forwarded)), timeout=60)
|
| 58 |
+
except:
|
| 59 |
+
return
|
| 60 |
+
msg_id = await get_message_id(client, channel_message)
|
| 61 |
+
if msg_id:
|
| 62 |
+
break
|
| 63 |
+
else:
|
| 64 |
+
await channel_message.reply("❌ Error\n\nthis Forwarded Post is not from my DB Channel or this Link is not taken from DB Channel", quote = True)
|
| 65 |
+
continue
|
| 66 |
+
|
| 67 |
+
base64_string = await encode(f"get-{msg_id * abs(client.db_channel.id)}")
|
| 68 |
+
link = f"https://t.me/{client.username}?start={base64_string}"
|
| 69 |
+
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
|
| 70 |
+
await channel_message.reply_text(f"<b>Here is your link</b>\n\n{link}", quote=True, reply_markup=reply_markup)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
# Jishu Developer
|
| 79 |
+
# Don't Remove Credit 🥺
|
| 80 |
+
# Telegram Channel @Madflix_Bots
|
| 81 |
+
# Backup Channel @JishuBotz
|
| 82 |
+
# Developer @JishuDeveloper
|
plugins/route.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
from aiohttp import web
|
| 11 |
+
|
| 12 |
+
routes = web.RouteTableDef()
|
| 13 |
+
|
| 14 |
+
@routes.get("/", allow_head=True)
|
| 15 |
+
async def root_route_handler(request):
|
| 16 |
+
return web.json_response("Madflix_Bots")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Jishu Developer
|
| 22 |
+
# Don't Remove Credit 🥺
|
| 23 |
+
# Telegram Channel @Madflix_Bots
|
| 24 |
+
# Backup Channel @JishuBotz
|
| 25 |
+
# Developer @JishuDeveloper
|
plugins/start.py
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
import os
|
| 11 |
+
import asyncio
|
| 12 |
+
from pyrogram import Client, filters, __version__
|
| 13 |
+
from pyrogram.enums import ParseMode
|
| 14 |
+
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
|
| 15 |
+
from pyrogram.errors import FloodWait, UserIsBlocked, InputUserDeactivated
|
| 16 |
+
from bot import Bot
|
| 17 |
+
from config import ADMINS, FORCE_MSG, START_MSG, CUSTOM_CAPTION, DISABLE_CHANNEL_BUTTON, PROTECT_CONTENT
|
| 18 |
+
from helper_func import subscribed, encode, decode, get_messages
|
| 19 |
+
from database.database import add_user, del_user, full_userbase, present_user
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# add time im seconds for waitingwaiting before delete
|
| 23 |
+
# 1 minutes = 60, 2 minutes = 60×2=120, 5 minutes = 60×5=300
|
| 24 |
+
SECONDS = int(os.getenv("SECONDS", "600"))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
@Bot.on_message(filters.command('start') & filters.private & subscribed)
|
| 30 |
+
async def start_command(client: Client, message: Message):
|
| 31 |
+
id = message.from_user.id
|
| 32 |
+
if not await present_user(id):
|
| 33 |
+
try:
|
| 34 |
+
await add_user(id)
|
| 35 |
+
except:
|
| 36 |
+
pass
|
| 37 |
+
text = message.text
|
| 38 |
+
if len(text)>7:
|
| 39 |
+
try:
|
| 40 |
+
base64_string = text.split(" ", 1)[1]
|
| 41 |
+
except:
|
| 42 |
+
return
|
| 43 |
+
string = await decode(base64_string)
|
| 44 |
+
argument = string.split("-")
|
| 45 |
+
if len(argument) == 3:
|
| 46 |
+
try:
|
| 47 |
+
start = int(int(argument[1]) / abs(client.db_channel.id))
|
| 48 |
+
end = int(int(argument[2]) / abs(client.db_channel.id))
|
| 49 |
+
except:
|
| 50 |
+
return
|
| 51 |
+
if start <= end:
|
| 52 |
+
ids = range(start,end+1)
|
| 53 |
+
else:
|
| 54 |
+
ids = []
|
| 55 |
+
i = start
|
| 56 |
+
while True:
|
| 57 |
+
ids.append(i)
|
| 58 |
+
i -= 1
|
| 59 |
+
if i < end:
|
| 60 |
+
break
|
| 61 |
+
elif len(argument) == 2:
|
| 62 |
+
try:
|
| 63 |
+
ids = [int(int(argument[1]) / abs(client.db_channel.id))]
|
| 64 |
+
except:
|
| 65 |
+
return
|
| 66 |
+
temp_msg = await message.reply("Please wait...")
|
| 67 |
+
try:
|
| 68 |
+
messages = await get_messages(client, ids)
|
| 69 |
+
except:
|
| 70 |
+
await message.reply_text("Something went wrong..!")
|
| 71 |
+
return
|
| 72 |
+
await temp_msg.delete()
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
for msg in messages:
|
| 76 |
+
|
| 77 |
+
if bool(CUSTOM_CAPTION) & bool(msg.document):
|
| 78 |
+
caption = CUSTOM_CAPTION.format(previouscaption = "" if not msg.caption else msg.caption.html, filename = msg.document.file_name)
|
| 79 |
+
else:
|
| 80 |
+
caption = "" if not msg.caption else msg.caption.html
|
| 81 |
+
|
| 82 |
+
if DISABLE_CHANNEL_BUTTON:
|
| 83 |
+
reply_markup = msg.reply_markup
|
| 84 |
+
else:
|
| 85 |
+
reply_markup = None
|
| 86 |
+
|
| 87 |
+
try:
|
| 88 |
+
f = await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = ParseMode.HTML, reply_markup = reply_markup, protect_content=PROTECT_CONTENT)
|
| 89 |
+
|
| 90 |
+
except FloodWait as e:
|
| 91 |
+
await asyncio.sleep(e.x)
|
| 92 |
+
f = await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = ParseMode.HTML, reply_markup = reply_markup, protect_content=PROTECT_CONTENT)
|
| 93 |
+
|
| 94 |
+
except:
|
| 95 |
+
pass
|
| 96 |
+
k = await client.send_message(chat_id = message.from_user.id, text=f"<b>❗️ <u>IMPORTANT</u> ❗️</b>\n\nThis video / file will be deleted in {delete_time} (Due to copyright issues).\n\n📌 Please forward this video / file to somewhere else and start downloading there.")
|
| 97 |
+
await asyncio.sleep(SECONDS)
|
| 98 |
+
await f.delete()
|
| 99 |
+
await k.edit_text("Your video / file is successfully deleted !")
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
return
|
| 103 |
+
else:
|
| 104 |
+
reply_markup = InlineKeyboardMarkup(
|
| 105 |
+
[
|
| 106 |
+
[
|
| 107 |
+
InlineKeyboardButton("😊 About Me", callback_data = "about"),
|
| 108 |
+
InlineKeyboardButton("🔒 Close", callback_data = "close")
|
| 109 |
+
]
|
| 110 |
+
]
|
| 111 |
+
)
|
| 112 |
+
await message.reply_text(
|
| 113 |
+
text = START_MSG.format(
|
| 114 |
+
first = message.from_user.first_name,
|
| 115 |
+
last = message.from_user.last_name,
|
| 116 |
+
username = None if not message.from_user.username else '@' + message.from_user.username,
|
| 117 |
+
mention = message.from_user.mention,
|
| 118 |
+
id = message.from_user.id
|
| 119 |
+
),
|
| 120 |
+
reply_markup = reply_markup,
|
| 121 |
+
disable_web_page_preview = True,
|
| 122 |
+
quote = True
|
| 123 |
+
)
|
| 124 |
+
return
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
#=====================================================================================##
|
| 128 |
+
|
| 129 |
+
WAIT_MSG = """"<b>Processing ...</b>"""
|
| 130 |
+
|
| 131 |
+
REPLY_ERROR = """<code>Use this command as a replay to any telegram message with out any spaces.</code>"""
|
| 132 |
+
|
| 133 |
+
#=====================================================================================##
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
@Bot.on_message(filters.command('start') & filters.private)
|
| 138 |
+
async def not_joined(client: Client, message: Message):
|
| 139 |
+
buttons = [
|
| 140 |
+
[
|
| 141 |
+
InlineKeyboardButton(text="Join Channel", url=client.invitelink),
|
| 142 |
+
InlineKeyboardButton(text="Join Channel", url=client.invitelink2),
|
| 143 |
+
],
|
| 144 |
+
[
|
| 145 |
+
InlineKeyboardButton(text="Join Channel", url=client.invitelink3),
|
| 146 |
+
InlineKeyboardButton(text="Join Channel", url=client.invitelink4),
|
| 147 |
+
]
|
| 148 |
+
]
|
| 149 |
+
try:
|
| 150 |
+
buttons.append(
|
| 151 |
+
[
|
| 152 |
+
InlineKeyboardButton(
|
| 153 |
+
text = 'Try Again',
|
| 154 |
+
url = f"https://t.me/{client.username}?start={message.command[1]}"
|
| 155 |
+
)
|
| 156 |
+
]
|
| 157 |
+
)
|
| 158 |
+
except IndexError:
|
| 159 |
+
pass
|
| 160 |
+
|
| 161 |
+
await message.reply(
|
| 162 |
+
text = FORCE_MSG.format(
|
| 163 |
+
first = message.from_user.first_name,
|
| 164 |
+
last = message.from_user.last_name,
|
| 165 |
+
username = None if not message.from_user.username else '@' + message.from_user.username,
|
| 166 |
+
mention = message.from_user.mention,
|
| 167 |
+
id = message.from_user.id
|
| 168 |
+
),
|
| 169 |
+
reply_markup = InlineKeyboardMarkup(buttons),
|
| 170 |
+
quote = True,
|
| 171 |
+
disable_web_page_preview = True
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
@Bot.on_message(filters.command('users') & filters.private & filters.user(ADMINS))
|
| 177 |
+
async def get_users(client: Bot, message: Message):
|
| 178 |
+
msg = await client.send_message(chat_id=message.chat.id, text=WAIT_MSG)
|
| 179 |
+
users = await full_userbase()
|
| 180 |
+
await msg.edit(f"{len(users)} users are using this bot")
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
@Bot.on_message(filters.private & filters.command('broadcast') & filters.user(ADMINS))
|
| 185 |
+
async def send_text(client: Bot, message: Message):
|
| 186 |
+
if message.reply_to_message:
|
| 187 |
+
query = await full_userbase()
|
| 188 |
+
broadcast_msg = message.reply_to_message
|
| 189 |
+
total = 0
|
| 190 |
+
successful = 0
|
| 191 |
+
blocked = 0
|
| 192 |
+
deleted = 0
|
| 193 |
+
unsuccessful = 0
|
| 194 |
+
|
| 195 |
+
pls_wait = await message.reply("<i>Broadcasting Message.. This will Take Some Time</i>")
|
| 196 |
+
for chat_id in query:
|
| 197 |
+
try:
|
| 198 |
+
await broadcast_msg.copy(chat_id)
|
| 199 |
+
successful += 1
|
| 200 |
+
except FloodWait as e:
|
| 201 |
+
await asyncio.sleep(e.x)
|
| 202 |
+
await broadcast_msg.copy(chat_id)
|
| 203 |
+
successful += 1
|
| 204 |
+
except UserIsBlocked:
|
| 205 |
+
await del_user(chat_id)
|
| 206 |
+
blocked += 1
|
| 207 |
+
except InputUserDeactivated:
|
| 208 |
+
await del_user(chat_id)
|
| 209 |
+
deleted += 1
|
| 210 |
+
except:
|
| 211 |
+
unsuccessful += 1
|
| 212 |
+
pass
|
| 213 |
+
total += 1
|
| 214 |
+
|
| 215 |
+
status = f"""<b><u>Broadcast Completed</u>
|
| 216 |
+
|
| 217 |
+
Total Users: <code>{total}</code>
|
| 218 |
+
Successful: <code>{successful}</code>
|
| 219 |
+
Blocked Users: <code>{blocked}</code>
|
| 220 |
+
Deleted Accounts: <code>{deleted}</code>
|
| 221 |
+
Unsuccessful: <code>{unsuccessful}</code></b>"""
|
| 222 |
+
|
| 223 |
+
return await pls_wait.edit(status)
|
| 224 |
+
|
| 225 |
+
else:
|
| 226 |
+
msg = await message.reply(REPLY_ERROR)
|
| 227 |
+
await asyncio.sleep(8)
|
| 228 |
+
await msg.delete()
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
# Jishu Developer
|
| 238 |
+
# Don't Remove Credit 🥺
|
| 239 |
+
# Telegram Channel @Madflix_Bots
|
| 240 |
+
# Backup Channel @JishuBotz
|
| 241 |
+
# Developer @JishuDeveloper
|
plugins/useless.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jishu Developer
|
| 2 |
+
# Don't Remove Credit 🥺
|
| 3 |
+
# Telegram Channel @Madflix_Bots
|
| 4 |
+
# Backup Channel @JishuBotz
|
| 5 |
+
# Developer @JishuDeveloper
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
from bot import Bot
|
| 11 |
+
from pyrogram.types import Message
|
| 12 |
+
from pyrogram import filters
|
| 13 |
+
from config import ADMINS, BOT_STATS_TEXT, USER_REPLY_TEXT
|
| 14 |
+
from datetime import datetime
|
| 15 |
+
from helper_func import get_readable_time
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@Bot.on_message(filters.command('stats') & filters.user(ADMINS))
|
| 20 |
+
async def stats(bot: Bot, message: Message):
|
| 21 |
+
now = datetime.now()
|
| 22 |
+
delta = now - bot.uptime
|
| 23 |
+
time = get_readable_time(delta.seconds)
|
| 24 |
+
await message.reply(BOT_STATS_TEXT.format(uptime=time))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
@Bot.on_message(filters.private & filters.incoming)
|
| 29 |
+
async def useless(_,message: Message):
|
| 30 |
+
if USER_REPLY_TEXT:
|
| 31 |
+
await message.reply(USER_REPLY_TEXT)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# Jishu Developer
|
| 38 |
+
# Don't Remove Credit 🥺
|
| 39 |
+
# Telegram Channel @Madflix_Bots
|
| 40 |
+
# Backup Channel @JishuBotz
|
| 41 |
+
# Developer @JishuDeveloper
|
requirements.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# --- For-Bot-Working --------- #
|
| 2 |
+
pyrogram
|
| 3 |
+
TgCrypto
|
| 4 |
+
pyromod==1.5
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
# --- For-Database ------------ #
|
| 9 |
+
pymongo
|
| 10 |
+
dnspython
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
# --- For-Web-Response ------- #
|
| 15 |
+
aiohttp
|