├── LICENSE ├── Procfile ├── README.md ├── app.json ├── bot.py └── requirements.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Arunkumar Shibu 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 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: python3 bot.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 𝗔𝗨𝗧𝗢-𝗗𝗘𝗟𝗘𝗧𝗘-𝗕𝗢𝗧 3 |

4 | 5 | ## Variables 6 | 1. `API_ID` : Get from [my.telegram.org](https://my.telegram.org/) 7 | 2. `API_HASH` : Get from [my.telegram.org](https://my.telegram.org) 8 | 3. `BOT_TOKEN` : Your telegram bot token from [@BotFather](https://t.me/BotFather) 9 | 4. `SESSION` : Generate from here [![GenerateStringName](https://img.shields.io/badge/repl.it-generateStringName-yellowgreen)](https://repl.it/@subinps/getStringName) 10 | 5. `GROUPS` : ID of Groups (seperate by spaces) 11 | 6. `ADMINS` : ID of Admins, messages from admins will not delete (seperate by spaces) 12 | 7. `TIME` : Time in seconds 13 | 14 | ### Make sure: 15 | - Bot is admin in Groups with delete permission 16 | - Account used to create SESSION is a member in Groups 17 | 18 | ## Deploy in Heroku 19 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) 20 | 21 | ## Deploy in your VPS 22 | 23 | ```sh 24 | git clone https://github.com/TG-V4MP1R3/Auto-Delete-Bot 25 | cd Auto-Delete-Bot 26 | pip3 install -r requirements.txt 27 | # 28 | python3 bot.py 29 | ``` 30 | 31 | ### Credits 32 | - [Pyrogram](https://github.com/pyrogram/pyrogram) 33 | 34 | 35 | ### Developer 36 | - [Vampire](https://t.me/KP51107) 37 | 38 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Auto-Delete-Bot", 3 | "description": "delete group messages after a specific time", 4 | "keywords": [ 5 | "telegram", 6 | "delete", 7 | "bot" 8 | ], 9 | "repository": "https://github.com/TG-V4MP1R3/Auto-Delete-Bot", 10 | "logo": "https://telegra.ph/file/8cd549b2beef98e83349e.jpg", 11 | "env": { 12 | "BOT_TOKEN": { 13 | "description": "Get it from @Botfather", 14 | "value": "" 15 | }, 16 | "API_ID": { 17 | "description": "Your telegram API ID, Get it from my.telegram.org", 18 | "value": "" 19 | }, 20 | "API_HASH":{ 21 | "description": "Your telegram API HASH, Get it from my.telegram.org", 22 | "value": "" 23 | }, 24 | "SESSION":{ 25 | "description": "Pyrogram session generated from the link in Readme", 26 | "value": "" 27 | }, 28 | "ADMINS":{ 29 | "description": "ID of admins", 30 | "value": "" 31 | }, 32 | "GROUPS":{ 33 | "description": "ID of the groups where the bot work (seperate by spaces)", 34 | "value": "" 35 | }, 36 | "TIME": { 37 | "description": "Time in seconds", 38 | "value": "300" 39 | } 40 | }, 41 | "buildpacks": [ 42 | { 43 | "url": "heroku/python" 44 | } 45 | ], 46 | "formation": { 47 | "worker": { 48 | "quantity": 1, 49 | "size": "free" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from os import environ 3 | from pyrogram import Client, filters, idle 4 | 5 | API_ID = int(environ.get("API_ID")) 6 | API_HASH = environ.get("API_HASH") 7 | BOT_TOKEN = environ.get("BOT_TOKEN") 8 | SESSION = environ.get("SESSION") 9 | TIME = int(environ.get("TIME")) 10 | GROUPS = [] 11 | for grp in environ.get("GROUPS").split(): 12 | GROUPS.append(int(grp)) 13 | ADMINS = [] 14 | for usr in environ.get("ADMINS").split(): 15 | ADMINS.append(int(usr)) 16 | 17 | START_MSG = "Hai {},\nI'm a private bot of @mh_world to delete group messages after a specific time" 18 | 19 | 20 | User = Client(name="user-account", 21 | session_string=SESSION, 22 | api_id=API_ID, 23 | api_hash=API_HASH, 24 | workers=300 25 | ) 26 | 27 | 28 | Bot = Client(name="auto-delete", 29 | api_id=API_ID, 30 | api_hash=API_HASH, 31 | bot_token=BOT_TOKEN, 32 | workers=300 33 | ) 34 | 35 | 36 | @Bot.on_message(filters.command('start') & filters.private) 37 | async def start(bot, message): 38 | await message.reply(START_MSG.format(message.from_user.mention)) 39 | 40 | @User.on_message(filters.chat(GROUPS)) 41 | async def delete(user, message): 42 | try: 43 | if message.from_user.id in ADMINS: 44 | return 45 | else: 46 | await asyncio.sleep(TIME) 47 | await Bot.delete_messages(message.chat.id, message.id) 48 | except Exception as e: 49 | print(e) 50 | 51 | User.start() 52 | print("User Started!") 53 | Bot.start() 54 | print("Bot Started!") 55 | 56 | idle() 57 | 58 | User.stop() 59 | print("User Stopped!") 60 | Bot.stop() 61 | print("Bot Stopped!") 62 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Pyrogram 2 | Tgcrypto 3 | --------------------------------------------------------------------------------