├── runtime.txt
├── Procfile
├── requirements.txt
├── LazyDeveloper.txt
├── Dockerfile
├── app.py
├── docker-compose.yml
├── helper
├── date.py
├── set.py
├── ffmpeg.py
├── progress.py
└── database.py
├── plugins
├── refer.py
├── thumbfunction.py
├── about.py
├── lazyusers.py
├── broadcast.py
├── caption.py
├── upgrade.py
├── myplane.py
├── filedetect.py
├── admin.py
├── start.py
└── cb_data.py
├── bot.py
├── logging.conf
├── LICENSE
├── app.json
└── README.md
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.10.8
2 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 bot.py
2 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | Pillow
2 | humanize
3 | hachoir
4 | pyrogram==2.0.57
5 | TgCrypto
6 | pymongo==4.0.2
7 | dnspython
8 | Flask==2.2.2
9 | gunicorn==20.1.0
10 | aiohttp==3.8.1
11 |
--------------------------------------------------------------------------------
/LazyDeveloper.txt:
--------------------------------------------------------------------------------
1 | #Thank you LazyDeveloper for helping me in this journey !
2 | #Must Subscribe On YouTube @LazyDeveloperr
3 | #please check run cmd in procfile of your repository !
4 |
5 | gunicorn app:app & python3 bot.py
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 |
2 | FROM python:latest
3 |
4 | WORKDIR /app
5 |
6 | COPY requirements.txt /app/
7 |
8 | RUN apt update && apt upgrade -y
9 | RUN apt install git python3-pip ffmpeg -y
10 |
11 | COPY . .
12 |
13 | RUN pip3 install -r requirements.txt
14 |
15 | COPY . /app
16 |
17 | CMD python3 bot.py
18 |
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | #Thank you LazyDeveloper for helping me in this journey !
2 | #Must Subscribe On YouTube @LazyDeveloperr
3 |
4 | from flask import Flask
5 | app = Flask(__name__)
6 |
7 | @app.route('/')
8 | def hello_world():
9 | return '@LazyDeveloper'
10 |
11 |
12 | if __name__ == "__main__":
13 | app.run()
14 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.9"
2 | services:
3 | workerdisk:
4 | build: .
5 | environment:
6 | - API_ID=${API_ID}
7 | - API_HASH=${HASH}
8 | - TOKEN=${TOKEN}
9 | - DB_NAME=${DB_NAME}
10 | - DB_URL=${DB_URL}
11 | - CHANNEL=${CHANNEL}
12 | - ADMIN=${ADMIN}
13 | - LAZY_PIC=${LAZY_PIC}
14 |
--------------------------------------------------------------------------------
/helper/date.py:
--------------------------------------------------------------------------------
1 | from datetime import timedelta, date ,datetime
2 | import time
3 |
4 | def add_date():
5 | today = date.today()
6 | ex_date = today + timedelta(days=30)
7 | pattern = '%Y-%m-%d'
8 | epcho = int(time.mktime(time.strptime(str(ex_date), pattern)))
9 | normal_date = datetime.fromtimestamp(epcho).strftime('%Y-%m-%d')
10 | return epcho , normal_date
11 |
12 | def check_expi(saved_date):
13 | today = date.today()
14 | pattern = '%Y-%m-%d'
15 | epcho = int(time.mktime(time.strptime(str(today), pattern)))
16 | then = saved_date - epcho
17 | print(then)
18 | if then > 0:
19 | return True
20 | else:
21 | return False
22 |
--------------------------------------------------------------------------------
/plugins/refer.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client, filters
2 | from pyrogram.types import ( InlineKeyboardButton, InlineKeyboardMarkup,ForceReply)
3 | @Client.on_message(filters.private & filters.command(["refer"]))
4 | async def refer(client,message):
5 | reply_markup = InlineKeyboardMarkup(
6 | [[ InlineKeyboardButton("Share Your Link" ,url=f"https://t.me/share/url?url=https://t.me/GangsterBaby_renamer_BOT?start={message.from_user.id}") ] ])
7 | await message.reply_text(f"Refer And Earn Get 100MB Upload Limit\nPer Refer 100MB\n Your Link :- https://t.me/LazyStar_BOT?start={message.from_user.id} ",reply_to_message_id = message.id,reply_markup=reply_markup,)
8 |
9 |
--------------------------------------------------------------------------------
/bot.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | from pyrogram import Client, compose,idle
3 | import os
4 |
5 | from plugins.cb_data import app as Client2
6 |
7 | TOKEN = os.environ.get("TOKEN", "")
8 |
9 | API_ID = int(os.environ.get("API_ID", ""))
10 |
11 | API_HASH = os.environ.get("API_HASH", "")
12 |
13 | STRING = os.environ.get("STRING", "")
14 |
15 |
16 |
17 | bot = Client(
18 |
19 | "Renamer",
20 |
21 | bot_token=TOKEN,
22 |
23 | api_id=API_ID,
24 |
25 | api_hash=API_HASH,
26 |
27 | plugins=dict(root='plugins'))
28 |
29 |
30 | if STRING:
31 | apps = [Client2,bot]
32 | for app in apps:
33 | app.start()
34 | idle()
35 | for app in apps:
36 | app.stop()
37 |
38 | else:
39 | bot.run()
40 |
--------------------------------------------------------------------------------
/logging.conf:
--------------------------------------------------------------------------------
1 | [loggers]
2 | keys=root
3 |
4 | [handlers]
5 | keys=consoleHandler,fileHandler
6 |
7 | [formatters]
8 | keys=consoleFormatter,fileFormatter
9 |
10 | [logger_root]
11 | level=DEBUG
12 | handlers=consoleHandler,fileHandler
13 |
14 | [handler_consoleHandler]
15 | class=StreamHandler
16 | level=INFO
17 | formatter=consoleFormatter
18 | args=(sys.stdout,)
19 |
20 | [handler_fileHandler]
21 | class=FileHandler
22 | level=ERROR
23 | formatter=fileFormatter
24 | args=('TelegramBot.log','w',)
25 |
26 | [formatter_consoleFormatter]
27 | format=%(asctime)s - %(lineno)d - %(name)s - %(module)s - %(levelname)s - %(message)s
28 | datefmt=%I:%M:%S %p
29 |
30 | [formatter_fileFormatter]
31 | format=[%(asctime)s:%(name)s:%(lineno)d:%(levelname)s] %(message)s
32 | datefmt=%m/%d/%Y %I:%M:%S %p
33 |
--------------------------------------------------------------------------------
/plugins/thumbfunction.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client, filters
2 | from helper.database import find, delthumb, addthumb
3 |
4 | @Client.on_message(filters.private & filters.command(['viewthumb']))
5 | async def viewthumb(client,message):
6 | print(message.chat.id)
7 | thumb = find(int(message.chat.id))[0]
8 | if thumb :
9 | await client.send_photo(message.chat.id,photo =f"{thumb}")
10 | else:
11 | await message.reply_text("**You don't have any custom thumbnail**")
12 |
13 |
14 | @Client.on_message(filters.private & filters.command(['delthumb']))
15 | async def removethumb(client,message):
16 | delthumb(int(message.chat.id))
17 | await message.reply_text("**Custom thumbnail deleted successfully**")
18 |
19 | @Client.on_message(filters.private & filters.photo)
20 | async def addthumbs(client,message):
21 | file_id = str(message.photo.file_id)
22 | addthumb(message.chat.id , file_id)
23 | await message.reply_text("**Custom thumbnail saved successfully** ✅")
--------------------------------------------------------------------------------
/plugins/about.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pyrogram import Client, filters
3 | token = os.environ.get('TOKEN','')
4 | botid = token.split(':')[0]
5 | from helper.database import botdata, find_one, total_user
6 |
7 | from helper.progress import humanbytes
8 |
9 | @Client.on_message(filters.private & filters.command(["about"]))
10 | async def start(client,message):
11 | botdata(int(botid))
12 | data = find_one(int(botid))
13 | total_rename = data["total_rename"]
14 | total_size = data["total_size"]
15 | await message.reply_text(f"Origional BOT :- Gangster Baby\nCreater :- 🦋LazyDeveloper🦋\nLanguage :- Python3\nLibrary :- Pyrogram 2.0\nServer :- KOYEB\nTotal Renamed File :- {total_rename}\nTotal Size Renamed :- {humanbytes(int(total_size))} \n\n Thank you **LazyDeveloperr** for your hard work \n\n❤️ we love you **LazyDeveloper** ❤️",quote=True)
16 |
--------------------------------------------------------------------------------
/plugins/lazyusers.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pyrogram import Client, filters
3 | from pyrogram.types import ( InlineKeyboardButton, InlineKeyboardMarkup)
4 | token = os.environ.get('TOKEN','')
5 | botid = token.split(':')[0]
6 | ADMIN = int(os.environ.get("ADMIN", ""))
7 |
8 | from helper.database import botdata, find_one, total_user,getid
9 |
10 | from helper.progress import humanbytes
11 |
12 | @Client.on_message(filters.private & filters.user(ADMIN) & filters.command(["lazyusers"]))
13 | async def start(client,message):
14 | botdata(int(botid))
15 | data = find_one(int(botid))
16 | total_rename = data["total_rename"]
17 | total_size = data["total_size"]
18 | id = str(getid())
19 | ids = id.split(',')
20 |
21 | await message.reply_text(f"⚡️ All IDS : {ids}\n\n⚡️ Total User :- {total_user()}\n\n⚡️ Total Renamed File :- {total_rename}\nV Total Size Renamed :- {humanbytes(int(total_size))}",quote=True,
22 | reply_markup= InlineKeyboardMarkup([[InlineKeyboardButton("🦋 Close Menu 🦋", callback_data="cancel")]])
23 | )
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 mr_lokaman
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 |
--------------------------------------------------------------------------------
/helper/set.py:
--------------------------------------------------------------------------------
1 | from typing import Dict, List
2 | def escape_invalid_curly_brackets(text: str, valids: List[str]) -> str:
3 | new_text = ""
4 | idx = 0
5 | while idx < len(text):
6 | if text[idx] == "{":
7 | if idx + 1 < len(text) and text[idx + 1] == "{":
8 | idx += 2
9 | new_text += "{{{{"
10 | continue
11 | else:
12 | success = False
13 | for v in valids:
14 | if text[idx:].startswith('{' + v + '}'):
15 | success = True
16 | break
17 | if success:
18 | new_text += text[idx: idx + len(v) + 2]
19 | idx += len(v) + 2
20 | continue
21 | else:
22 | new_text += "{{"
23 |
24 | elif text[idx] == "}":
25 | if idx + 1 < len(text) and text[idx + 1] == "}":
26 | idx += 2
27 | new_text += "}}}}"
28 | continue
29 | else:
30 | new_text += "}}"
31 |
32 | else:
33 | new_text += text[idx]
34 | idx += 1
35 |
36 | return new_text
37 |
--------------------------------------------------------------------------------
/plugins/broadcast.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pyrogram.errors import FloodWait
3 | import asyncio
4 | from pyrogram import Client, filters
5 | from helper.database import getid, delete
6 | import time
7 | ADMIN = int(os.environ.get("ADMIN", 1484670284))
8 |
9 |
10 | @Client.on_message(filters.private & filters.user(ADMIN) & filters.command(["broadcast"]))
11 | async def broadcast(bot, message):
12 | if (message.reply_to_message):
13 | ms = await message.reply_text("Geting All ids from database..\n Please wait")
14 | ids = getid()
15 | tot = len(ids)
16 | success = 0
17 | failed = 0
18 | await ms.edit(f"Starting Broadcast... \n Sending Message To {tot} Users")
19 | for id in ids:
20 | try:
21 | time.sleep(1)
22 | await message.reply_to_message.copy(id)
23 | success += 1
24 | except:
25 | failed += 1
26 | delete({"_id": id})
27 | pass
28 | try:
29 | await ms.edit(f"Message sent to {success} chat(s). {failed} chat(s) failed on receiving message. \nTotal - {tot}")
30 | except FloodWait as e:
31 | await asyncio.sleep(t.x)
32 |
--------------------------------------------------------------------------------
/plugins/caption.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client, filters
2 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
3 | from helper.database import *
4 |
5 | @Client.on_message(filters.private & filters.command('set_caption'))
6 | async def add_caption(client, message):
7 | if len(message.command) == 1:
8 | return await message.reply_text("**Give me a caption to set.\n\nExample:- `/set_caption File Name`**")
9 | caption = message.text.split(" ", 1)[1]
10 | addcaption(int(message.chat.id), caption)
11 | await message.reply_text("**Your Caption successfully added ✅**")
12 |
13 | @Client.on_message(filters.private & filters.command('del_caption'))
14 | async def delete_caption(client, message):
15 | caption = find(int(message.chat.id))[1]
16 | if not caption:
17 | await message.reply_text("**You dont have any custom caption**")
18 | return
19 | delcaption(int(message.chat.id))
20 | await message.reply_text("**Your caption successfully deleted ✅**")
21 |
22 | @Client.on_message(filters.private & filters.command('see_caption'))
23 | async def see_caption(client, message):
24 | caption = find(int(message.chat.id))[1]
25 | if caption:
26 | await message.reply_text(f"Your Caption:\n\n`{caption}`")
27 | else:
28 | await message.reply_text("**You dont have any custom caption**")
29 |
30 |
--------------------------------------------------------------------------------
/helper/ffmpeg.py:
--------------------------------------------------------------------------------
1 | import time
2 | import os
3 | import asyncio
4 | from PIL import Image
5 | from hachoir.metadata import extractMetadata
6 | from hachoir.parser import createParser
7 |
8 | async def fix_thumb(thumb):
9 | width = 0
10 | height = 0
11 | try:
12 | if thumb != None:
13 | metadata = extractMetadata(createParser(thumb))
14 | if metadata.has("width"):
15 | width = metadata.get("width")
16 | if metadata.has("height"):
17 | height = metadata.get("height")
18 | Image.open(thumb).convert("RGB").save(thumb)
19 | img = Image.open(thumb)
20 | img.resize((320, height))
21 | img.save(thumb, "JPEG")
22 | except Exception as e:
23 | print(e)
24 | thumb = None
25 |
26 | return width, height, thumb
27 |
28 | async def take_screen_shot(video_file, output_directory, ttl):
29 | out_put_file_name = f"{output_directory}/{time.time()}.jpg"
30 | file_genertor_command = [
31 | "ffmpeg",
32 | "-ss",
33 | str(ttl),
34 | "-i",
35 | video_file,
36 | "-vframes",
37 | "1",
38 | out_put_file_name
39 | ]
40 | process = await asyncio.create_subprocess_exec(
41 | *file_genertor_command,
42 | stdout=asyncio.subprocess.PIPE,
43 | stderr=asyncio.subprocess.PIPE,
44 | )
45 | stdout, stderr = await process.communicate()
46 | e_response = stderr.decode().strip()
47 | t_response = stdout.decode().strip()
48 | if os.path.lexists(out_put_file_name):
49 | return out_put_file_name
50 | return None
51 |
--------------------------------------------------------------------------------
/plugins/upgrade.py:
--------------------------------------------------------------------------------
1 | """lokaman"""
2 | from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup,ForceReply)
3 | from pyrogram import Client , filters
4 |
5 | @Client.on_callback_query(filters.regex('upgrade'))
6 | async def upgrade(bot,update):
7 | text = """**Free Plan User**
8 | Daily Upload limit 1.2GB
9 | Price 0
10 |
11 | **🪙 Silver Tier 🪙**
12 | Daily Upload limit 10GB
13 | Price Rs 66 ind /🌎 0.8$ per Month
14 |
15 | **💫 Gold Tier 💫**
16 | Daily Upload limit 50GB
17 | Price Rs 100 ind /🌎 1.2$ per Month
18 |
19 | **💎 Diamond 💎**
20 | Daily Upload limit 100GB
21 | Price Rs 206 ind /🌎 2.5$ per Month
22 |
23 |
24 | Pay Using Upi I'd ```7808912076@paytm```
25 |
26 | After Payment Send Screenshots Of
27 | Payment To Admin @mRiderDM"""
28 | keybord = InlineKeyboardMarkup([[
29 | InlineKeyboardButton("ADMIN 🛂",url = "https://t.me/mRiderDM")],
30 | [InlineKeyboardButton("Paytm",url = "https://p.paytm.me/xCTH/vo37hii9"),
31 | InlineKeyboardButton("Paytm",url = "https://p.paytm.me/xCTH/vo37hii9")],[InlineKeyboardButton("Cancel",callback_data = "cancel") ]])
32 | await update.message.edit(text = text,reply_markup = keybord)
33 |
34 |
35 | @Client.on_message(filters.private & filters.command(["upgrade"]))
36 | async def upgradecm(bot,message):
37 | text = """**Free Plan User**
38 | Daily Upload limit 1.2GB
39 | Price 0
40 |
41 | **🪙 Silver Tier 🪙**
42 | Daily Upload limit 10GB
43 | Price Rs 66 ind /🌎 0.8$ per Month
44 |
45 | **💫 Gold Tier 💫**
46 | Daily Upload limit 50GB
47 | Price Rs 100 ind /🌎 1.2$ per Month
48 |
49 | **💎 Diamond 💎**
50 | Daily Upload limit 100GB
51 | Price Rs 206 ind /🌎 2.5$ per Month
52 |
53 |
54 | Pay Using Upi I'd ```7808912076@paytm```
55 |
56 | After Payment Send Screenshots Of
57 | Payment To Admin @mRiderDM"""
58 | keybord = InlineKeyboardMarkup([[
59 | InlineKeyboardButton("ADMIN 🛂",url = "https://t.me/mRiDerDM")],
60 | [InlineKeyboardButton("Paytm",url = "https://p.paytm.me/xCTH/vo37hii9"),
61 | InlineKeyboardButton("Paytm",url = "https://p.paytm.me/xCTH/vo37hii9")],[InlineKeyboardButton("Cancel",callback_data = "cancel") ]])
62 | await message.reply_text(text = text,reply_markup = keybord)
63 |
--------------------------------------------------------------------------------
/plugins/myplane.py:
--------------------------------------------------------------------------------
1 | import time
2 | from pyrogram import Client, filters
3 | from pyrogram.types import (
4 | InlineKeyboardButton, InlineKeyboardMarkup, ForceReply)
5 | from helper.database import find_one, used_limit
6 | from helper.database import daily as daily_
7 | import datetime
8 | from datetime import timedelta, date, datetime
9 | from datetime import date as date_
10 | from helper.progress import humanbytes
11 | from helper.database import daily as daily_
12 | from helper.date import check_expi
13 | from helper.database import uploadlimit, usertype
14 |
15 |
16 | @Client.on_message(filters.private & filters.command(["myplan"]))
17 | async def start(client, message):
18 | used_ = find_one(message.from_user.id)
19 | daily = used_["daily"]
20 | expi = daily - \
21 | int(time.mktime(time.strptime(str(date_.today()), '%Y-%m-%d')))
22 | if expi != 0:
23 | today = date_.today()
24 | pattern = '%Y-%m-%d'
25 | epcho = int(time.mktime(time.strptime(str(today), pattern)))
26 | daily_(message.from_user.id, epcho)
27 | used_limit(message.from_user.id, 0)
28 | _newus = find_one(message.from_user.id)
29 | used = _newus["used_limit"]
30 | limit = _newus["uploadlimit"]
31 | remain = int(limit) - int(used)
32 | user = _newus["usertype"]
33 | ends = _newus["prexdate"]
34 | if ends:
35 | pre_check = check_expi(ends)
36 | if pre_check == False:
37 | uploadlimit(message.from_user.id, 1288490188)
38 | usertype(message.from_user.id, "Free")
39 | if ends == None:
40 | text = f"User ID:- ```{message.from_user.id}```\nPlan :- {user}\nDaly Upload Limit :- {humanbytes(limit)}\nToday Used :- {humanbytes(used)}\nRemain:- {humanbytes(remain)}"
41 | else:
42 | normal_date = datetime.fromtimestamp(ends).strftime('%Y-%m-%d')
43 | text = f"User ID:- ```{message.from_user.id}```\nPlan :- {user}\nDaly Upload Limit :- {humanbytes(limit)}\nToday Used :- {humanbytes(used)}\nRemain:- {humanbytes(remain)}\n\nYour Plan Ends On :- {normal_date}"
44 |
45 | if user == "Free":
46 | await message.reply(text, quote=True, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Upgrade 💰💳", callback_data="upgrade"), InlineKeyboardButton("Cancel ✖️ ", callback_data="cancel")]]))
47 | else:
48 | await message.reply(text, quote=True)
49 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 |
4 | "name": "Gangster Baby Renamer Bot",
5 |
6 | "description": "Telegram File Renamer Bot 4GB ",
7 |
8 | "keywords": [
9 |
10 | "Gangster Baby Renamer Bot ",
11 |
12 | "4GB File",
13 |
14 | "telegram",
15 |
16 | "LazyDeveloperr"
17 |
18 | ],
19 |
20 | "repository": "https://github.com/LazyDeveloperr/Gangster-Baby-V2",
21 |
22 | "success_url": "https://telegram.dog/LazyDeveloperr",
23 |
24 | "env": {
25 |
26 | "CHANNEL": {
27 |
28 | "description": "Channel or Group user Name With @",
29 |
30 | "required":true
31 |
32 |
33 |
34 | },
35 |
36 | "STRING": {
37 |
38 | "description": "Pyrogram String Session Use @genStr_Bot",
39 |
40 | "required": true
41 |
42 | },
43 |
44 | "API_ID": {
45 |
46 | "description": "Your APP ID From my.telegram.org ",
47 |
48 | "required": true
49 |
50 | },
51 |
52 | "API_HASH": {
53 |
54 | "description": "Your API Hash From my.telegram.org ",
55 |
56 | "required": true
57 |
58 | },
59 |
60 | "TOKEN": {
61 |
62 | "description": "Your Bot Token From @BotFather",
63 |
64 | "required": true
65 |
66 | },
67 |
68 | "ADMIN": {
69 |
70 | "description":"Add Your User ID",
71 |
72 | "required": true
73 |
74 | },
75 |
76 | "DB_URL":{
77 |
78 | "description":"Database Url Get It From Mongo DB"
79 |
80 | },
81 |
82 | "DB_NAME":{
83 |
84 | "description":"Database Name ",
85 |
86 | "required":true
87 |
88 | },
89 |
90 | "LOG_CHANNEL":{
91 |
92 | "description":"Channel Id Nedd Store Files Get Your channel id from Rose @MissRose_bot",
93 |
94 | "required": true
95 |
96 | },
97 | "LAZY_PIC":{
98 |
99 | "description":"Start up pic of your bot. Get from telegraph_Bot",
100 |
101 | "required": true
102 |
103 | }
104 |
105 |
106 |
107 | },
108 |
109 | "buildpacks": [
110 |
111 | {
112 |
113 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest"
114 |
115 | },
116 |
117 | {
118 |
119 | "url": "heroku/python"
120 |
121 | }
122 |
123 | ]
124 |
125 | }
126 |
--------------------------------------------------------------------------------
/helper/progress.py:
--------------------------------------------------------------------------------
1 | import math
2 | import time
3 |
4 |
5 | async def progress_for_pyrogram(
6 | current,
7 | total,
8 | ud_type,
9 | message,
10 | start
11 | ):
12 |
13 | now = time.time()
14 | diff = now - start
15 | if round(diff % 10.00) == 0 or current == total:
16 | # if round(current / total * 100, 0) % 5 == 0:
17 | percentage = current * 100 / total
18 | speed = current / diff
19 | elapsed_time = round(diff) * 1000
20 | time_to_completion = round((total - current) / speed) * 1000
21 | estimated_total_time = elapsed_time + time_to_completion
22 |
23 | elapsed_time = TimeFormatter(milliseconds=elapsed_time)
24 | estimated_total_time = TimeFormatter(milliseconds=estimated_total_time)
25 |
26 | progress = "[{0}{1}] \n**Progress**: {2}%\n".format(
27 | ''.join(["●" for i in range(math.floor(percentage / 5))]),
28 | ''.join(["○" for i in range(20 - math.floor(percentage / 5))]),
29 | round(percentage, 2))
30 |
31 | tmp = progress + "{0} of {1}\n**Speed**: {2}/s\n**ETA**: {3}\n".format(
32 | humanbytes(current),
33 | humanbytes(total),
34 | humanbytes(speed),
35 | # elapsed_time if elapsed_time != '' else "0 s",
36 | estimated_total_time if estimated_total_time != '' else "0 s"
37 | )
38 | try:
39 | await message.edit(
40 | text="{}\n {}".format(
41 | ud_type,
42 | tmp
43 | )
44 | )
45 | except:
46 | pass
47 |
48 |
49 | def humanbytes(size):
50 | # https://stackoverflow.com/a/49361727/4723940
51 | # 2**10 = 1024
52 | if not size:
53 | return ""
54 | power = 2**10
55 | n = 0
56 | Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'}
57 | while size > power:
58 | size /= power
59 | n += 1
60 | return str(round(size, 2)) + " " + Dic_powerN[n] + 'B'
61 |
62 |
63 | def TimeFormatter(milliseconds: int) -> str:
64 | seconds, milliseconds = divmod(int(milliseconds), 1000)
65 | minutes, seconds = divmod(seconds, 60)
66 | hours, minutes = divmod(minutes, 60)
67 | days, hours = divmod(hours, 24)
68 | tmp = ((str(days) + "d, ") if days else "") + \
69 | ((str(hours) + "h, ") if hours else "") + \
70 | ((str(minutes) + "m, ") if minutes else "") + \
71 | ((str(seconds) + "s, ") if seconds else "") + \
72 | ((str(milliseconds) + "ms, ") if milliseconds else "")
73 | return tmp[:-2]
74 |
--------------------------------------------------------------------------------
/plugins/filedetect.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client, filters
2 | from pyrogram.types import (
3 | InlineKeyboardButton, InlineKeyboardMarkup, ForceReply)
4 |
5 |
6 | @Client.on_message(filters.private & filters.reply)
7 | async def refunc(client, message):
8 | if (message.reply_to_message.reply_markup) and isinstance(message.reply_to_message.reply_markup, ForceReply):
9 | new_name = message.text
10 | await message.delete()
11 | media = await client.get_messages(message.chat.id, message.reply_to_message.id)
12 | file = media.reply_to_message.document or media.reply_to_message.video or media.reply_to_message.audio
13 | filename = file.file_name
14 | types = file.mime_type.split("/")
15 | mime = types[0]
16 | mg_id = media.reply_to_message.id
17 | try:
18 | out = new_name.split(".")
19 | out[1]
20 | out_name = out[-1]
21 | out_filename = new_name
22 | await message.reply_to_message.delete()
23 | if mime == "video":
24 | markup = InlineKeyboardMarkup([[
25 | InlineKeyboardButton("📁 Document", callback_data="doc"),
26 | InlineKeyboardButton("🎥 Video", callback_data="vid")]])
27 | elif mime == "audio":
28 | markup = InlineKeyboardMarkup([[InlineKeyboardButton(
29 | "📁 Document", callback_data="doc"), InlineKeyboardButton("🎵 audio", callback_data="aud")]])
30 | else:
31 | markup = InlineKeyboardMarkup(
32 | [[InlineKeyboardButton("📁 Document", callback_data="doc")]])
33 | # dont chenge this message.reply_text
34 | await message.reply_text(f"**Select the output file type**\n**Output FileName** :- ```{out_filename}```", reply_to_message_id=mg_id, reply_markup=markup)
35 |
36 | except:
37 | try:
38 | out = filename.split(".")
39 | out_name = out[-1]
40 | out_filename = new_name + "." + out_name
41 | except:
42 | await message.reply_to_message.delete()
43 | await message.reply_text("**Error** : No Extension in File, Not Supporting", reply_to_message_id=mg_id)
44 | return
45 | await message.reply_to_message.delete()
46 | if mime == "video":
47 | markup = InlineKeyboardMarkup([[InlineKeyboardButton(
48 | "📁 Document", callback_data="doc"), InlineKeyboardButton("🎥 Video", callback_data="vid")]])
49 | elif mime == "audio":
50 | markup = InlineKeyboardMarkup([[InlineKeyboardButton(
51 | "📁 Document", callback_data="doc"), InlineKeyboardButton("🎵 audio", callback_data="aud")]])
52 | else:
53 | markup = InlineKeyboardMarkup(
54 | [[InlineKeyboardButton("📁 Document", callback_data="doc")]])
55 | # dont chenge this message.reply_text
56 | await message.reply_text(f"**Select the output file type**\n**Output FileName** :- ```{out_filename}```",
57 | reply_to_message_id=mg_id, reply_markup=markup)
--------------------------------------------------------------------------------
/helper/database.py:
--------------------------------------------------------------------------------
1 | import pymongo
2 | import os
3 | from helper.date import add_date
4 | DB_NAME = os.environ.get("DB_NAME", "")
5 | DB_URL = os.environ.get("DB_URL", "")
6 | mongo = pymongo.MongoClient(DB_URL)
7 | db = mongo[DB_NAME]
8 | dbcol = db["user"]
9 |
10 | # Total User
11 |
12 |
13 | def total_user():
14 | user = dbcol.count_documents({})
15 | return user
16 |
17 | # insert bot Data
18 |
19 |
20 | def botdata(chat_id):
21 | bot_id = int(chat_id)
22 | try:
23 | bot_data = {"_id": bot_id, "total_rename": 0, "total_size": 0}
24 | dbcol.insert_one(bot_data)
25 | except:
26 | pass
27 |
28 |
29 | def total_rename(chat_id, renamed_file):
30 | now = int(renamed_file) + 1
31 | dbcol.update_one({"_id": chat_id}, {"$set": {"total_rename": str(now)}})
32 |
33 |
34 | def total_size(chat_id, total_size, now_file_size):
35 | now = int(total_size) + now_file_size
36 | dbcol.update_one({"_id": chat_id}, {"$set": {"total_size": str(now)}})
37 |
38 |
39 | # insert user data
40 | def insert(chat_id):
41 | user_id = int(chat_id)
42 | user_det = {"_id": user_id, "file_id": None, "caption": None, "daily": 0, "date": 0,
43 | "uploadlimit": 1288490188, "used_limit": 0, "usertype": "Free", "prexdate": None}
44 | try:
45 | dbcol.insert_one(user_det)
46 | except:
47 | return True
48 | pass
49 |
50 |
51 | def addthumb(chat_id, file_id):
52 | dbcol.update_one({"_id": chat_id}, {"$set": {"file_id": file_id}})
53 |
54 |
55 | def delthumb(chat_id):
56 | dbcol.update_one({"_id": chat_id}, {"$set": {"file_id": None}})
57 |
58 |
59 | def addcaption(chat_id, caption):
60 | dbcol.update_one({"_id": chat_id}, {"$set": {"caption": caption}})
61 |
62 |
63 | def delcaption(chat_id):
64 | dbcol.update_one({"_id": chat_id}, {"$set": {"caption": None}})
65 |
66 |
67 | def dateupdate(chat_id, date):
68 | dbcol.update_one({"_id": chat_id}, {"$set": {"date": date}})
69 |
70 |
71 | def used_limit(chat_id, used):
72 | dbcol.update_one({"_id": chat_id}, {"$set": {"used_limit": used}})
73 |
74 |
75 | def usertype(chat_id, type):
76 | dbcol.update_one({"_id": chat_id}, {"$set": {"usertype": type}})
77 |
78 |
79 | def uploadlimit(chat_id, limit):
80 | dbcol.update_one({"_id": chat_id}, {"$set": {"uploadlimit": limit}})
81 |
82 |
83 | def addpre(chat_id):
84 | date = add_date()
85 | dbcol.update_one({"_id": chat_id}, {"$set": {"prexdate": date[0]}})
86 |
87 |
88 | def addpredata(chat_id):
89 | dbcol.update_one({"_id": chat_id}, {"$set": {"prexdate": None}})
90 |
91 |
92 | def daily(chat_id, date):
93 | dbcol.update_one({"_id": chat_id}, {"$set": {"daily": date}})
94 |
95 |
96 | def find(chat_id):
97 | id = {"_id": chat_id}
98 | x = dbcol.find(id)
99 | for i in x:
100 | file = i["file_id"]
101 | try:
102 | caption = i["caption"]
103 | except:
104 | caption = None
105 |
106 | return [file, caption]
107 |
108 |
109 | def getid():
110 | values = []
111 | for key in dbcol.find():
112 | id = key["_id"]
113 | values.append((id))
114 | return values
115 |
116 | def delete(id):
117 | dbcol.delete_one(id)
118 |
119 |
120 | def find_one(id):
121 | return dbcol.find_one({"_id": id})
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
🤍 Thanks for Being Here 🤍
8 | 9 | 10 | ### ⚡️ Configs 11 | 12 | * `TOKEN` - Get bot token from @BotFather 13 | 14 | * `API_ID` - From my.telegram.org 15 | 16 | * `API_HASH` - From my.telegram.org 17 | 18 | * `ADMIN` - AUTH or bot controllers id's multiple id use space to split 19 | 20 | * `DB_URL` - Mongo Database URL from https://cloud.mongodb.com/ 21 | 22 | * `DB_NAME` - Your database name from mongoDB. Default will be 'my' 23 | 24 | * `CHANNEL` - your force sub channel username without @ 25 | 26 | * `LAZY_PIC` - start message photo 27 | 28 | * `STRING` - If you want to rename 4GB+ files. `[Note :- Remove string if bot don't works]` 29 | 30 | * `BOT_USERNAME` - Add bot username `without @` . 31 | 32 | ### 📶 DEPLOYEMENT SUPPORT 33 | 34 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
49 |
❣️ GANGSTER-BABY 🔥
114 | 115 | -------------------------------------------------------------------------------- /plugins/admin.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import ( 2 | InlineKeyboardButton, InlineKeyboardMarkup, ForceReply) 3 | import os 4 | from pyrogram import Client, filters 5 | from helper.date import add_date 6 | from helper.database import uploadlimit, usertype, addpre 7 | ADMIN = int(os.environ.get("ADMIN", 1484670284)) 8 | log_channel = int(os.environ.get("LOG_CHANNEL", "")) 9 | 10 | 11 | @Client.on_message(filters.private & filters.user(ADMIN) & filters.command(["warn"])) 12 | async def warn(c, m): 13 | if len(m.command) >= 3: 14 | try: 15 | user_id = m.text.split(' ', 2)[1] 16 | reason = m.text.split(' ', 2)[2] 17 | await m.reply_text("User Notfied Sucessfully") 18 | await c.send_message(chat_id=int(user_id), text=reason) 19 | except: 20 | await m.reply_text("User Not Notfied Sucessfully 😔") 21 | 22 | 23 | @Client.on_message(filters.private & filters.user(ADMIN) & filters.command(["addpremium"])) 24 | async def buypremium(bot, message): 25 | await message.reply_text("🦋 Select Plan to upgrade...", quote=True, reply_markup=InlineKeyboardMarkup([ 26 | [ 27 | InlineKeyboardButton("🪙 Silver", callback_data="vip1") 28 | ], [ 29 | InlineKeyboardButton("💫Gold", callback_data="vip2") 30 | ], [ 31 | InlineKeyboardButton("💎 Diamond", callback_data="vip3") 32 | ]])) 33 | 34 | 35 | @Client.on_message((filters.channel | filters.private) & filters.user(ADMIN) & filters.command(["ceasepower"])) 36 | async def ceasepremium(bot, message): 37 | await message.reply_text(" POWER CEASE MODE", quote=True, reply_markup=InlineKeyboardMarkup([ 38 | [InlineKeyboardButton("•× Limit 500MB ו", callback_data="cp1"), 39 | InlineKeyboardButton("•× Limit 100MB ו", callback_data="cp2") 40 | ], [ 41 | InlineKeyboardButton("•••× CEASE ALL POWER ו••", callback_data="cp3") 42 | ]])) 43 | 44 | 45 | @Client.on_message((filters.channel | filters.private) & filters.user(ADMIN) & filters.command(["resetpower"])) 46 | async def resetpower(bot, message): 47 | await message.reply_text(text=f"Do you really want to reset daily limit to default data limit 1.2GB ?",quote=True,reply_markup=InlineKeyboardMarkup([ 48 | [InlineKeyboardButton("• YES ! Set as Default •",callback_data = "dft")], 49 | [InlineKeyboardButton("❌ Cancel ❌",callback_data = "cancel")] 50 | ])) 51 | 52 | 53 | @Client.on_callback_query(filters.regex('vip1')) 54 | async def vip1(bot,update): 55 | id = update.message.reply_to_message.text.split("/addpremium") 56 | user_id = id[1].replace(" ", "") 57 | inlimit = 10737418240 58 | uploadlimit(int(user_id),10737418240) 59 | usertype(int(user_id),"🪙 **SILVER**") 60 | addpre(int(user_id)) 61 | await update.message.edit("Added successfully To Premium Upload limit 10 GB") 62 | await bot.send_message(user_id,"Hey you are Upgraded To silver. check your plan here /myplan") 63 | await bot.send_message(log_channel,f"⚡️ Plan Upgraded successfully 💥\n\nHey you are Upgraded To silver. check your plan here /myplan") 64 | 65 | @Client.on_callback_query(filters.regex('vip2')) 66 | async def vip2(bot,update): 67 | id = update.message.reply_to_message.text.split("/addpremium") 68 | user_id = id[1].replace(" ", "") 69 | inlimit = 53687091200 70 | uploadlimit(int(user_id), 53687091200) 71 | usertype(int(user_id),"💫 **GOLD**") 72 | addpre(int(user_id)) 73 | await update.message.edit("Added successfully To Premium Upload limit 50 GB") 74 | await bot.send_message(user_id,"Hey you are Upgraded To Gold. check your plan here /myplan") 75 | 76 | @Client.on_callback_query(filters.regex('vip3')) 77 | async def vip3(bot,update): 78 | id = update.message.reply_to_message.text.split("/addpremium") 79 | user_id = id[1].replace(" ", "") 80 | inlimit = 107374182400 81 | uploadlimit(int(user_id), 107374182400) 82 | usertype(int(user_id),"💎 **DIAMOND**") 83 | addpre(int(user_id)) 84 | await update.message.edit("Added successfully To Premium Upload limit 100 GB") 85 | await bot.send_message(user_id,"Hey you are Upgraded To Diamond. check your plan here /myplan") 86 | 87 | # CEASE POWER MODE @LAZYDEVELOPER 88 | 89 | @Client.on_callback_query(filters.regex('cp1')) 90 | async def cp1(bot,update): 91 | id = update.message.reply_to_message.text.split("/ceasepower") 92 | user_id = id[1].replace(" ", "") 93 | inlimit = 524288000 94 | uploadlimit(int(user_id),524288000) 95 | usertype(int(user_id),"**ACCOUNT DOWNGRADED**") 96 | addpre(int(user_id)) 97 | await update.message.edit("ACCOUNT DOWNGRADED\nThe user can only use 100MB/day from Data qota") 98 | await bot.send_message(user_id,"⚠️ Warning ⚠️\n\n- ACCOUNT DOWNGRADED\nYou can only use 500MB/day from Data qota.\nCheck your plan here - /myplan\n- Contact Admin 🦋**LazyDeveloper**🦋") 99 | 100 | @Client.on_callback_query(filters.regex('cp2')) 101 | async def cp2(bot,update): 102 | id = update.message.reply_to_message.text.split("/ceasepower") 103 | user_id = id[1].replace(" ", "") 104 | inlimit = 104857600 105 | uploadlimit(int(user_id), 104857600) 106 | usertype(int(user_id),"**ACCOUNT DOWNGRADED Lv-2**") 107 | addpre(int(user_id)) 108 | await update.message.edit("ACCOUNT DOWNGRADED to Level 2\nThe user can only use 100MB/day from Data qota") 109 | await bot.send_message(user_id,"⛔️ Last Warning ⛔️\n\n- ACCOUNT DOWNGRADED to Level 2\nYou can only use 100MB/day from Data qota.\nCheck your plan here - /myplan\n- Contact Admin 🦋**LazyDeveloper**🦋") 110 | 111 | @Client.on_callback_query(filters.regex('cp3')) 112 | async def cp3(bot,update): 113 | id = update.message.reply_to_message.text.split("/ceasepower") 114 | user_id = id[1].replace(" ", "") 115 | inlimit = 0 116 | uploadlimit(int(user_id), 0) 117 | usertype(int(user_id),"**POWER CEASED !**") 118 | addpre(int(user_id)) 119 | await update.message.edit("All power ceased from the user.\nThis account has 0 mb renaming capacity ") 120 | await bot.send_message(user_id,"🚫 All POWER CEASED 🚫\n\n- All power has been ceased from you \nFrom now you can't rename files using me\nCheck your plan here - /myplan\n- Contact Admin 🦋**LazyDeveloper**🦋") 121 | 122 | @Client.on_callback_query(filters.regex('dft')) 123 | async def dft(bot,update): 124 | id = update.message.reply_to_message.text.split("/resetpower") 125 | user_id = id[1].replace(" ", "") 126 | inlimit = 1288490188 127 | uploadlimit(int(user_id), 1288490188) 128 | usertype(int(user_id),"**Free**") 129 | addpre(int(user_id)) 130 | await update.message.edit("Daily Data limit has been reset successsfully.\nThis account has default 1.2 GB renaming capacity ") 131 | await bot.send_message(user_id,"Your Daily Data limit has been reset successsfully.\n\nCheck your plan here - /myplan\n- Contact Admin 🦋**LazyDeveloper**🦋") 132 | -------------------------------------------------------------------------------- /plugins/start.py: -------------------------------------------------------------------------------- 1 | from datetime import date as date_ 2 | import datetime 3 | import os 4 | from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant 5 | import time 6 | from pyrogram import Client, filters 7 | from pyrogram.types import ( 8 | InlineKeyboardButton, InlineKeyboardMarkup) 9 | import humanize 10 | from helper.progress import humanbytes 11 | 12 | from helper.database import insert, find_one, used_limit, usertype, uploadlimit, addpredata, total_rename, total_size 13 | from pyrogram.file_id import FileId 14 | from helper.database import daily as daily_ 15 | from helper.date import check_expi 16 | import os 17 | 18 | CHANNEL = os.environ.get('CHANNEL', "") 19 | STRING = os.environ.get("STRING", "") 20 | ADMIN = int(os.environ.get("ADMIN", 1484670284)) 21 | bot_username = os.environ.get("BOT_USERNAME","GangsterBaby_renamer_BOT") 22 | log_channel = int(os.environ.get("LOG_CHANNEL", "")) 23 | token = os.environ.get('TOKEN', '') 24 | botid = token.split(':')[0] 25 | FLOOD = 500 26 | LAZY_PIC = os.environ.get("LAZY_PIC", "") 27 | 28 | 29 | # Part of Day -------------------- 30 | currentTime = datetime.datetime.now() 31 | 32 | if currentTime.hour < 12: 33 | wish = "❤️ Good morning sweetheart ❤️" 34 | elif 12 <= currentTime.hour < 12: 35 | wish = '🤍 Good afternoon my Love 🤍' 36 | else: 37 | wish = '🦋 Good evening baby 🦋' 38 | 39 | # ------------------------------- 40 | 41 | 42 | @Client.on_message(filters.private & filters.command(["start"])) 43 | async def start(client, message): 44 | old = insert(int(message.chat.id)) 45 | try: 46 | id = message.text.split(' ')[1] 47 | except: 48 | txt=f"""Hello {wish} {message.from_user.first_name } \n\n 49 | I am file renamer bot, Please sent any telegram**Document Or Video** and enter new filename to rename it""" 50 | await message.reply_photo(photo=LAZY_PIC, 51 | caption=txt, 52 | reply_markup=InlineKeyboardMarkup( 53 | [[InlineKeyboardButton("🔺 Update Channel 🔺", url="https://t.me/LazyDeveloper")], 54 | [InlineKeyboardButton("🦋 Subscribe us 🦋", url="https://youtube.com/@LazyDeveloperr")], 55 | [InlineKeyboardButton("Support Group", url='https://t.me/LazyPrincessSupport'), 56 | InlineKeyboardButton("Movie Channel", url='https://t.me/real_MoviesAdda2')], 57 | [InlineKeyboardButton("☕ Buy Me A Coffee ☕", url='https://p.paytm.me/xCTH/vo37hii9')] 58 | ])) 59 | return 60 | if id: 61 | if old == True: 62 | try: 63 | await client.send_message(id, "Your Friend is Already Using Our Bot") 64 | await message.reply_photo(photo=LAZY_PIC, 65 | caption=txt, 66 | reply_markup=InlineKeyboardMarkup( 67 | [[InlineKeyboardButton("🔺 Update Channel 🔺", url="https://t.me/LazyDeveloper")], 68 | [InlineKeyboardButton("🦋 Subscribe us 🦋", url="https://youtube.com/@LazyDeveloperr")], 69 | [InlineKeyboardButton("Support Group", url='https://t.me/LazyPrincessSupport'), 70 | InlineKeyboardButton("Movie Channel", url='https://t.me/real_MoviesAdda2')], 71 | [InlineKeyboardButton("☕ Buy Me A Coffee ☕", url='https://p.paytm.me/xCTH/vo37hii9')] 72 | ])) 73 | except: 74 | return 75 | else: 76 | await client.send_message(id, "Congrats! You Won 100MB Upload limit") 77 | _user_ = find_one(int(id)) 78 | limit = _user_["uploadlimit"] 79 | new_limit = limit + 104857600 80 | uploadlimit(int(id), new_limit) 81 | await message.reply_text(text=f""" 82 | Hello {wish} {message.from_user.first_name }\n\n 83 | __I am file renamer bot, Please send any telegram 84 | **Document Or Video** and enter new filename to rename it__ 85 | """, reply_to_message_id=message.id, 86 | reply_markup=InlineKeyboardMarkup( 87 | [[InlineKeyboardButton("🔺 Update Channel 🔺", url="https://t.me/LazyDeveloper")], 88 | [InlineKeyboardButton("🦋 Subscribe us 🦋", url="https://youtube.com/@LazyDeveloperr")], 89 | [InlineKeyboardButton("Support Group", url='https://t.me/LazyPrincessSupport'), 90 | InlineKeyboardButton("Movie Channel", url='https://t.me/real_MoviesAdda2')], 91 | [InlineKeyboardButton("☕ Buy Me A Coffee ☕", url='https://p.paytm.me/xCTH/vo37hii9')] 92 | ])) 93 | 94 | 95 | 96 | @Client.on_message((filters.private & (filters.document | filters.audio | filters.video)) | filters.channel & (filters.document | filters.audio | filters.video)) 97 | async def send_doc(client, message): 98 | update_channel = CHANNEL 99 | user_id = message.from_user.id 100 | if update_channel: 101 | try: 102 | await client.get_chat_member(update_channel, user_id) 103 | except UserNotParticipant: 104 | _newus = find_one(message.from_user.id) 105 | user = _newus["usertype"] 106 | await message.reply_text("**__You are not subscribed my channel__** ", 107 | reply_to_message_id=message.id, 108 | reply_markup=InlineKeyboardMarkup( 109 | [[InlineKeyboardButton("🔺 Update Channel 🔺", url=f"https://t.me/{update_channel}")]])) 110 | await client.send_message(log_channel,f"🦋 #GangsterBaby_LOGS 🦋,\n\n**ID** : `{user_id}`\n**Name**: {message.from_user.first_name} {message.from_user.last_name}\n**User-Plan** : {user}\n\n ", 111 | reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🔺 Restrict User ( **pm** ) 🔺", callback_data="ceasepower")]])) 112 | return 113 | 114 | try: 115 | bot_data = find_one(int(botid)) 116 | prrename = bot_data['total_rename'] 117 | prsize = bot_data['total_size'] 118 | user_deta = find_one(user_id) 119 | except: 120 | await message.reply_text("Use About cmd first /about") 121 | try: 122 | used_date = user_deta["date"] 123 | buy_date = user_deta["prexdate"] 124 | daily = user_deta["daily"] 125 | user_type = user_deta["usertype"] 126 | except: 127 | await message.reply_text(text=f"Hello dear {message.from_user.first_name} **we are currently working on this issue**\n\nPlease try to rename files from your another account.\nBecause this BOT can't rename file sent by some ids.\n\nIf you are an **ADMIN** Don't worry ! here we have a solution for you dear {message.from_user.first_name }.\n\nPlease use \n👉 `/addpremium your_other_userid` 👈 to use premium feautres\n\n", 128 | reply_markup=InlineKeyboardMarkup([ 129 | [InlineKeyboardButton("🦋 Contact LazyDeveloper 🦋", url='https://telegram.me/LazyDeveloper')], 130 | [InlineKeyboardButton("🔺 Watch Tutorial 🔺", url='https://youtube.com/@LazyDeveloperr')], 131 | [InlineKeyboardButton("🦋 Visit Channel ", url='https://t.me/LazyDeveloper'), 132 | InlineKeyboardButton(" Support Group 🦋", url='https://t.me/LazyPrincessSupport')], 133 | [InlineKeyboardButton("☕ Buy Me A Coffee ☕", url='https://p.paytm.me/xCTH/vo37hii9')] 134 | ])) 135 | await message.reply_text(text=f"🦋") 136 | return 137 | 138 | c_time = time.time() 139 | 140 | if user_type == "Free": 141 | LIMIT = 600 142 | else: 143 | LIMIT = 50 144 | then = used_date + LIMIT 145 | left = round(then - c_time) 146 | conversion = datetime.timedelta(seconds=left) 147 | ltime = str(conversion) 148 | if left > 0: 149 | await message.reply_text(f"```Sorry Dude I am not only for YOU \n Flood control is active so please wait for {ltime}```", reply_to_message_id=message.id) 150 | else: 151 | # Forward a single message 152 | media = await client.get_messages(message.chat.id, message.id) 153 | file = media.document or media.video or media.audio 154 | dcid = FileId.decode(file.file_id).dc_id 155 | filename = file.file_name 156 | value = 2147483648 157 | used_ = find_one(message.from_user.id) 158 | used = used_["used_limit"] 159 | limit = used_["uploadlimit"] 160 | expi = daily - int(time.mktime(time.strptime(str(date_.today()), '%Y-%m-%d'))) 161 | if expi != 0: 162 | today = date_.today() 163 | pattern = '%Y-%m-%d' 164 | epcho = int(time.mktime(time.strptime(str(today), pattern))) 165 | daily_(message.from_user.id, epcho) 166 | used_limit(message.from_user.id, 0) 167 | remain = limit - used 168 | if remain < int(file.file_size): 169 | await message.reply_text(f"100% of daily {humanbytes(limit)} data quota exhausted.\n\n File size detected {humanbytes(file.file_size)}\n Used Daily Limit {humanbytes(used)}\n\nYou have only **{humanbytes(remain)}** left on your Account.\nIf U Want to Rename Large File Upgrade Your Plan ", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Upgrade 💰💳", callback_data="upgrade")]])) 170 | return 171 | if value < file.file_size: 172 | 173 | if STRING: 174 | if buy_date == None: 175 | await message.reply_text(f" You Can't Upload More Then {humanbytes(limit)} Used Daily Limit {humanbytes(used)} ", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Upgrade 💰💳", callback_data="upgrade")]])) 176 | return 177 | pre_check = check_expi(buy_date) 178 | if pre_check == True: 179 | await message.reply_text(f"""__What do you want me to do with this file?__\n**File Name** :- {filename}\n**File Size** :- {humanize.naturalsize(file.file_size)}\n**Dc ID** :- {dcid}""", reply_to_message_id=message.id, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("📝 Rename", callback_data="rename"), InlineKeyboardButton("✖️ Cancel", callback_data="cancel")]])) 180 | total_rename(int(botid), prrename) 181 | total_size(int(botid), prsize, file.file_size) 182 | else: 183 | uploadlimit(message.from_user.id, 1288490188) 184 | usertype(message.from_user.id, "Free") 185 | 186 | await message.reply_text(f'Your Plan Expired On {buy_date}', quote=True) 187 | return 188 | else: 189 | await message.reply_text("Can't upload files bigger than 2GB ") 190 | return 191 | else: 192 | if buy_date: 193 | pre_check = check_expi(buy_date) 194 | if pre_check == False: 195 | uploadlimit(message.from_user.id, 1288490188) 196 | usertype(message.from_user.id, "Free") 197 | 198 | filesize = humanize.naturalsize(file.file_size) 199 | fileid = file.file_id 200 | total_rename(int(botid), prrename) 201 | total_size(int(botid), prsize, file.file_size) 202 | await message.reply_text(f"""__What do you want me to do with this file?__\n**File Name** :- {filename}\n**File Size** :- {filesize}\n**Dc ID** :- {dcid}""", reply_to_message_id=message.id, reply_markup=InlineKeyboardMarkup( 203 | [[InlineKeyboardButton("📝 Rename", callback_data="rename"), 204 | InlineKeyboardButton("✖️ Cancel", callback_data="cancel")]])) 205 | -------------------------------------------------------------------------------- /plugins/cb_data.py: -------------------------------------------------------------------------------- 1 | from helper.progress import progress_for_pyrogram, TimeFormatter 2 | 3 | from pyrogram import Client, filters 4 | from pyrogram.types import ( 5 | InlineKeyboardButton, InlineKeyboardMarkup, ForceReply) 6 | from hachoir.metadata import extractMetadata 7 | from hachoir.parser import createParser 8 | from helper.database import * 9 | import os 10 | import random 11 | from PIL import Image 12 | import time 13 | from datetime import timedelta 14 | from helper.ffmpeg import take_screen_shot, fix_thumb 15 | from helper.progress import humanbytes 16 | from helper.set import escape_invalid_curly_brackets 17 | import os 18 | 19 | log_channel = int(os.environ.get("LOG_CHANNEL", "")) 20 | 21 | API_ID = int(os.environ.get("API_ID", "")) 22 | 23 | API_HASH = os.environ.get("API_HASH", "") 24 | 25 | STRING = os.environ.get("STRING", "") 26 | 27 | ADMIN = os.environ.get("ADMIN", "") 28 | 29 | app = Client("test", api_id=API_ID, api_hash=API_HASH, session_string=STRING) 30 | 31 | 32 | @Client.on_callback_query(filters.regex('cancel')) 33 | async def cancel(bot, update): 34 | try: 35 | await update.message.delete() 36 | except: 37 | return 38 | 39 | 40 | @Client.on_callback_query(filters.regex('rename')) 41 | async def rename(bot, update): 42 | date_fa = str(update.message.date) 43 | pattern = '%Y-%m-%d %H:%M:%S' 44 | date = int(time.mktime(time.strptime(date_fa, pattern))) 45 | chat_id = update.message.chat.id 46 | id = update.message.reply_to_message_id 47 | await update.message.delete() 48 | await update.message.reply_text(f"__Please enter the new filename...__\n\nNote:- Extension Not Required", reply_to_message_id=id, 49 | reply_markup=ForceReply(True)) 50 | dateupdate(chat_id, date) 51 | 52 | 53 | @Client.on_callback_query(filters.regex("doc")) 54 | async def doc(bot, update): 55 | new_name = update.message.text 56 | used_ = find_one(update.from_user.id) 57 | used = used_["used_limit"] 58 | date = used_["date"] 59 | name = new_name.split(":-") 60 | new_filename = name[1] 61 | file_path = f"downloads/{new_filename}" 62 | message = update.message.reply_to_message 63 | file = message.document or message.video or message.audio 64 | ms = await update.message.edit("```Trying To Download...```") 65 | used_limit(update.from_user.id, file.file_size) 66 | c_time = time.time() 67 | total_used = used + int(file.file_size) 68 | used_limit(update.from_user.id, total_used) 69 | try: 70 | path = await bot.download_media(message=file, progress=progress_for_pyrogram, progress_args=("``` Trying To Download...```", ms, c_time)) 71 | 72 | except Exception as e: 73 | neg_used = used - int(file.file_size) 74 | used_limit(update.from_user.id, neg_used) 75 | await ms.edit(e) 76 | return 77 | splitpath = path.split("/downloads/") 78 | dow_file_name = splitpath[1] 79 | old_file_name = f"downloads/{dow_file_name}" 80 | os.rename(old_file_name, file_path) 81 | user_id = int(update.message.chat.id) 82 | data = find(user_id) 83 | try: 84 | c_caption = data[1] 85 | except: 86 | pass 87 | thumb = data[0] 88 | if c_caption: 89 | doc_list = ["filename", "filesize"] 90 | new_tex = escape_invalid_curly_brackets(c_caption, doc_list) 91 | caption = new_tex.format( 92 | filename=new_filename, filesize=humanbytes(file.file_size)) 93 | else: 94 | caption = f"**{new_filename}**" 95 | if thumb: 96 | ph_path = await bot.download_media(thumb) 97 | Image.open(ph_path).convert("RGB").save(ph_path) 98 | img = Image.open(ph_path) 99 | img.resize((320, 320)) 100 | img.save(ph_path, "JPEG") 101 | c_time = time.time() 102 | 103 | else: 104 | ph_path = None 105 | 106 | value = 2090000000 107 | if value < file.file_size: 108 | await ms.edit("```Trying To Upload```") 109 | try: 110 | filw = await app.send_document(log_channel, document=file_path, thumb=ph_path, caption=caption, progress=progress_for_pyrogram, progress_args=("```Trying To Uploading```", ms, c_time)) 111 | from_chat = filw.chat.id 112 | mg_id = filw.id 113 | time.sleep(2) 114 | await bot.copy_message(update.from_user.id, from_chat, mg_id) 115 | await ms.delete() 116 | os.remove(file_path) 117 | try: 118 | os.remove(ph_path) 119 | except: 120 | pass 121 | except Exception as e: 122 | neg_used = used - int(file.file_size) 123 | used_limit(update.from_user.id, neg_used) 124 | await ms.edit(e) 125 | os.remove(file_path) 126 | try: 127 | os.remove(ph_path) 128 | except: 129 | return 130 | else: 131 | await ms.edit("```Trying To Upload```") 132 | c_time = time.time() 133 | try: 134 | await bot.send_document(update.from_user.id, document=file_path, thumb=ph_path, caption=caption, progress=progress_for_pyrogram, progress_args=("```Trying To Uploading```", ms, c_time)) 135 | await ms.delete() 136 | os.remove(file_path) 137 | except Exception as e: 138 | neg_used = used - int(file.file_size) 139 | used_limit(update.from_user.id, neg_used) 140 | await ms.edit(e) 141 | os.remove(file_path) 142 | return 143 | 144 | 145 | @Client.on_callback_query(filters.regex("vid")) 146 | async def vid(bot, update): 147 | new_name = update.message.text 148 | used_ = find_one(update.from_user.id) 149 | used = used_["used_limit"] 150 | date = used_["date"] 151 | name = new_name.split(":-") 152 | new_filename = name[1] 153 | file_path = f"downloads/{new_filename}" 154 | message = update.message.reply_to_message 155 | file = message.document or message.video or message.audio 156 | ms = await update.message.edit("```Trying To Download...```") 157 | used_limit(update.from_user.id, file.file_size) 158 | c_time = time.time() 159 | total_used = used + int(file.file_size) 160 | used_limit(update.from_user.id, total_used) 161 | try: 162 | path = await bot.download_media(message=file, progress=progress_for_pyrogram, progress_args=("``` Trying To Download...```", ms, c_time)) 163 | 164 | except Exception as e: 165 | neg_used = used - int(file.file_size) 166 | used_limit(update.from_user.id, neg_used) 167 | await ms.edit(e) 168 | return 169 | splitpath = path.split("/downloads/") 170 | dow_file_name = splitpath[1] 171 | old_file_name = f"downloads/{dow_file_name}" 172 | os.rename(old_file_name, file_path) 173 | user_id = int(update.message.chat.id) 174 | data = find(user_id) 175 | try: 176 | c_caption = data[1] 177 | except: 178 | pass 179 | thumb = data[0] 180 | 181 | duration = 0 182 | metadata = extractMetadata(createParser(file_path)) 183 | if metadata.has("duration"): 184 | duration = metadata.get('duration').seconds 185 | if c_caption: 186 | vid_list = ["filename", "filesize", "duration"] 187 | new_tex = escape_invalid_curly_brackets(c_caption, vid_list) 188 | caption = new_tex.format(filename=new_filename, filesize=humanbytes( 189 | file.file_size), duration=timedelta(seconds=duration)) 190 | else: 191 | caption = f"**{new_filename}**" 192 | if thumb: 193 | ph_path = await bot.download_media(thumb) 194 | Image.open(ph_path).convert("RGB").save(ph_path) 195 | img = Image.open(ph_path) 196 | img.resize((320, 320)) 197 | img.save(ph_path, "JPEG") 198 | c_time = time.time() 199 | 200 | else: 201 | try: 202 | ph_path_ = await take_screen_shot(file_path, os.path.dirname(os.path.abspath(file_path)), random.randint(0, duration - 1)) 203 | width, height, ph_path = await fix_thumb(ph_path_) 204 | except Exception as e: 205 | ph_path = None 206 | print(e) 207 | 208 | value = 2090000000 209 | if value < file.file_size: 210 | await ms.edit("```Trying To Upload```") 211 | try: 212 | filw = await app.send_video(log_channel, video=file_path, thumb=ph_path, duration=duration, caption=caption, progress=progress_for_pyrogram, progress_args=("```Trying To Uploading```", ms, c_time)) 213 | from_chat = filw.chat.id 214 | mg_id = filw.id 215 | time.sleep(2) 216 | await bot.copy_message(update.from_user.id, from_chat, mg_id) 217 | await ms.delete() 218 | os.remove(file_path) 219 | try: 220 | os.remove(ph_path) 221 | except: 222 | pass 223 | except Exception as e: 224 | neg_used = used - int(file.file_size) 225 | used_limit(update.from_user.id, neg_used) 226 | await ms.edit(e) 227 | os.remove(file_path) 228 | try: 229 | os.remove(ph_path) 230 | except: 231 | return 232 | else: 233 | await ms.edit("```Trying To Upload```") 234 | c_time = time.time() 235 | try: 236 | await bot.send_video(update.from_user.id, video=file_path, thumb=ph_path, duration=duration, caption=caption, progress=progress_for_pyrogram, progress_args=("```Trying To Uploading```", ms, c_time)) 237 | await ms.delete() 238 | os.remove(file_path) 239 | except Exception as e: 240 | neg_used = used - int(file.file_size) 241 | used_limit(update.from_user.id, neg_used) 242 | await ms.edit(e) 243 | os.remove(file_path) 244 | return 245 | 246 | 247 | @Client.on_callback_query(filters.regex("aud")) 248 | async def aud(bot, update): 249 | new_name = update.message.text 250 | used_ = find_one(update.from_user.id) 251 | used = used_["used_limit"] 252 | name = new_name.split(":-") 253 | new_filename = name[1] 254 | file_path = f"downloads/{new_filename}" 255 | message = update.message.reply_to_message 256 | file = message.document or message.video or message.audio 257 | total_used = used + int(file.file_size) 258 | used_limit(update.from_user.id, total_used) 259 | ms = await update.message.edit("```Trying To Download...```") 260 | c_time = time.time() 261 | try: 262 | path = await bot.download_media(message=file, progress=progress_for_pyrogram, progress_args=("``` Trying To Download...```", ms, c_time)) 263 | except Exception as e: 264 | neg_used = used - int(file.file_size) 265 | used_limit(update.from_user.id, neg_used) 266 | await ms.edit(e) 267 | return 268 | splitpath = path.split("/downloads/") 269 | dow_file_name = splitpath[1] 270 | old_file_name = f"downloads/{dow_file_name}" 271 | os.rename(old_file_name, file_path) 272 | duration = 0 273 | metadata = extractMetadata(createParser(file_path)) 274 | if metadata.has("duration"): 275 | duration = metadata.get('duration').seconds 276 | user_id = int(update.message.chat.id) 277 | data = find(user_id) 278 | c_caption = data[1] 279 | thumb = data[0] 280 | if c_caption: 281 | aud_list = ["filename", "filesize", "duration"] 282 | new_tex = escape_invalid_curly_brackets(c_caption, aud_list) 283 | caption = new_tex.format(filename=new_filename, filesize=humanbytes( 284 | file.file_size), duration=timedelta(seconds=duration)) 285 | else: 286 | caption = f"**{new_filename}**" 287 | 288 | if thumb: 289 | ph_path = await bot.download_media(thumb) 290 | Image.open(ph_path).convert("RGB").save(ph_path) 291 | img = Image.open(ph_path) 292 | img.resize((320, 320)) 293 | img.save(ph_path, "JPEG") 294 | await ms.edit("```Trying To Upload```") 295 | c_time = time.time() 296 | try: 297 | await bot.send_audio(update.message.chat.id, audio=file_path, caption=caption, thumb=ph_path, duration=duration, progress=progress_for_pyrogram, progress_args=("```Trying To Uploading```", ms, c_time)) 298 | await ms.delete() 299 | os.remove(file_path) 300 | os.remove(ph_path) 301 | except Exception as e: 302 | neg_used = used - int(file.file_size) 303 | used_limit(update.from_user.id, neg_used) 304 | await ms.edit(e) 305 | os.remove(file_path) 306 | os.remove(ph_path) 307 | else: 308 | await ms.edit("```Trying To Upload```") 309 | c_time = time.time() 310 | try: 311 | await bot.send_audio(update.message.chat.id, audio=file_path, caption=caption, duration=duration, progress=progress_for_pyrogram, progress_args=("```Trying To Uploading```", ms, c_time)) 312 | await ms.delete() 313 | os.remove(file_path) 314 | except Exception as e: 315 | await ms.edit(e) 316 | neg_used = used - int(file.file_size) 317 | used_limit(update.from_user.id, neg_used) 318 | os.remove(file_path) 319 | 320 | 321 | # 322 | # LazyDeveloperr 323 | # 324 | --------------------------------------------------------------------------------