Skip to content

Commit 446285e

Browse files
authored
All Files Added - Credits @ThiruXD
0 parents  commit 446285e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1908
-0
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM python:3.10
2+
WORKDIR /app
3+
COPY . /app/
4+
RUN pip install -r requirements.txt
5+
CMD ["python", "bot.py"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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.

LazyDeveloper.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
worker: python3 bot.py

app.json

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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/Maheshbot99/Rename1",
21+
22+
"success_url": "https://telegram.dog/Cinema_Rockets",
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+
}

app.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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()

bot.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import asyncio
2+
from pyrogram import Client, compose,idle
3+
import os
4+
from aiohttp import web
5+
from route import web_server
6+
from config import *
7+
from plugins.cb_data import app as Client2
8+
9+
bot = Client(
10+
11+
"Renamerone",
12+
13+
bot_token=TOKEN_ONE,
14+
15+
api_id=API_ID,
16+
17+
api_hash=API_HASH,
18+
19+
plugins=dict(root='plugins'))
20+
21+
22+
if STRING:
23+
apps = [Client2,bot]
24+
for app in apps:
25+
app.start()
26+
idle()
27+
for app in apps:
28+
app.stop()
29+
30+
else:
31+
bot.run()
32+

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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}

helper/database.py

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import pymongo
2+
import os
3+
from helper.date import add_date
4+
from config import *
5+
mongo = pymongo.MongoClient(DB_URL)
6+
db = mongo[DB_NAME]
7+
dbcol = db["user"]
8+
9+
10+
def total_user():
11+
user = dbcol.count_documents({})
12+
return user
13+
14+
# insert bot Data
15+
16+
17+
def botdata(chat_id):
18+
bot_id = int(chat_id)
19+
try:
20+
bot_data = {"_id": bot_id, "total_rename": 0, "total_size": 0}
21+
dbcol.insert_one(bot_data)
22+
except:
23+
pass
24+
25+
26+
def total_rename(chat_id, renamed_file):
27+
now = int(renamed_file) + 1
28+
dbcol.update_one({"_id": chat_id}, {"$set": {"total_rename": str(now)}})
29+
30+
31+
def total_size(chat_id, total_size, now_file_size):
32+
now = int(total_size) + now_file_size
33+
dbcol.update_one({"_id": chat_id}, {"$set": {"total_size": str(now)}})
34+
35+
36+
# insert user data
37+
def insert(chat_id):
38+
user_id = int(chat_id)
39+
user_det = {"_id": user_id, "file_id": None, "caption": None, "daily": 0, "date": 0,
40+
"uploadlimit": 2147483648, "used_limit": 0, "usertype": "Free", "prexdate": None}
41+
try:
42+
dbcol.insert_one(user_det)
43+
except:
44+
return True
45+
pass
46+
47+
48+
def addthumb(chat_id, file_id):
49+
dbcol.update_one({"_id": chat_id}, {"$set": {"file_id": file_id}})
50+
51+
52+
def delthumb(chat_id):
53+
dbcol.update_one({"_id": chat_id}, {"$set": {"file_id": None}})
54+
55+
56+
def addcaption(chat_id, caption):
57+
dbcol.update_one({"_id": chat_id}, {"$set": {"caption": caption}})
58+
59+
60+
def delcaption(chat_id):
61+
dbcol.update_one({"_id": chat_id}, {"$set": {"caption": None}})
62+
63+
64+
def dateupdate(chat_id, date):
65+
dbcol.update_one({"_id": chat_id}, {"$set": {"date": date}})
66+
67+
68+
def used_limit(chat_id, used):
69+
dbcol.update_one({"_id": chat_id}, {"$set": {"used_limit": used}})
70+
71+
72+
def usertype(chat_id, type):
73+
dbcol.update_one({"_id": chat_id}, {"$set": {"usertype": type}})
74+
75+
76+
def uploadlimit(chat_id, limit):
77+
dbcol.update_one({"_id": chat_id}, {"$set": {"uploadlimit": limit}})
78+
79+
80+
def addpre(chat_id):
81+
date = add_date()
82+
dbcol.update_one({"_id": chat_id}, {"$set": {"prexdate": date[0]}})
83+
84+
85+
def addpredata(chat_id):
86+
dbcol.update_one({"_id": chat_id}, {"$set": {"prexdate": None}})
87+
88+
89+
def daily(chat_id, date):
90+
dbcol.update_one({"_id": chat_id}, {"$set": {"daily": date}})
91+
92+
93+
def find(chat_id):
94+
id = {"_id": chat_id}
95+
x = dbcol.find(id)
96+
for i in x:
97+
file = i["file_id"]
98+
try:
99+
caption = i["caption"]
100+
except:
101+
caption = None
102+
103+
return [file, caption]
104+
105+
106+
def getid():
107+
values = []
108+
for key in dbcol.find():
109+
id = key["_id"]
110+
values.append((id))
111+
return values
112+
113+
def delete(id):
114+
dbcol.delete_one(id)
115+
116+
117+
def find_one(id):
118+
return dbcol.find_one({"_id": id})
119+

helper/date.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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

0 commit comments

Comments
 (0)