├── .github └── dependabot.yml ├── Dockerfile ├── LICENSE ├── Procfile ├── README.md ├── SECURITY.md ├── app.json ├── bot.py ├── config.py ├── helper ├── database.py ├── ffmpeg.py └── utils.py ├── plugins ├── Force_Sub.py ├── __init__.py ├── admin_panel.py ├── file_rename.py ├── metadata.py ├── prefix_&_suffix.py ├── start_&_cb.py ├── thumb_&_cap.py └── web_support.py ├── render.yaml ├── requirements.txt └── runtime.txt /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | #rkn 2 | # To get started with Dependabot version updates, you'll need to specify which 3 | # package ecosystems to update and where the package manifests are located. 4 | # Please see the documentation for all configuration options: 5 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 6 | 7 | version: 2 8 | updates: 9 | - package-ecosystem: "" # See documentation for possible values 10 | directory: "/" # Location of package manifests 11 | schedule: 12 | interval: "weekly" 13 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the official Python image 2 | FROM python:3.9-slim-buster 3 | 4 | RUN apt-get update -qq && apt-get -y install ffmpeg 5 | 6 | # Set the working directory in the container 7 | WORKDIR /app 8 | 9 | # Copy the dependencies file to the working directory 10 | COPY requirements.txt . 11 | 12 | # Install any needed dependencies specified in requirements.txt 13 | RUN pip install --no-cache-dir -r requirements.txt 14 | 15 | # Copy the rest of the application code to the working directory 16 | COPY . . 17 | 18 | # Command to run the application 19 | CMD ["python", "bot.py"] 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: python3 bot.py 2 | worker: python3 bot.py 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ![Typing SVG](https://readme-typing-svg.herokuapp.com/?lines=𝗪𝗘𝗟𝗖𝗢𝗠+𝗧𝗢+𝗗𝗜𝗚𝗜𝗧𝗔𝗟+𝗥𝗘𝗡𝗔𝗠𝗘+𝗕𝗢𝗧!;𝗖𝗥𝗘𝗔𝗧𝗘𝗗+𝗕𝗬+𝗗𝗜𝗚𝗜𝗧𝗔𝗟+𝗕𝗢𝗧𝗭!;𝗜+𝗔𝗠+𝗣𝗢𝗪𝗘𝗥𝗙𝗨𝗟+𝗧𝗚+𝗥𝗘𝗡𝗔𝗠𝗘+𝗕𝗢𝗧!)

4 | 5 | 6 | 7 | 8 |

9 | RKN RENAME BOT V3 10 |

11 | 12 |

13 | 14 | ![Fork](https://img.shields.io/github/forks/DigitalBotz/Digital-Rename-Bot?style=for-the-badge) 15 | ![Stars](https://img.shields.io/github/stars/DigitalBotz/Digital-Rename-Bot?color=%23&style=for-the-badge) 16 | ![License](https://img.shields.io/github/license/DigitalBotz/Digital-Rename-Bot?style=for-the-badge) 17 | ![Issues](https://img.shields.io/github/issues/DigitalBotz/Digital-Rename-Bot?style=for-the-badge) 18 | 19 |

20 | 21 | 22 | ### Sᴀᴍᴩʟᴇ Bᴏᴛ (Official Digital Rename Bot) 23 | 24 | * [Rkn_RenameBot](http://t.me/Rkn_RenameBot) 25 | * [Digital_Rename_Bot](http://t.me/Digital_Rename_Bot) 26 | 27 | 28 | ## Deploy Me 🥀 29 | 30 |
📌 Deploy to Koyeb 31 | 32 | [![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=git&repository=github.com/RknDeveloper/Digital-Rename-Bot&env[BOT_TOKEN]&env[API_ID]&env[API_HASH]&env[WEBHOOK]=True&env[ADMIN]&env[DB_URL]&env[DB_NAME]=Rkn-Developer&env[FORCE_SUB]&env[START_PIC]&env[LOG_CHANNEL]=You%20Dont%20Need%20LogChannel%20To%20Remove%20This%20Variable&run_command=python%20bot.py&branch=main&name=rkn-rename) 33 |
34 | 35 |
📌 Deploy to Render 36 | 37 | [![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/DigitalBotz/Digital-Rename-Bot) 38 | 39 |
40 | 41 |
📌 Deploy To Railway 42 | Deploy 43 |
44 | 45 |
📌 Deploy to Heroku 46 | 47 |

48 |
49 | 50 | ## Rᴇǫᴜɪʀᴇᴅ Cᴏɴғɪɢs 51 | 52 | * `BOT_TOKEN` - Get Bot Token From @BotFather 53 | * `API_ID` - From my.telegram.org 54 | * `API_HASH` - From my.telegram.org 55 | * `ADMIN` - AUTH Or Bot Controllers Id's Multiple Id Use Space To Split 56 | * `DB_URL` - Mongo Database URL From https://cloud.mongodb.com 57 | * `DB_NAME` - Your Database Name From Mongodb. 58 | * `FORCE_SUB` - Your Force Sub Channel Username Without @ 59 | * `LOG_CHANNEL` - Bot Logs Sending Channel. If You Don't Need This To Remove This Variable In Your Server 60 | * `STRING_SESSION` - Your Tg Premium Account String Session Required. `[Note :- If you remove the string session, 4GB files doesn't works on the bot.]` 61 | 62 | ## 🥰 Features 63 | 64 | * Renames very fast . 65 | * Permanent Thumbnail support. 66 | * Force join for the user for use. 67 | * Supports Broadcasts. 68 | * Custom File Name Support...[Prefix_&_Suffix] 69 | * Set custom caption. 70 | * Has a custom Start-up pic. 71 | * Force subscribe available. 72 | * Supports ulimited renaming at a time. 73 | * Custom Metadata Support. 74 | * Admin Command Available. 75 | * premium subscription available. 76 | * premium trial available. 77 | * handle ban/unban members using command. 78 | * Deploy to Koyeb + Heroku + Railway + Render. 79 | * Developer Service 24x7. 🔥 80 | 81 | 82 | ## Botfather Commands 83 | ``` 84 | start - 𝖈ʜᴇᴄᴋ 𝖎 𝖆ᴍ ʟɪᴠᴇ. 85 | plans - ᴜᴘɢʀᴀᴅᴇ ᴛᴏ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴ. 86 | myplan - ᴄʜᴇᴄᴋ ʏᴏᴜʀ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴ ʜᴇʀᴇ. 87 | view_thumb - 𝖙ᴏ 𝖘ᴇᴇ 𝖞ᴏᴜʀ 𝖈ᴜ𝖘ᴛᴏᴍ 𝖙ʜᴜᴍʙɴᴀɪʟ !! 88 | del_thumb - 𝖙ᴏ 𝖉ᴇʟᴇᴛᴇ 𝖞ᴏᴜʀ 𝖈ᴜ𝖘ᴛᴏᴍ 𝖙ʜᴜᴍʙɴᴀɪʟ !! 89 | set_caption - Sᴇᴛ A Cᴜsᴛᴏᴍ Cᴀᴘᴛɪᴏɴ !! 90 | see_caption - Sᴇᴇ Yᴏᴜʀ Cᴜsᴛᴏᴍ Cᴀᴘᴛɪᴏɴ !! 91 | del_caption - Dᴇʟᴇᴛᴇ Cᴜsᴛᴏᴍ Cᴀᴘᴛɪᴏɴ !! 92 | metadata - Tᴏ Sᴇᴛ & Cʜᴀɴɢᴇ ʏᴏᴜʀ ᴍᴇᴛᴀᴅᴀᴛᴀ ᴄᴏᴅᴇ 93 | set_prefix - Tᴏ Sᴇᴛ Yᴏᴜʀ Pʀᴇғɪx !! 94 | see_prefix - Tᴏ Sᴇᴇ Yᴏᴜʀ Pʀᴇғɪx !! 95 | del_prefix - Dᴇʟᴇᴛᴇ Yᴏᴜʀ Pʀᴇғɪx !! 96 | set_suffix - Tᴏ Sᴇᴛ Yᴏᴜʀ Sᴜғғɪx !! 97 | see_suffix - Tᴏ Sᴇᴇ Yᴏᴜʀ Sᴜғғɪx !! 98 | del_suffix - Dᴇʟᴇᴛᴇ Yᴏᴜʀ Sᴜғғɪx !! 99 | restart - ᴛᴏ ʀᴇsᴛᴀʀᴛ ᴛʜᴇ ʙᴏᴛ ᴀɴᴅ sᴇɴᴅ ᴍᴇssᴀɢᴇ ᴀʟʟ ᴅʙ ᴜsᴇʀs (Aᴅᴍɪɴ Oɴʟʏ) 100 | addpremium - ᴀᴅᴅ ᴘʀᴇᴍɪᴜᴍ (Aᴅᴍɪɴ Oɴʟʏ) 101 | remove_premium - ʀᴇᴍᴏᴠᴇ ᴘʀᴇᴍɪᴜᴍ (Aᴅᴍɪɴ Oɴʟʏ) 102 | ban - ban members using command (admin only) 103 | unban - unban members using command (admin only) 104 | banned_users - check bot all ban users using command (admin only) 105 | logs - ᴄʜᴇᴄᴋ ʙᴏᴛ ʟᴏɢs (Aᴅᴍɪɴ Oɴʟʏ) 106 | status - Cʜᴇᴄᴋ Bᴏᴛ Sᴛᴀᴛᴜs (Aᴅᴍɪɴ Oɴʟʏ) 107 | broadcast - Sᴇɴᴅ Mᴇssᴀɢᴇ Tᴏ Aʟʟ Usᴇʀs (Aᴅᴍɪɴ Oɴʟʏ) 108 | ``` 109 | 110 | ## Note: 111 | 112 | - Please, Just Fork The Repo And Edit As Per Your Needs. # Don't Remove My Credit. 113 | - ᴅᴏ ɴᴏᴛ ʀᴇᴍᴏᴠᴇ ᴄʀᴇᴅɪᴛs ɢɪᴠᴇɴ ɪɴ ᴛʜɪs ʀᴇᴘᴏ. 114 | - Importing this repo instead of forking is strictly prohibited, Kindly fork and edit as your wish. Must Give Credits for developer(s) 115 | - If you find any bugs or errors, [report](https://t.me/DigitalBotz_Support) it 116 | 117 | ## ❣️ Special Thanks 👍 118 | 119 | - Thanks To TEAM-PYRO-BOTZ For His Awesome [PYRO-RENAME-BOT](https://github.com/TEAM-PYRO-BOTZ/PYRO-RENAME-BOT.git) 120 | - Thanks To [RknDeveloper](https://github.com/RknDeveloper) who have edited and modified this repo as now it is. (It's me 😂) 121 | - Thanks To [JayMahakal](https://github.com/JayMahakal98) who have edited and modified this repo as now it is. 122 | - Thanks To Rkn Developer Teams ✅ (Edit & New Feature Added) 123 | - Special Repo Owner Thanks To Digital Botz 🥲 124 | 125 | ## Last Updated 126 | - `03-02-2024 08:45:30 PM` 127 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Renamer Bot", 3 | "description": "Telegram File Renamer Bot ", 4 | "logo": "https://telegra.ph/file/b746aadfe59959eb76f59.jpg", 5 | "keywords": ["Renamer Bot", "Mongo DB"], 6 | "repository": "https://github.com/DigitalBotz/Digital-Rename-Bot", 7 | "env": { 8 | "API_ID": { 9 | "description": "Your APP ID From my.telegram.org ", 10 | "value": "" 11 | }, 12 | "API_HASH": { 13 | "description": "Your API Hash From my.telegram.org ", 14 | "value": "" 15 | }, 16 | 17 | "FORCE_SUB": { 18 | "description": "Your force sub channel user name without [@] ", 19 | "value": "", 20 | "required": false 21 | }, 22 | "BOT_TOKEN": { 23 | "description": "Your Bot Token From @BotFather", 24 | "value": "" 25 | }, 26 | "ADMIN": { 27 | "description":"Add Your User ID multiple is use space to split" 28 | }, 29 | "LOG_CHANNEL": { 30 | "description":"Bot Log Sending Channel (just create a private channel and add bot to admin and take channel id to add this variable) ⚠️ id startswith -100 must", 31 | "required": false 32 | }, 33 | "DB_URL": { 34 | "description": "Your Mongo DB URL Obtained From mongodb.com", 35 | "value": "" 36 | }, 37 | "DB_NAME":{ 38 | "description":"Your Mongo DB Database Name ", 39 | "value": "Digital_Rename_Bot", 40 | "required": false 41 | }, 42 | "RKN_PIC": { 43 | "description": "Your Bot start cmd Pic from @RKN_Telegraphbot", 44 | "value": "https://telegra.ph/file/b746aadfe59959eb76f59.jpg", 45 | "required": false 46 | } 47 | }, 48 | "buildpacks": [ 49 | { 50 | "url": "heroku/python" 51 | }, 52 | { 53 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest" 54 | } 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | # extra imports 33 | import aiohttp, asyncio, warnings, pytz, datetime 34 | import logging 35 | import logging.config 36 | import glob, sys, importlib, pyromod 37 | from pathlib import Path 38 | 39 | # pyrogram imports 40 | import pyrogram.utils 41 | from pyrogram import Client, __version__, errors 42 | from pyrogram.raw.all import layer 43 | 44 | # bots imports 45 | from config import Config 46 | from plugins.web_support import web_server 47 | from plugins.file_rename import app 48 | 49 | 50 | pyrogram.utils.MIN_CHANNEL_ID = -1009999999999 51 | 52 | # Get logging configurations 53 | logging.basicConfig( 54 | level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", 55 | handlers=[logging.FileHandler('BotLog.txt'), 56 | logging.StreamHandler()] 57 | ) 58 | #logger = logging.getLogger(__name__) 59 | logging.getLogger("pyrogram").setLevel(logging.WARNING) 60 | 61 | class DigitalRenameBot(Client): 62 | def __init__(self): 63 | super().__init__( 64 | name="DigitalRenameBot", 65 | api_id=Config.API_ID, 66 | api_hash=Config.API_HASH, 67 | bot_token=Config.BOT_TOKEN, 68 | workers=200, 69 | plugins={"root": "plugins"}, 70 | sleep_threshold=15) 71 | 72 | 73 | async def start(self): 74 | await super().start() 75 | me = await self.get_me() 76 | self.mention = me.mention 77 | self.username = me.username 78 | self.uptime = Config.BOT_UPTIME 79 | self.premium = Config.PREMIUM_MODE 80 | self.uploadlimit = Config.UPLOAD_LIMIT_MODE 81 | # self.log = logger 82 | 83 | app = aiohttp.web.AppRunner(await web_server()) 84 | await app.setup() 85 | bind_address = "0.0.0.0" 86 | await aiohttp.web.TCPSite(app, bind_address, Config.PORT).start() 87 | 88 | path = "plugins/*.py" 89 | files = glob.glob(path) 90 | for name in files: 91 | with open(name) as a: 92 | patt = Path(a.name) 93 | plugin_name = patt.stem.replace(".py", "") 94 | plugins_path = Path(f"plugins/{plugin_name}.py") 95 | import_path = "plugins.{}".format(plugin_name) 96 | spec = importlib.util.spec_from_file_location(import_path, plugins_path) 97 | load = importlib.util.module_from_spec(spec) 98 | spec.loader.exec_module(load) 99 | sys.modules["plugins" + plugin_name] = load 100 | print("Digital Botz Imported " + plugin_name) 101 | 102 | print(f"{me.first_name} Iꜱ Sᴛᴀʀᴛᴇᴅ.....✨️") 103 | 104 | for id in Config.ADMIN: 105 | if Config.STRING_SESSION: 106 | try: await self.send_message(id, f"𝟮𝗚𝗕+ ғɪʟᴇ sᴜᴘᴘᴏʀᴛ ʜᴀs ʙᴇᴇɴ ᴀᴅᴅᴇᴅ ᴛᴏ ʏᴏᴜʀ ʙᴏᴛ.\n\nNote: 𝐓𝐞𝐥𝐞𝐠𝐫𝐚𝐦 𝐩𝐫𝐞𝐦𝐢𝐮𝐦 𝐚𝐜𝐜𝐨𝐮𝐧𝐭 𝐬𝐭𝐫𝐢𝐧𝐠 𝐬𝐞𝐬𝐬𝐢𝐨𝐧 𝐫𝐞𝐪𝐮𝐢𝐫𝐞𝐝 𝐓𝐡𝐞𝐧 𝐬𝐮𝐩𝐩𝐨𝐫𝐭𝐬 𝟐𝐆𝐁+ 𝐟𝐢𝐥𝐞𝐬.\n\n**__{me.first_name} Iꜱ Sᴛᴀʀᴛᴇᴅ.....✨️__**") 107 | except: pass 108 | else: 109 | try: await self.send_message(id, f"𝟮𝗚𝗕- ғɪʟᴇ sᴜᴘᴘᴏʀᴛ ʜᴀs ʙᴇᴇɴ ᴀᴅᴅᴇᴅ ᴛᴏ ʏᴏᴜʀ ʙᴏᴛ.\n\n**__{me.first_name} Iꜱ Sᴛᴀʀᴛᴇᴅ.....✨️__**") 110 | except: pass 111 | 112 | if Config.LOG_CHANNEL: 113 | try: 114 | curr = datetime.datetime.now(pytz.timezone("Asia/Kolkata")) 115 | date = curr.strftime('%d %B, %Y') 116 | time = curr.strftime('%I:%M:%S %p') 117 | await self.send_message(Config.LOG_CHANNEL, f"**__{me.mention} Iꜱ Rᴇsᴛᴀʀᴛᴇᴅ !!**\n\n📅 Dᴀᴛᴇ : `{date}`\n⏰ Tɪᴍᴇ : `{time}`\n🌐 Tɪᴍᴇᴢᴏɴᴇ : `Asia/Kolkata`\n\n🉐 Vᴇʀsɪᴏɴ : `v{__version__} (Layer {layer})`") 118 | except: 119 | print("Pʟᴇᴀꜱᴇ Mᴀᴋᴇ Tʜɪꜱ Iꜱ Aᴅᴍɪɴ Iɴ Yᴏᴜʀ Lᴏɢ Cʜᴀɴɴᴇʟ") 120 | 121 | async def stop(self, *args): 122 | for id in Config.ADMIN: 123 | try: await self.send_message(id, f"**Bot Stopped....**") 124 | except: pass 125 | print("Bot Stopped 🙄") 126 | await super().stop() 127 | 128 | 129 | bot_instance = DigitalRenameBot() 130 | 131 | def main(): 132 | async def start_services(): 133 | if Config.STRING_SESSION: 134 | await asyncio.gather( 135 | app.start(), # Start the Pyrogram Client 136 | bot_instance.start() # Start the bot instance 137 | ) 138 | else: 139 | await asyncio.gather(bot_instance.start()) # Start the bot instance 140 | 141 | loop = asyncio.get_event_loop() 142 | loop.run_until_complete(start_services()) 143 | loop.run_forever() 144 | 145 | if __name__ == "__main__": 146 | warnings.filterwarnings("ignore", message="There is no current event loop") 147 | try: 148 | main() 149 | except errors.FloodWait as ft: 150 | print(f"Flood Wait Occured, Sleeping For {ft}") 151 | asyncio.sleep(ft.value) 152 | print("Now Ready For Deploying !") 153 | main() 154 | 155 | # Rkn Developer 156 | # Don't Remove Credit 😔 157 | # Telegram Channel @RknDeveloper & @Rkn_Botz 158 | # Developer @RknDeveloperr 159 | # Update Channel @Digital_Botz & @DigitalBotz_Support 160 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | import re, os, time 33 | id_pattern = re.compile(r'^.\d+$') 34 | 35 | class Config(object): 36 | # digital_botz client config 37 | API_ID = os.environ.get("API_ID", "") 38 | API_HASH = os.environ.get("API_HASH", "") 39 | BOT_TOKEN = os.environ.get("BOT_TOKEN", "") 40 | 41 | # premium account string session required 😢 42 | STRING_SESSION = os.environ.get("STRING_SESSION", "") 43 | 44 | # database config 45 | DB_NAME = os.environ.get("DB_NAME","Digital_Rename_Bot") 46 | DB_URL = os.environ.get("DB_URL","") 47 | 48 | # other configs 49 | RKN_PIC = os.environ.get("RKN_PIC", "https://telegra.ph/file/b746aadfe59959eb76f59.jpg") 50 | ADMIN = [int(admin) if id_pattern.search(admin) else admin for admin in os.environ.get('ADMIN', '6705898491').split()] 51 | LOG_CHANNEL = int(os.environ.get("LOG_CHANNEL", "-1002123429361")) 52 | 53 | # free upload limit 54 | FREE_UPLOAD_LIMIT = 6442450944 # calculation 6*1024*1024*1024=results 55 | 56 | # premium mode feature ✅ 57 | UPLOAD_LIMIT_MODE = True 58 | PREMIUM_MODE = True 59 | 60 | #force subs 61 | try: 62 | FORCE_SUB = int(os.environ.get("FORCE_SUB", "")) 63 | except: 64 | FORCE_SUB = os.environ.get("FORCE_SUB", "Digital_Botz") 65 | 66 | # wes response configuration 67 | PORT = int(os.environ.get("PORT", "8080")) 68 | BOT_UPTIME = time.time() 69 | 70 | class rkn(object): 71 | # part of text configuration 72 | START_TXT = """H𝙰𝙸, {}👋 73 | 74 | 𝚃ʜɪs 𝙸s 𝙰ɴ 𝙰ᴅᴠᴀᴄᴇᴅ 𝙰ɴᴅ 𝚈ᴇᴛ 𝙿ᴏᴡᴇʀғᴜʟ 𝚁ᴇɴᴀᴍᴇ 𝙱ᴏᴛ 75 | 𝚄sɪɴɢ 𝚃ʜɪs 𝙱ᴏᴛ 𝚈ᴏᴜ 𝙲ᴀɴ 𝚁ᴇɴᴀᴍᴇ & 𝙲ʜᴀɴɢᴇ 𝚃ʜᴜᴍʙɴᴀɪʟ 𝙾ғ 𝚈ᴏᴜʀ 𝙵ɪʟᴇ 76 | 𝚈ᴏᴜ 𝙲ᴀɴ 𝙰ʟsᴏ 𝙲ᴏɴᴠᴇʀᴛ 𝚅ɪᴅᴇᴏ 𝚃ᴏ 𝙵ɪʟᴇ & 𝙵ɪʟᴇ 𝚃ᴏ 𝚅ɪᴅᴇᴏ 77 | 𝚃𝙷𝙸𝚂 𝙱𝙾𝚃 𝙰𝙻𝚂𝙾 𝚂𝚄𝙿𝙿𝙾𝚁𝚃𝚂 𝙲𝚄𝚂𝚃𝙾𝙼 𝚃𝙷𝚄𝙼𝙱𝙽𝙰𝙸𝙻 𝙰𝙽𝙳 𝙲𝚄𝚂𝚃𝙾𝙼 𝙲𝙰𝙿𝚃𝙸𝙾𝙽 78 | 79 | Tʜɪs Bᴏᴛ Wᴀs Cʀᴇᴀᴛᴇᴅ Bʏ : @Digital_Botz 💞""" 80 | 81 | ABOUT_TXT = """╭───────────⍟ 82 | ├🤖 ᴍy ɴᴀᴍᴇ : {} 83 | ├🖥️ Dᴇᴠᴇʟᴏᴩᴇʀꜱ : {} 84 | ├👨‍💻 Pʀᴏɢʀᴀᴍᴇʀ : {} 85 | ├📕 Lɪʙʀᴀʀy : {} 86 | ├✏️ Lᴀɴɢᴜᴀɢᴇ: {} 87 | ├💾 Dᴀᴛᴀ Bᴀꜱᴇ: {} 88 | ├📊 ᴠᴇʀsɪᴏɴ: {} 89 | ╰───────────────⍟ """ 90 | 91 | HELP_TXT = """ 92 | •> /start Tʜᴇ Bᴏᴛ. 93 | 94 | ✏️ Hᴏᴡ Tᴏ Rᴇɴᴀᴍᴇ A Fɪʟᴇ 95 | •> Sᴇɴᴅ Aɴy Fɪʟᴇ Aɴᴅ Tyᴩᴇ Nᴇᴡ Fɪʟᴇ Nɴᴀᴍᴇ \nAɴᴅ Aᴇʟᴇᴄᴛ Tʜᴇ Fᴏʀᴍᴀᴛ [ document, video, audio ]. 96 | ℹ️ 𝗔𝗻𝘆 𝗢𝘁𝗵𝗲𝗿 𝗛𝗲𝗹𝗽 𝗖𝗼𝗻𝘁𝗮𝗰𝘁 :- 𝑺𝑼𝑷𝑷𝑶𝑹𝑻 𝑮𝑹𝑶𝑼𝑷 97 | """ 98 | 99 | UPGRADE_PREMIUM= """ 100 | •⪼ ★𝘗𝘭𝘢𝘯𝘴 - ⏳𝘋𝘢𝘵𝘦 - 💸𝘗𝘳𝘪𝘤𝘦 101 | •⪼ 🥉𝘉𝘳𝘰𝘯𝘻𝘦 - 3𝘥𝘢𝘺𝘴 - 39 102 | •⪼ 🥈𝘚𝘪𝘭𝘷𝘦𝘳 - 7𝘥𝘢𝘺𝘴 - 59 103 | •⪼ 🥇𝘎𝘰𝘭𝘥 - 15𝘥𝘢𝘺𝘴 - 99 104 | •⪼ 🏆𝘗𝘭𝘢𝘵𝘪𝘯𝘶𝘮 - 1𝘮𝘰𝘯𝘵𝘩 - 179 105 | •⪼ 💎𝘋𝘪𝘢𝘮𝘰𝘯𝘥 - 2𝘮𝘰𝘯𝘵𝘩 - 339 106 | 107 | - 𝘋𝘢𝘪𝘭𝘺 𝘜𝘱𝘭𝘰𝘢𝘥 𝘓𝘪𝘮𝘪𝘵 𝘜𝘯𝘭𝘪𝘮𝘪𝘵𝘦𝘥 108 | - 𝘋𝘪𝘴𝘤𝘰𝘶𝘯𝘵 𝘈𝘭𝘭 𝘗𝘭𝘢𝘯 𝘙𝘴.9 109 | """ 110 | 111 | UPGRADE_PLAN= """ 112 | 𝘗𝘭𝘢𝘯: 𝘗𝘳𝘰 113 | 𝘋𝘢𝘵𝘦: 1 𝘮𝘰𝘯𝘵𝘩 114 | 𝘗𝘳𝘪𝘤𝘦: 179 115 | 𝘓𝘪𝘮𝘪𝘵: 100 𝘎𝘉 116 | 117 | 𝘗𝘭𝘢𝘯: 𝘜𝘭𝘵𝘢 𝘗𝘳𝘰 118 | 𝘋𝘢𝘵𝘦: 1 𝘮𝘰𝘯𝘵𝘩 119 | 𝘗𝘳𝘪𝘤𝘦: 199 120 | 𝘓𝘪𝘮𝘪𝘵: 1000 𝘎𝘉 121 | 122 | - 𝘋𝘪𝘴𝘤𝘰𝘶𝘯𝘵 𝘈𝘭𝘭 𝘗𝘭𝘢𝘯 𝘙𝘴.9 123 | """ 124 | 125 | THUMBNAIL = """ 126 | 🌌 Hᴏᴡ Tᴏ Sᴇᴛ Tʜᴜᴍʙɴɪʟᴇ 127 | 128 | •> Sᴇɴᴅ Aɴy Pʜᴏᴛᴏ Tᴏ Aᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟy Sᴇᴛ Tʜᴜᴍʙɴɪʟᴇ. 129 | •> /del_thumb Uꜱᴇ Tʜɪꜱ Cᴏᴍᴍᴀɴᴅ Tᴏ Dᴇʟᴇᴛᴇ Yᴏᴜʀ Oʟᴅ Tʜᴜᴍʙɴɪʟᴇ. 130 | •> /view_thumb Uꜱᴇ Tʜɪꜱ Cᴏᴍᴍᴀɴᴅ Tᴏ Vɪᴇᴡ Yᴏᴜʀ Cᴜʀʀᴇɴᴛ Tʜᴜᴍʙɴɪʟᴇ. 131 | """ 132 | CAPTION= """ 133 | 📑 Hᴏᴡ Tᴏ Sᴇᴛ Cᴜꜱᴛᴏᴍ Cᴀᴩᴛɪᴏɴ 134 | 135 | •> /set_caption - Uꜱᴇ Tʜɪꜱ Cᴏᴍᴍᴀɴᴅ Tᴏ Sᴇᴛ ᴀ Cᴜꜱᴛᴏᴍ Cᴀᴩᴛɪᴏɴ 136 | •> /see_caption - Uꜱᴇ Tʜɪꜱ Cᴏᴍᴍᴀɴᴅ Tᴏ Vɪᴇᴡ Yᴏᴜʀ Cᴜꜱᴛᴏᴍ Cᴀᴩᴛɪᴏɴ 137 | •> /del_caption - Uꜱᴇ Tʜɪꜱ Cᴏᴍᴍᴀɴᴅ Tᴏ Dᴇʟᴇᴛᴇ Yᴏᴜʀ Cᴜꜱᴛᴏᴍ Cᴀᴩᴛɪᴏɴ 138 | 139 | Exᴀᴍᴩʟᴇ:- `/set_caption 📕 Fɪʟᴇ Nᴀᴍᴇ: {filename} 140 | 💾 Sɪᴢᴇ: {filesize} 141 | ⏰ Dᴜʀᴀᴛɪᴏɴ: {duration}` 142 | """ 143 | BOT_STATUS = """ 144 | ⚡️ ʙᴏᴛ sᴛᴀᴛᴜs ⚡️ 145 | 146 | ⌚️ ʙᴏᴛ ᴜᴩᴛɪᴍᴇ: `{}` 147 | 👭 ᴛᴏᴛᴀʟ ᴜsᴇʀꜱ: `{}` 148 | 💸 ᴛᴏᴛᴀʟ ᴘʀᴇᴍɪᴜᴍ ᴜsᴇʀs: `{}` 149 | ֍ ᴜᴘʟᴏᴀᴅ: `{}` 150 | ⊙ ᴅᴏᴡɴʟᴏᴀᴅ: `{}` 151 | """ 152 | LIVE_STATUS = """ 153 | ⚡ ʟɪᴠᴇ sᴇʀᴠᴇʀ sᴛᴀᴛᴜs ⚡ 154 | 155 | ᴜᴘᴛɪᴍᴇ: `{}` 156 | ᴄᴘᴜ: `{}%` 157 | ʀᴀᴍ: `{}%` 158 | ᴛᴏᴛᴀʟ ᴅɪsᴋ: `{}` 159 | ᴜsᴇᴅ sᴘᴀᴄᴇ: `{} {}%` 160 | ғʀᴇᴇ sᴘᴀᴄᴇ: `{}` 161 | ᴜᴘʟᴏᴀᴅ: `{}` 162 | ᴅᴏᴡɴʟᴏᴀᴅ: `{}` 163 | V𝟹.𝟶.𝟶 [STABLE] 164 | """ 165 | DIGITAL_METADATA = """ 166 | ❪ SET CUSTOM METADATA ❫ 167 | 168 | - /metadata - Tᴏ Sᴇᴛ & Cʜᴀɴɢᴇ ʏᴏᴜʀ ᴍᴇᴛᴀᴅᴀᴛᴀ ᴄᴏᴅᴇ 169 | 170 | ☞ Fᴏʀ Exᴀᴍᴘʟᴇ:- 171 | 172 | `--change-title @Rkn_Botz 173 | --change-video-title @Rkn_Botz 174 | --change-audio-title @Rkn_Botz 175 | --change-subtitle-title @Rkn_Botz 176 | --change-author @Rkn_Botz` 177 | 178 | 📥 Fᴏʀ Hᴇʟᴘ Cᴏɴᴛ. @Digital_Botz 179 | """ 180 | 181 | CUSTOM_FILE_NAME = """ 182 | 🖋️ Custom File Name 183 | 184 | you can pre-add a prefix and suffix along with your new filename 185 | 186 | ➢ /set_prefix - To add a prefix along with your _filename. 187 | ➢ /see_prefix - Tᴏ Sᴇᴇ Yᴏᴜʀ Pʀᴇғɪx !! 188 | ➢ /del_prefix - Tᴏ Dᴇʟᴇᴛᴇ Yᴏᴜʀ Pʀᴇғɪx !! 189 | ➢ /set_suffix - To add a suffix along with your filename_. 190 | ➢ /see_suffix - Tᴏ Sᴇᴇ Yᴏᴜʀ Sᴜғғɪx !! 191 | ➢ /del_suffix - Tᴏ Dᴇʟᴇᴛᴇ Yᴏᴜʀ Sᴜғғɪx !! 192 | 193 | Exᴀᴍᴩʟᴇ:- `/set_suffix @Digital_Botz` 194 | Exᴀᴍᴩʟᴇ:- `/set_prefix @Digital_Botz` 195 | """ 196 | 197 | #⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️ 198 | #⚠️ Dᴏɴ'ᴛ Rᴇᴍᴏᴠᴇ Oᴜʀ Cʀᴇᴅɪᴛꜱ @RknDeveloper🙏🥲 199 | # ᴡʜᴏᴇᴠᴇʀ ɪs ᴅᴇᴘʟᴏʏɪɴɢ ᴛʜɪs ʀᴇᴘᴏ ɪs ᴡᴀʀɴᴇᴅ ⚠️ ᴅᴏ ɴᴏᴛ ʀᴇᴍᴏᴠᴇ ᴄʀᴇᴅɪᴛs ɢɪᴠᴇɴ ɪɴ ᴛʜɪs ʀᴇᴘᴏ #ғɪʀsᴛ ᴀɴᴅ ʟᴀsᴛ ᴡᴀʀɴɪɴɢ ⚠️ 200 | DEV_TXT = """Sᴩᴇᴄɪᴀʟ Tʜᴀɴᴋꜱ & Dᴇᴠᴇʟᴏᴩᴇʀꜱ 201 | 202 | » 𝗦𝗢𝗨𝗥𝗖𝗘 𝗖𝗢𝗗𝗘 : Digital-Rename-Bot 203 | 204 | • ❣️ RknDeveloper 205 | • ❣️ DigitalBotz 206 | • ❣️ Jay Mahakal """ 207 | # ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️ 208 | 209 | SEND_METADATA = """ 210 | ❪ SET CUSTOM METADATA ❫ 211 | 212 | ☞ Fᴏʀ Exᴀᴍᴘʟᴇ:- 213 | 214 | `--change-title @Rkn_Botz 215 | --change-video-title @Rkn_Botz 216 | --change-audio-title @Rkn_Botz 217 | --change-subtitle-title @Rkn_Botz 218 | --change-author @Rkn_Botz` 219 | 220 | 📥 Fᴏʀ Hᴇʟᴘ Cᴏɴᴛ. @Digital_Botz 221 | """ 222 | 223 | RKN_PROGRESS = """\n 224 | ╭━━━━❰RKN PROCESSING...❱━➣ 225 | ┣⪼ 🗃️ ꜱɪᴢᴇ: {1} | {2} 226 | ┣⪼ ⏳️ ᴅᴏɴᴇ : {0}% 227 | ┣⪼ 🚀 ꜱᴩᴇᴇᴅ: {3}/s 228 | ┣⪼ ⏰️ ᴇᴛᴀ: {4} 229 | ╰━━━━━━━━━━━━━━━➣ """ 230 | 231 | # Rkn Developer 232 | # Don't Remove Credit 😔 233 | # Telegram Channel @RknDeveloper & @Rkn_Botz 234 | # Developer @RknDeveloperr 235 | # Update Channel @Digital_Botz & @DigitalBotz_Support 236 | -------------------------------------------------------------------------------- /helper/database.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To (https://github.com/JayMahakal98) 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | 9 | """ 10 | Apache License 2.0 11 | Copyright (c) 2022 @Digital_Botz 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | The above copyright notice and this permission notice shall be included in all 20 | copies or substantial portions of the Software. 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | 28 | Telegram Link : https://t.me/Digital_Botz 29 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 30 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 31 | """ 32 | 33 | # database imports 34 | import motor.motor_asyncio, datetime, pytz 35 | 36 | # bots imports 37 | from config import Config 38 | from helper.utils import send_log 39 | 40 | class Database: 41 | def __init__(self, uri, database_name): 42 | self._client = motor.motor_asyncio.AsyncIOMotorClient(uri) 43 | self.db = self._client[database_name] 44 | self.col = self.db.user 45 | self.premium = self.db.premium 46 | 47 | def new_user(self, id): 48 | return dict( 49 | _id=int(id), 50 | join_date=datetime.date.today().isoformat(), 51 | file_id=None, 52 | caption=None, 53 | prefix=None, 54 | suffix=None, 55 | used_limit=0, 56 | usertype="Free", 57 | uploadlimit=Config.FREE_UPLOAD_LIMIT, 58 | daily=0, 59 | metadata_mode=False, 60 | metadata_code="--change-title @Rkn_Botz\n--change-video-title @Rkn_Botz\n--change-audio-title @Rkn_Botz\n--change-subtitle-title @Rkn_Botz\n--change-author @Rkn_Botz", 61 | expiry_time=None, 62 | has_free_trial=False, 63 | ban_status=dict( 64 | is_banned=False, 65 | ban_duration=0, 66 | banned_on=datetime.date.max.isoformat(), 67 | ban_reason='' 68 | ) 69 | ) 70 | 71 | async def add_user(self, b, m): 72 | u = m.from_user 73 | if not await self.is_user_exist(u.id): 74 | user = self.new_user(u.id) 75 | await self.col.insert_one(user) 76 | await send_log(b, u) 77 | 78 | async def is_user_exist(self, id): 79 | user = await self.col.find_one({'_id': int(id)}) 80 | return bool(user) 81 | 82 | async def total_users_count(self): 83 | count = await self.col.count_documents({}) 84 | return count 85 | 86 | async def get_all_users(self): 87 | all_users = self.col.find({}) 88 | return all_users 89 | 90 | async def delete_user(self, user_id): 91 | await self.col.delete_many({'_id': int(user_id)}) 92 | 93 | async def set_thumbnail(self, id, file_id): 94 | await self.col.update_one({'_id': int(id)}, {'$set': {'file_id': file_id}}) 95 | 96 | async def get_thumbnail(self, id): 97 | user = await self.col.find_one({'_id': int(id)}) 98 | return user.get('file_id', None) 99 | 100 | async def set_caption(self, id, caption): 101 | await self.col.update_one({'_id': int(id)}, {'$set': {'caption': caption}}) 102 | 103 | async def get_caption(self, id): 104 | user = await self.col.find_one({'_id': int(id)}) 105 | return user.get('caption', None) 106 | 107 | async def set_prefix(self, id, prefix): 108 | await self.col.update_one({'_id': int(id)}, {'$set': {'prefix': prefix}}) 109 | 110 | async def get_prefix(self, id): 111 | user = await self.col.find_one({'_id': int(id)}) 112 | return user.get('prefix', None) 113 | 114 | async def set_suffix(self, id, suffix): 115 | await self.col.update_one({'_id': int(id)}, {'$set': {'suffix': suffix}}) 116 | 117 | async def get_suffix(self, id): 118 | user = await self.col.find_one({'_id': int(id)}) 119 | return user.get('suffix', None) 120 | 121 | async def set_metadata_mode(self, id, bool_meta): 122 | await self.col.update_one({'_id': int(id)}, {'$set': {'metadata_mode': bool_meta}}) 123 | 124 | async def get_metadata_mode(self, id): 125 | user = await self.col.find_one({'_id': int(id)}) 126 | return user.get('metadata_mode', None) 127 | 128 | async def set_metadata_code(self, id, metadata_code): 129 | await self.col.update_one({'_id': int(id)}, {'$set': {'metadata_code': metadata_code}}) 130 | 131 | async def get_metadata_code(self, id): 132 | user = await self.col.find_one({'_id': int(id)}) 133 | return user.get('metadata_code', None) 134 | 135 | async def set_used_limit(self, id, used): 136 | await self.col.update_one({'_id': int(id)}, {'$set': {'used_limit': used}}) 137 | 138 | async def set_usertype(self, id, type): 139 | await self.col.update_one({'_id': int(id)}, {'$set': {'usertype': type}}) 140 | 141 | async def set_uploadlimit(self, id, limit): 142 | await self.col.update_one({'_id': int(id)}, {'$set': {'uploadlimit': limit}}) 143 | 144 | async def set_reset_dailylimit(self, id, date): 145 | await self.col.update_one({'_id': int(id)}, {'$set': {'daily': date}}) 146 | 147 | async def reset_uploadlimit_access(self, user_id): 148 | seconds = 1440*60 149 | date = datetime.datetime.now() + datetime.timedelta(seconds=seconds) 150 | user_data = await self.get_user_data(user_id) 151 | if user_data: 152 | expiry_time = user_data.get("daily") 153 | n_date = 0 154 | if expiry_time is n_date: 155 | await self.col.update_one({'_id': int(user_id)}, {'$set': {'daily': date}}) 156 | await self.col.update_one({'_id': int(user_id)}, {'$set': {'used_limit': n_date}}) 157 | elif isinstance(expiry_time, datetime.datetime) and datetime.datetime.now() <= expiry_time: 158 | xd = user_data.get("daily") 159 | else: 160 | await self.col.update_one({'_id': int(user_id)}, {'$set': {'daily': date}}) 161 | await self.col.update_one({'_id': int(user_id)}, {'$set': {'used_limit': n_date}}) 162 | 163 | 164 | async def get_user_data(self, id) -> dict: 165 | user_data = await self.col.find_one({'_id': int(id)}) 166 | return user_data or None 167 | 168 | async def get_user(self, user_id): 169 | user_data = await self.premium.find_one({"id": user_id}) 170 | return user_data 171 | 172 | async def addpremium(self, user_id, user_data, limit=None, type=None): 173 | await self.premium.update_one({"id": user_id}, {"$set": user_data}, upsert=True) 174 | if limit and type and Config.UPLOAD_LIMIT_MODE: 175 | await self.col.update_one({'_id': user_id}, {'$set': {'usertype': type}}) 176 | await self.col.update_one({'_id': user_id}, {'$set': {'uploadlimit': limit}}) 177 | 178 | async def remove_premium(self, user_id, limit=Config.FREE_UPLOAD_LIMIT, type="Free"): 179 | await self.premium.update_one({"id": user_id}, {"$set": {"expiry_time": None}}) 180 | if limit and type and Config.UPLOAD_LIMIT_MODE: 181 | await self.col.update_one({'_id': user_id}, {'$set': {'usertype': type}}) 182 | await self.col.update_one({'_id': user_id}, {'$set': {'uploadlimit': limit}}) 183 | 184 | async def checking_remaining_time(self, user_id): 185 | user_data = await self.get_user(user_id) 186 | expiry_time = user_data.get("expiry_time") 187 | time_left_str = expiry_time - datetime.datetime.now() 188 | return time_left_str 189 | 190 | async def has_premium_access(self, user_id): 191 | user_data = await self.get_user(user_id) 192 | if user_data: 193 | expiry_time = user_data.get("expiry_time") 194 | if expiry_time is None: 195 | # User previously used the free trial, but it has ended. 196 | return False 197 | elif isinstance(expiry_time, datetime.datetime) and datetime.datetime.now() <= expiry_time: 198 | return True 199 | else: 200 | await self.remove_premium(user_id) 201 | return False 202 | 203 | async def total_premium_users_count(self): 204 | count = await self.premium.count_documents({"expiry_time": {"$gt": datetime.datetime.now()}}) 205 | return count 206 | 207 | async def get_all_premium_users(self): 208 | all_premium_users = self.premium.find({"expiry_time": {"$gt": datetime.datetime.now()}}) 209 | return all_premium_users 210 | 211 | async def get_free_trial_status(self, user_id): 212 | user_data = await self.get_user(user_id) 213 | if user_data: 214 | return user_data.get("has_free_trial", False) 215 | return False 216 | 217 | async def give_free_trail(self, user_id): 218 | seconds = 720*60 219 | expiry_time = datetime.datetime.now() + datetime.timedelta(seconds=seconds) 220 | user_data = {"id": user_id, "expiry_time": expiry_time, "has_free_trial": True} 221 | 222 | if Config.UPLOAD_LIMIT_MODE: 223 | type, limit = "Trial", 536870912000 # calculation 500*1024*1024*1024=results 224 | await self.addpremium(user_id, user_data, limit, type) 225 | else: 226 | await self.addpremium(user_id, user_data) 227 | 228 | async def remove_ban(self, id): 229 | ban_status = dict( 230 | is_banned=False, 231 | ban_duration=0, 232 | banned_on=datetime.date.max.isoformat(), 233 | ban_reason='' 234 | ) 235 | await self.col.update_one({'_id': int(id)}, {'$set': {'ban_status': ban_status}}) 236 | 237 | async def ban_user(self, user_id, ban_duration, ban_reason): 238 | ban_status = dict( 239 | is_banned=True, 240 | ban_duration=ban_duration, 241 | banned_on=datetime.date.today().isoformat(), 242 | ban_reason=ban_reason) 243 | await self.col.update_one({'_id': int(user_id)}, {'$set': {'ban_status': ban_status}}) 244 | 245 | async def get_ban_status(self, id): 246 | default = dict( 247 | is_banned=False, 248 | ban_duration=0, 249 | banned_on=datetime.date.max.isoformat(), 250 | ban_reason='') 251 | user = await self.col.find_one({'_id': int(id)}) 252 | return user.get('ban_status', default) 253 | 254 | async def get_all_banned_users(self): 255 | banned_users = self.col.find({'ban_status.is_banned': True}) 256 | return banned_users 257 | 258 | digital_botz = Database(Config.DB_URL, Config.DB_NAME) 259 | 260 | # Rkn Developer 261 | # Don't Remove Credit 😔 262 | # Telegram Channel @RknDeveloper & @Rkn_Botz 263 | # Developer @RknDeveloperr 264 | # Update Channel @Digital_Botz & @DigitalBotz_Support 265 | -------------------------------------------------------------------------------- /helper/ffmpeg.py: -------------------------------------------------------------------------------- 1 | import os, time, asyncio, subprocess, json 2 | from helper.utils import metadata_text 3 | 4 | def change_metadata(input_file, output_file, metadata): 5 | author, title, video_title, audio_title, subtitle_title = metadata_text(metadata) 6 | 7 | # Get the video metadata 8 | output = subprocess.check_output(['ffprobe', '-v', 'error', '-show_streams', '-print_format', 'json', input_file]) 9 | data = json.loads(output) 10 | streams = data['streams'] 11 | 12 | # Create the FFmpeg command to change metadata 13 | cmd = [ 14 | 'ffmpeg', 15 | '-i', input_file, 16 | '-map', '0', # Map all streams 17 | '-c:v', 'copy', # Copy video stream 18 | '-c:a', 'copy', # Copy audio stream 19 | '-c:s', 'copy', # Copy subtitles stream 20 | '-metadata', f'title={title}', 21 | '-metadata', f'author={author}', 22 | ] 23 | 24 | # Add title to video stream 25 | for stream in streams: 26 | if stream['codec_type'] == 'video' and video_title: 27 | cmd.extend([f'-metadata:s:{stream["index"]}', f'title={video_title}']) 28 | elif stream['codec_type'] == 'audio' and audio_title: 29 | cmd.extend([f'-metadata:s:{stream["index"]}', f'title={audio_title}']) 30 | elif stream['codec_type'] == 'subtitle' and subtitle_title: 31 | cmd.extend([f'-metadata:s:{stream["index"]}', f'title={subtitle_title}']) 32 | 33 | cmd.extend(['-metadata', f'comment=Added by @Digital_Rename_Bot']) 34 | cmd.extend(['-f', 'matroska']) # support all format 35 | cmd.append(output_file) 36 | print(cmd) 37 | 38 | # Execute the command 39 | try: 40 | subprocess.run(cmd, check=True) 41 | return True 42 | except subprocess.CalledProcessError as e: 43 | print("FFmpeg Error:", e.stderr) 44 | return False 45 | -------------------------------------------------------------------------------- /helper/utils.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To (https://github.com/JayMahakal98) & @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | 9 | """ 10 | Apache License 2.0 11 | Copyright (c) 2022 @Digital_Botz 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | The above copyright notice and this permission notice shall be included in all 20 | copies or substantial portions of the Software. 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | 28 | Telegram Link : https://t.me/Digital_Botz 29 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 30 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 31 | """ 32 | 33 | # extra imports 34 | import math, time, re, datetime, pytz, os 35 | from config import Config, rkn 36 | 37 | # pyrogram imports 38 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 39 | 40 | async def progress_for_pyrogram(current, total, ud_type, message, start): 41 | now = time.time() 42 | diff = now - start 43 | if round(diff % 5.00) == 0 or current == total: 44 | percentage = current * 100 / total 45 | speed = current / diff 46 | elapsed_time = round(diff) * 1000 47 | time_to_completion = round((total - current) / speed) * 1000 48 | estimated_total_time = elapsed_time + time_to_completion 49 | 50 | elapsed_time = TimeFormatter(milliseconds=elapsed_time) 51 | estimated_total_time = TimeFormatter(milliseconds=estimated_total_time) 52 | 53 | progress = "{0}{1}".format( 54 | ''.join(["▣" for i in range(math.floor(percentage / 5))]), 55 | ''.join(["▢" for i in range(20 - math.floor(percentage / 5))]) 56 | ) 57 | tmp = progress + rkn.RKN_PROGRESS.format( 58 | round(percentage, 2), 59 | humanbytes(current), 60 | humanbytes(total), 61 | humanbytes(speed), 62 | estimated_total_time if estimated_total_time != '' else "0 s" 63 | ) 64 | try: 65 | await message.edit( 66 | text=f"{ud_type}\n\n{tmp}", 67 | reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("✖️ 𝙲𝙰𝙽𝙲𝙴𝙻 ✖️", callback_data="close")]]) 68 | ) 69 | except: 70 | pass 71 | 72 | def humanbytes(size): 73 | if not size: 74 | return "" 75 | power = 2**10 76 | n = 0 77 | Dic_powerN = {0: ' ', 1: 'K', 2: 'M', 3: 'G', 4: 'T'} 78 | while size > power: 79 | size /= power 80 | n += 1 81 | return str(round(size, 2)) + " " + Dic_powerN[n] + 'ʙ' 82 | 83 | 84 | def TimeFormatter(milliseconds: int) -> str: 85 | seconds, milliseconds = divmod(int(milliseconds), 1000) 86 | minutes, seconds = divmod(seconds, 60) 87 | hours, minutes = divmod(minutes, 60) 88 | days, hours = divmod(hours, 24) 89 | tmp = ((str(days) + "ᴅ, ") if days else "") + \ 90 | ((str(hours) + "ʜ, ") if hours else "") + \ 91 | ((str(minutes) + "ᴍ, ") if minutes else "") + \ 92 | ((str(seconds) + "ꜱ, ") if seconds else "") + \ 93 | ((str(milliseconds) + "ᴍꜱ, ") if milliseconds else "") 94 | return tmp[:-2] 95 | 96 | def convert(seconds): 97 | seconds = seconds % (24 * 3600) 98 | hour = seconds // 3600 99 | seconds %= 3600 100 | minutes = seconds // 60 101 | seconds %= 60 102 | return "%d:%02d:%02d" % (hour, minutes, seconds) 103 | 104 | async def send_log(b, u): 105 | if Config.LOG_CHANNEL: 106 | curr = datetime.datetime.now(pytz.timezone("Asia/Kolkata")) 107 | log_message = ( 108 | "**--Nᴇᴡ Uꜱᴇʀ Sᴛᴀʀᴛᴇᴅ Tʜᴇ Bᴏᴛ--**\n\n" 109 | f"Uꜱᴇʀ: {u.mention}\n" 110 | f"Iᴅ: `{u.id}`\n" 111 | f"Uɴ: @{u.username}\n\n" 112 | f"Dᴀᴛᴇ: {curr.strftime('%d %B, %Y')}\n" 113 | f"Tɪᴍᴇ: {curr.strftime('%I:%M:%S %p')}\n\n" 114 | f"By: {b.mention}" 115 | ) 116 | await b.send_message(Config.LOG_CHANNEL, log_message) 117 | 118 | async def get_seconds_first(time_string): 119 | conversion_factors = { 120 | 's': 1, 121 | 'min': 60, 122 | 'hour': 3600, 123 | 'day': 86400, 124 | 'month': 86400 * 30, 125 | 'year': 86400 * 365 126 | } 127 | 128 | parts = time_string.split() 129 | total_seconds = 0 130 | 131 | for i in range(0, len(parts), 2): 132 | value = int(parts[i]) 133 | unit = parts[i+1].rstrip('s') # Remove 's' from unit 134 | total_seconds += value * conversion_factors.get(unit, 0) 135 | 136 | return total_seconds 137 | 138 | async def get_seconds(time_string): 139 | conversion_factors = { 140 | 's': 1, 141 | 'min': 60, 142 | 'hour': 3600, 143 | 'day': 86400, 144 | 'month': 86400 * 30, 145 | 'year': 86400 * 365 146 | } 147 | 148 | total_seconds = 0 149 | pattern = r'(\d+)\s*(\w+)' 150 | matches = re.findall(pattern, time_string) 151 | 152 | for value, unit in matches: 153 | total_seconds += int(value) * conversion_factors.get(unit, 0) 154 | 155 | return total_seconds 156 | 157 | def add_prefix_suffix(input_string, prefix='', suffix=''): 158 | pattern = r'(?P.*?)(\.\w+)?$' 159 | match = re.search(pattern, input_string) 160 | 161 | if match: 162 | filename = match.group('filename') 163 | extension = match.group(2) or '' 164 | 165 | prefix_str = f"{prefix} " if prefix else "" 166 | suffix_str = f" {suffix}" if suffix else "" 167 | 168 | return f"{prefix_str}{filename}{suffix_str}{extension}" 169 | else: 170 | return input_string 171 | 172 | async def remove_path(*paths): 173 | for path in paths: 174 | if path and os.path.lexists(path): 175 | os.remove(path) 176 | 177 | def metadata_text(metadata_text): 178 | author = None 179 | title = None 180 | video_title = None 181 | audio_title = None 182 | subtitle_title = None 183 | 184 | flags = [i.strip() for i in metadata_text.split('--')] 185 | for f in flags: 186 | if "change-author" in f: 187 | author = f[len("change-author"):].strip() 188 | if "change-title" in f: 189 | title = f[len("change-title"):].strip() 190 | if "change-video-title" in f: 191 | video_title = f[len("change-video-title"):].strip() 192 | if "change-audio-title" in f: 193 | audio_title = f[len("change-audio-title"):].strip() 194 | if "change-subtitle-title" in f: 195 | subtitle_title = f[len("change-subtitle-title"):].strip() 196 | 197 | return author, title, video_title, audio_title, subtitle_title 198 | 199 | # (c) @RknDeveloperr 200 | # Rkn Developer 201 | # Don't Remove Credit 😔 202 | # Telegram Channel @RknDeveloper & @Rkn_Botz 203 | # Developer @RknDeveloperr 204 | # Special Thanks To @ReshamOwner 205 | # Update Channel @Digital_Botz & @DigitalBotz_Support 206 | -------------------------------------------------------------------------------- /plugins/Force_Sub.py: -------------------------------------------------------------------------------- 1 | """ 2 | Apache License 2.0 3 | Copyright (c) 2022 @Digital_Botz 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 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | Telegram Link : https://t.me/Digital_Botz 21 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 22 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 23 | """ 24 | 25 | # pyrogram imports 26 | from pyrogram import Client, filters, enums 27 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup 28 | from pyrogram.errors import UserNotParticipant 29 | 30 | # extra imports 31 | from config import Config 32 | from helper.database import digital_botz 33 | import datetime 34 | 35 | async def not_subscribed(_, client, message): 36 | await digital_botz.add_user(client, message) 37 | if not Config.FORCE_SUB: 38 | return False 39 | 40 | try: 41 | user = await client.get_chat_member(Config.FORCE_SUB, message.from_user.id) 42 | return user.status not in [enums.ChatMemberStatus.MEMBER, enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER] 43 | except UserNotParticipant: 44 | return True 45 | except Exception as e: 46 | print(f"Error checking subscription: {e}") 47 | return False 48 | 49 | async def handle_banned_user_status(bot, message): 50 | await digital_botz.add_user(bot, message) 51 | user_id = message.from_user.id 52 | ban_status = await digital_botz.get_ban_status(user_id) 53 | if ban_status.get("is_banned", False): 54 | if ( datetime.date.today() - datetime.date.fromisoformat(ban_status["banned_on"]) 55 | ).days > ban_status["ban_duration"]: 56 | await digital_botz.remove_ban(user_id) 57 | else: 58 | return await message.reply_text("Sorry Sir, 😔 You are Banned!.. Please Contact - @DigitalBotz") 59 | await message.continue_propagation() 60 | 61 | @Client.on_message(filters.private) 62 | async def _(bot, message): 63 | await handle_banned_user_status(bot, message) 64 | 65 | @Client.on_message(filters.private & filters.create(not_subscribed)) 66 | async def forces_sub(client, message): 67 | buttons = [[InlineKeyboardButton(text="📢 Join Update Channel 📢", url=f"https://t.me/{Config.FORCE_SUB}")]] 68 | text = "**Sᴏʀʀy Dᴜᴅᴇ Yᴏᴜ'ʀᴇ Nᴏᴛ Jᴏɪɴᴇᴅ My Cʜᴀɴɴᴇʟ 😐. Sᴏ Pʟᴇᴀꜱᴇ Jᴏɪɴ Oᴜʀ Uᴩᴅᴀᴛᴇ Cʜᴀɴɴᴇʟ Tᴏ Cᴄᴏɴᴛɪɴᴜᴇ**" 69 | 70 | try: 71 | user = await client.get_chat_member(Config.FORCE_SUB, message.from_user.id) 72 | if user.status == enums.ChatMemberStatus.BANNED: 73 | return await message.reply_text("Sᴏʀʀy Yᴏᴜ'ʀᴇ Bᴀɴɴᴇᴅ Tᴏ Uꜱᴇ Mᴇ") 74 | elif user.status not in [enums.ChatMemberStatus.MEMBER, enums.ChatMemberStatus.ADMINISTRATOR]: 75 | return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons)) 76 | except UserNotParticipant: 77 | return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons)) 78 | return await message.reply_text(text=text, reply_markup=InlineKeyboardMarkup(buttons)) 79 | 80 | # (c) @RknDeveloperr 81 | # Rkn Developer 82 | # Don't Remove Credit 😔 83 | # Telegram Channel @RknDeveloper & @Rkn_Botz 84 | # Developer @RknDeveloperr 85 | # Update Channel @Digital_Botz & @DigitalBotz_Support 86 | -------------------------------------------------------------------------------- /plugins/__init__.py: -------------------------------------------------------------------------------- 1 | # Telegram MTProto API Client Library for Pyrogram 2 | # Copyright (C) 2017-present DigitalBotz 3 | # I am a telegram bot, I created it using pyrogram library. https://github.com/pyrogram 4 | """ 5 | Apache License 2.0 6 | Copyright (c) 2022 @Digital_Botz 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | Telegram Link : https://t.me/Digital_Botz 24 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 25 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 26 | """ 27 | 28 | __name__ = "Digital-Rename-Bot" 29 | __version__ = "3.0.8" 30 | __license__ = " Apache License, Version 2.0" 31 | __copyright__ = "Copyright (C) 2022-present Digital Botz " 32 | __programer__ = "Digital Botz" 33 | __library__ = "Pyʀᴏɢʀᴀᴍ" 34 | __language__ = "Pyᴛʜᴏɴ 3" 35 | __database__ = "Mᴏɴɢᴏ DB" 36 | __developer__ = "Digital Botz" 37 | __maindeveloper__ = "RknDeveloper" 38 | 39 | # main copyright herders (©️) 40 | # I have been working on this repo since 2022 41 | 42 | 43 | # main working files 44 | # - bot.py 45 | # - web_support.py 46 | # - plugins/ 47 | # - start_&_cb.py 48 | # - Force_Sub.py 49 | # - admin_panel.py 50 | # - file_rename.py 51 | # - metadata.py 52 | # - prefix_&_suffix.py 53 | # - thumb_&_cap.py 54 | # - config.py 55 | # - utils.py 56 | # - database.py 57 | 58 | # bot run files 59 | # - bot.py 60 | # - Procfile 61 | # - Dockerfile 62 | # - requirements.txt 63 | # - runtime.txt 64 | -------------------------------------------------------------------------------- /plugins/admin_panel.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | """ 7 | Apache License 2.0 8 | Copyright (c) 2022 @Digital_Botz 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | Telegram Link : https://t.me/Digital_Botz 26 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 27 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 28 | """ 29 | 30 | # extra imports 31 | from config import Config 32 | from helper.database import digital_botz 33 | from helper.utils import get_seconds, humanbytes 34 | import os, sys, time, asyncio, logging, datetime, pytz, traceback 35 | 36 | # pyrogram imports 37 | from pyrogram.types import Message 38 | from pyrogram import Client, filters 39 | from pyrogram.errors import FloodWait, InputUserDeactivated, UserIsBlocked, PeerIdInvalid 40 | 41 | 42 | logger = logging.getLogger(__name__) 43 | logger.setLevel(logging.INFO) 44 | 45 | @Client.on_message(filters.command(["stats", "status"]) & filters.user(Config.ADMIN)) 46 | async def get_stats(bot, message): 47 | total_users = await digital_botz.total_users_count() 48 | if bot.premium: 49 | total_premium_users = await digital_botz.total_premium_users_count() 50 | else: 51 | total_premium_users = "Disabled ✅" 52 | uptime = time.strftime("%Hh%Mm%Ss", time.gmtime(time.time() - bot.uptime)) 53 | start_t = time.time() 54 | rkn = await message.reply('**ᴘʀᴏᴄᴇssɪɴɢ.....**') 55 | end_t = time.time() 56 | time_taken_s = (end_t - start_t) * 1000 57 | await rkn.edit(text=f"**--Bᴏᴛ Sᴛᴀᴛᴜꜱ--** \n\n**⌚️ Bᴏᴛ Uᴩᴛɪᴍᴇ:** {uptime} \n**🐌 Cᴜʀʀᴇɴᴛ Pɪɴɢ:** `{time_taken_s:.3f} ᴍꜱ` \n**👭 Tᴏᴛᴀʟ Uꜱᴇʀꜱ:** `{total_users}`\n**💸 ᴛᴏᴛᴀʟ ᴘʀᴇᴍɪᴜᴍ ᴜsᴇʀs:** `{total_premium_users}`") 58 | 59 | # bot logs process 60 | @Client.on_message(filters.command('logs') & filters.user(Config.ADMIN)) 61 | async def log_file(b, m): 62 | try: 63 | await m.reply_document('BotLog.txt') 64 | except Exception as e: 65 | await m.reply(str(e)) 66 | 67 | @Client.on_message(filters.command(["addpremium", "add_premium"]) & filters.user(Config.ADMIN)) 68 | async def add_premium(client, message): 69 | if not client.premium: 70 | return await message.reply_text("premium mode disabled ✅") 71 | 72 | if client.uploadlimit: 73 | if len(message.command) < 4: 74 | return await message.reply_text("Usage : /addpremium user_id Plan_Type (e.g... `Pro`, `UltraPro`) time (e.g., '1 day for days', '1 hour for hours', or '1 min for minutes', or '1 month for months' or '1 year for year')", quote=True) 75 | 76 | user_id = int(message.command[1]) 77 | plan_type = message.command[2] 78 | 79 | if plan_type not in ["Pro", "UltraPro"]: 80 | return await message.reply_text("Invalid Plan Type. Please use 'Pro' or 'UltraPro'.", quote=True) 81 | 82 | time_string = " ".join(message.command[3:]) 83 | 84 | time_zone = datetime.datetime.now(pytz.timezone("Asia/Kolkata")) 85 | current_time = time_zone.strftime("%d-%m-%Y\n⏱️ ᴊᴏɪɴɪɴɢ ᴛɪᴍᴇ : %I:%M:%S %p") 86 | 87 | user = await client.get_users(user_id) 88 | 89 | if plan_type == "Pro": 90 | limit = 107374182400 91 | type = "Pro" 92 | elif plan_type == "UltraPro": 93 | limit = 1073741824000 94 | type = "UltraPro" 95 | 96 | seconds = await get_seconds(time_string) 97 | if seconds <= 0: 98 | return await message.reply_text("Invalid time format. Please use `/addpremium user_id 1 year 1 month 1 day 1 min 10 s`", quote=True) 99 | 100 | expiry_time = datetime.datetime.now() + datetime.timedelta(seconds=seconds) 101 | user_data = {"id": user_id, "expiry_time": expiry_time} 102 | await digital_botz.addpremium(user_id, user_data, limit, type) 103 | 104 | user_data = await digital_botz.get_user_data(user_id) 105 | limit = user_data.get('uploadlimit', 0) 106 | type = user_data.get('usertype', "Free") 107 | data = await digital_botz.get_user(user_id) 108 | expiry = data.get("expiry_time") 109 | expiry_str_in_ist = expiry.astimezone(pytz.timezone("Asia/Kolkata")).strftime("%d-%m-%Y\n⏱️ ᴇxᴘɪʀʏ ᴛɪᴍᴇ : %I:%M:%S %p") 110 | 111 | await message.reply_text(f"ᴘʀᴇᴍɪᴜᴍ ᴀᴅᴅᴇᴅ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ✅\n\n👤 ᴜꜱᴇʀ : {user.mention}\n⚡ ᴜꜱᴇʀ ɪᴅ : {user_id}\nᴘʟᴀɴ :- `{type}`\nᴅᴀɪʟʏ ᴜᴘʟᴏᴀᴅ ʟɪᴍɪᴛ :- `{humanbytes(limit)}`\n⏰ ᴘʀᴇᴍɪᴜᴍ ᴀᴄᴄᴇꜱꜱ : {time_string}\n\n⏳ ᴊᴏɪɴɪɴɢ ᴅᴀᴛᴇ : {current_time}\n\n⌛️ ᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}", quote=True, disable_web_page_preview=True) 112 | 113 | await client.send_message( 114 | chat_id=user_id, 115 | text=f"👋 ʜᴇʏ {user.mention},\nᴛʜᴀɴᴋ ʏᴏᴜ ꜰᴏʀ ᴘᴜʀᴄʜᴀꜱɪɴɢ ᴘʀᴇᴍɪᴜᴍ.\nᴇɴᴊᴏʏ !! ✨🎉\n\n⏰ ᴘʀᴇᴍɪᴜᴍ ᴀᴄᴄᴇꜱꜱ : {time}\nᴘʟᴀɴ :- `{type}`\nᴅᴀɪʟʏ ᴜᴘʟᴏᴀᴅ ʟɪᴍɪᴛ :- `{humanbytes(limit)}`\n⏳ ᴊᴏɪɴɪɴɢ ᴅᴀᴛᴇ : {current_time}\n\n⌛️ ᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}", disable_web_page_preview=True 116 | ) 117 | 118 | else: 119 | if len(message.command) < 3: 120 | return await message.reply_text("Usage : /addpremium user_id time (e.g., '1 day for days', '1 hour for hours', or '1 min for minutes', or '1 month for months' or '1 year for year')", quote=True) 121 | 122 | user_id = int(message.command[1]) 123 | time_string = " ".join(message.command[2:]) 124 | 125 | time_zone = datetime.datetime.now(pytz.timezone("Asia/Kolkata")) 126 | current_time = time_zone.strftime("%d-%m-%Y\n⏱️ ᴊᴏɪɴɪɴɢ ᴛɪᴍᴇ : %I:%M:%S %p") 127 | 128 | user = await client.get_users(user_id) 129 | seconds = await get_seconds(time_string) 130 | if seconds <= 0: 131 | return await message.reply_text("Invalid time format. Please use `/addpremium user_id 1 year 1 month 1 day 1 min 10 s`", quote=True) 132 | 133 | expiry_time = datetime.datetime.now() + datetime.timedelta(seconds=seconds) 134 | user_data = {"id": user_id, "expiry_time": expiry_time} 135 | await digital_botz.addpremium(user_id, user_data) 136 | data = await digital_botz.get_user(user_id) 137 | expiry = data.get("expiry_time") 138 | expiry_str_in_ist = expiry.astimezone(pytz.timezone("Asia/Kolkata")).strftime("%d-%m-%Y\n⏱️ ᴇxᴘɪʀʏ ᴛɪᴍᴇ : %I:%M:%S %p") 139 | 140 | await message.reply_text(f"ᴘʀᴇᴍɪᴜᴍ ᴀᴅᴅᴇᴅ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ✅\n\n👤 ᴜꜱᴇʀ : {user.mention}\n⚡ ᴜꜱᴇʀ ɪᴅ : {user_id}\n⏰ ᴘʀᴇᴍɪᴜᴍ ᴀᴄᴄᴇꜱꜱ : {time_string}\n\n⏳ ᴊᴏɪɴɪɴɢ ᴅᴀᴛᴇ : {current_time}\n\n⌛️ ᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}", quote=True, disable_web_page_preview=True) 141 | 142 | await client.send_message( 143 | chat_id=user_id, 144 | text=f"👋 ʜᴇʏ {user.mention},\nᴛʜᴀɴᴋ ʏᴏᴜ ꜰᴏʀ ᴘᴜʀᴄʜᴀꜱɪɴɢ ᴘʀᴇᴍɪᴜᴍ.\nᴇɴᴊᴏʏ !! ✨🎉\n\n⏰ ᴘʀᴇᴍɪᴜᴍ ᴀᴄᴄᴇꜱꜱ : {time}\n⏳ ᴊᴏɪɴɪɴɢ ᴅᴀᴛᴇ : {current_time}\n\n⌛️ ᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}", disable_web_page_preview=True 145 | ) 146 | 147 | 148 | @Client.on_message(filters.command(["removepremium", "remove_premium"]) & filters.user(Config.ADMIN)) 149 | async def remove_premium(bot, message): 150 | if not bot.premium: 151 | return await message.reply_text("premium mode disabled ✅") 152 | 153 | if len(message.command) == 2: 154 | user_id = int(message.command[1]) # Convert the user_id to integer 155 | user = await bot.get_users(user_id) 156 | if await digital_botz.has_premium_access(user_id): 157 | await digital_botz.remove_premium(user_id) 158 | await message.reply_text(f"ʜᴇʏ {user.mention}, ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴ sᴜᴄᴄᴇssғᴜʟʟʏ ʀᴇᴍᴏᴠᴇᴅ.", quote=True) 159 | await bot.send_message(chat_id=user_id, text=f"ʜᴇʏ {user.mention},\n\n✨ ʏᴏᴜʀ ᴀᴄᴄᴏᴜɴᴛ ʜᴀs ʙᴇᴇɴ ʀᴇᴍᴏᴠᴇᴅ ᴛᴏ ᴏᴜʀ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴ\n\nᴄʜᴇᴄᴋ ʏᴏᴜʀ ᴘʟᴀɴ ʜᴇʀᴇ /myplan") 160 | else: 161 | await message.reply_text("ᴜɴᴀʙʟᴇ ᴛᴏ ʀᴇᴍᴏᴠᴇ ᴘʀᴇᴍɪᴜᴍ ᴜꜱᴇʀ !\nᴀʀᴇ ʏᴏᴜ ꜱᴜʀᴇ, ɪᴛ ᴡᴀꜱ ᴀ ᴘʀᴇᴍɪᴜᴍ ᴜꜱᴇʀ ɪᴅ ?", quote=True) 162 | else: 163 | await message.reply_text("ᴜꜱᴀɢᴇ : /remove_premium ᴜꜱᴇʀ ɪᴅ", quote=True) 164 | 165 | 166 | # Restart to cancell all process 167 | @Client.on_message(filters.private & filters.command("restart") & filters.user(Config.ADMIN)) 168 | async def restart_bot(b, m): 169 | rkn = await b.send_message(text="**🔄 ᴘʀᴏᴄᴇssᴇs sᴛᴏᴘᴘᴇᴅ. ʙᴏᴛ ɪs ʀᴇsᴛᴀʀᴛɪɴɢ.....**", chat_id=m.chat.id) 170 | failed = 0 171 | success = 0 172 | deactivated = 0 173 | blocked = 0 174 | start_time = time.time() 175 | total_users = await digital_botz.total_users_count() 176 | all_users = await digital_botz.get_all_users() 177 | async for user in all_users: 178 | try: 179 | restart_msg = f"ʜᴇʏ, {(await b.get_users(user['_id'])).mention}\n\n**🔄 ᴘʀᴏᴄᴇssᴇs sᴛᴏᴘᴘᴇᴅ. ʙᴏᴛ ɪs ʀᴇsᴛᴀʀᴛɪɴɢ.....\n\n✅️ ʙᴏᴛ ɪs ʀᴇsᴛᴀʀᴛᴇᴅ. ɴᴏᴡ ʏᴏᴜ ᴄᴀɴ ᴜsᴇ ᴍᴇ.**" 180 | await b.send_message(user['_id'], restart_msg) 181 | success += 1 182 | except InputUserDeactivated: 183 | deactivated +=1 184 | await digital_botz.delete_user(user['_id']) 185 | except UserIsBlocked: 186 | blocked +=1 187 | await digital_botz.delete_user(user['_id']) 188 | except Exception as e: 189 | failed += 1 190 | await digital_botz.delete_user(user['_id']) 191 | print(e) 192 | pass 193 | try: 194 | await rkn.edit(f"ʀᴇsᴛᴀʀᴛ ɪɴ ᴩʀᴏɢʀᴇꜱꜱ:\n\n• ᴛᴏᴛᴀʟ ᴜsᴇʀs: {total_users}\n• sᴜᴄᴄᴇssғᴜʟ: {success}\n• ʙʟᴏᴄᴋᴇᴅ ᴜsᴇʀs: {blocked}\n• ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs: {deactivated}\n• ᴜɴsᴜᴄᴄᴇssғᴜʟ: {failed}") 195 | except FloodWait as e: 196 | await asyncio.sleep(e.value) 197 | completed_restart = datetime.timedelta(seconds=int(time.time() - start_time)) 198 | await rkn.edit(f"ᴄᴏᴍᴘʟᴇᴛᴇᴅ ʀᴇsᴛᴀʀᴛ: {completed_restart}\n\n• ᴛᴏᴛᴀʟ ᴜsᴇʀs: {total_users}\n• sᴜᴄᴄᴇssғᴜʟ: {success}\n• ʙʟᴏᴄᴋᴇᴅ ᴜsᴇʀs: {blocked}\n• ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs: {deactivated}\n• ᴜɴsᴜᴄᴄᴇssғᴜʟ: {failed}") 199 | os.execl(sys.executable, sys.executable, *sys.argv) 200 | 201 | @Client.on_message(filters.private & filters.command("ban") & filters.user(Config.ADMIN)) 202 | async def ban(c: Client, m: Message): 203 | if len(m.command) == 1: 204 | await m.reply_text( 205 | f"Use this command to ban any user from the bot.\n\n" 206 | f"Usage:\n\n" 207 | f"`/ban user_id ban_duration ban_reason`\n\n" 208 | f"Eg: `/ban 1234567 28 You misused me.`\n" 209 | f"This will ban user with id `1234567` for `28` days for the reason `You misused me`.", 210 | quote=True 211 | ) 212 | return 213 | 214 | try: 215 | user_id = int(m.command[1]) 216 | ban_duration = int(m.command[2]) 217 | ban_reason = ' '.join(m.command[3:]) 218 | ban_log_text = f"Banning user {user_id} for {ban_duration} days for the reason {ban_reason}." 219 | try: 220 | await c.send_message(user_id, 221 | f"You are banned to use this bot for **{ban_duration}** day(s) for the reason __{ban_reason}__ \n\n" 222 | f"**Message from the admin**" 223 | ) 224 | ban_log_text += '\n\nUser notified successfully!' 225 | except: 226 | traceback.print_exc() 227 | ban_log_text += f"\n\nUser notification failed! \n\n`{traceback.format_exc()}`" 228 | 229 | await digital_botz.ban_user(user_id, ban_duration, ban_reason) 230 | await m.reply_text(ban_log_text, quote=True) 231 | except: 232 | traceback.print_exc() 233 | await m.reply_text( 234 | f"Error occoured! Traceback given below\n\n`{traceback.format_exc()}`", 235 | quote=True 236 | ) 237 | 238 | 239 | @Client.on_message(filters.private & filters.command("unban") & filters.user(Config.ADMIN)) 240 | async def unban(c: Client, m: Message): 241 | if len(m.command) == 1: 242 | await m.reply_text( 243 | f"Use this command to unban any user.\n\n" 244 | f"Usage:\n\n`/unban user_id`\n\n" 245 | f"Eg: `/unban 1234567`\n" 246 | f"This will unban user with id `1234567`.", 247 | quote=True 248 | ) 249 | return 250 | 251 | try: 252 | user_id = int(m.command[1]) 253 | unban_log_text = f"Unbanning user {user_id}" 254 | try: 255 | await c.send_message(user_id, f"Your ban was lifted!") 256 | unban_log_text += '\n\nUser notified successfully!' 257 | except: 258 | traceback.print_exc() 259 | unban_log_text += f"\n\nUser notification failed! \n\n`{traceback.format_exc()}`" 260 | await digital_botz.remove_ban(user_id) 261 | await m.reply_text(unban_log_text, quote=True) 262 | except: 263 | traceback.print_exc() 264 | await m.reply_text( 265 | f"Error occurred! Traceback given below\n\n`{traceback.format_exc()}`", 266 | quote=True 267 | ) 268 | 269 | 270 | @Client.on_message(filters.private & filters.command("banned_users") & filters.user(Config.ADMIN)) 271 | async def _banned_users(_, m: Message): 272 | all_banned_users = await digital_botz.get_all_banned_users() 273 | banned_usr_count = 0 274 | text = '' 275 | async for banned_user in all_banned_users: 276 | user_id = banned_user['id'] 277 | ban_duration = banned_user['ban_status']['ban_duration'] 278 | banned_on = banned_user['ban_status']['banned_on'] 279 | ban_reason = banned_user['ban_status']['ban_reason'] 280 | banned_usr_count += 1 281 | text += f"> **user_id**: `{user_id}`, **Ban Duration**: `{ban_duration}`, " \ 282 | f"**Banned on**: `{banned_on}`, **Reason**: `{ban_reason}`\n\n" 283 | reply_text = f"Total banned user(s): `{banned_usr_count}`\n\n{text}" 284 | if len(reply_text) > 4096: 285 | with open('banned-users.txt', 'w') as f: 286 | f.write(reply_text) 287 | await m.reply_document('banned-users.txt', True) 288 | os.remove('banned-users.txt') 289 | return 290 | await m.reply_text(reply_text, True) 291 | 292 | 293 | @Client.on_message(filters.command("broadcast") & filters.user(Config.ADMIN) & filters.reply) 294 | async def broadcast_handler(bot: Client, m: Message): 295 | await bot.send_message(Config.LOG_CHANNEL, f"{m.from_user.mention} or {m.from_user.id} Iꜱ ꜱᴛᴀʀᴛᴇᴅ ᴛʜᴇ Bʀᴏᴀᴅᴄᴀꜱᴛ......") 296 | all_users = await digital_botz.get_all_users() 297 | broadcast_msg = m.reply_to_message 298 | sts_msg = await m.reply_text("Bʀᴏᴀᴅᴄᴀꜱᴛ Sᴛᴀʀᴛᴇᴅ..!") 299 | done = 0 300 | failed = 0 301 | success = 0 302 | start_time = time.time() 303 | total_users = await digital_botz.total_users_count() 304 | async for user in all_users: 305 | sts = await send_msg(user['_id'], broadcast_msg) 306 | if sts == 200: 307 | success += 1 308 | else: 309 | failed += 1 310 | if sts == 400: 311 | await digital_botz.delete_user(user['_id']) 312 | done += 1 313 | if not done % 20: 314 | await sts_msg.edit(f"Bʀᴏᴀᴅᴄᴀꜱᴛ Iɴ Pʀᴏɢʀᴇꜱꜱ: \nTᴏᴛᴀʟ Uꜱᴇʀꜱ {total_users} \nCᴏᴍᴩʟᴇᴛᴇᴅ: {done} / {total_users}\nSᴜᴄᴄᴇꜱꜱ: {success}\nFᴀɪʟᴇᴅ: {failed}") 315 | completed_in = datetime.timedelta(seconds=int(time.time() - start_time)) 316 | await sts_msg.edit(f"Bʀᴏᴀᴅᴄᴀꜱᴛ Cᴏᴍᴩʟᴇᴛᴇᴅ: \nCᴏᴍᴩʟᴇᴛᴇᴅ Iɴ `{completed_in}`.\n\nTᴏᴛᴀʟ Uꜱᴇʀꜱ {total_users}\nCᴏᴍᴩʟᴇᴛᴇᴅ: {done} / {total_users}\nSᴜᴄᴄᴇꜱꜱ: {success}\nFᴀɪʟᴇᴅ: {failed}") 317 | 318 | async def send_msg(user_id, message): 319 | try: 320 | await message.copy(chat_id=int(user_id)) 321 | return 200 322 | except FloodWait as e: 323 | await asyncio.sleep(e.value) 324 | return send_msg(user_id, message) 325 | except InputUserDeactivated: 326 | logger.info(f"{user_id} : Dᴇᴀᴄᴛɪᴠᴀᴛᴇᴅ") 327 | return 400 328 | except UserIsBlocked: 329 | logger.info(f"{user_id} : Bʟᴏᴄᴋᴇᴅ Tʜᴇ Bᴏᴛ") 330 | return 400 331 | except PeerIdInvalid: 332 | logger.info(f"{user_id} : Uꜱᴇʀ Iᴅ Iɴᴠᴀʟɪᴅ") 333 | return 400 334 | except Exception as e: 335 | logger.error(f"{user_id} : {e}") 336 | return 500 337 | 338 | 339 | # Rkn Developer 340 | # Don't Remove Credit 😔 341 | # Telegram Channel @RknDeveloper & @Rkn_Botz 342 | # Developer @RknDeveloperr 343 | -------------------------------------------------------------------------------- /plugins/file_rename.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | # pyrogram imports 33 | from pyrogram import Client, filters 34 | from pyrogram.enums import MessageMediaType 35 | from pyrogram.errors import FloodWait 36 | from pyrogram.file_id import FileId 37 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, ForceReply 38 | 39 | # hachoir imports 40 | from hachoir.metadata import extractMetadata 41 | from hachoir.parser import createParser 42 | from PIL import Image 43 | 44 | # bots imports 45 | from helper.utils import progress_for_pyrogram, convert, humanbytes, add_prefix_suffix, remove_path 46 | from helper.database import digital_botz 47 | from helper.ffmpeg import change_metadata 48 | from config import Config 49 | 50 | # extra imports 51 | from asyncio import sleep 52 | import os, time, asyncio 53 | 54 | 55 | UPLOAD_TEXT = """Uploading Started....""" 56 | DOWNLOAD_TEXT = """Download Started...""" 57 | 58 | app = Client("4gb_FileRenameBot", api_id=Config.API_ID, api_hash=Config.API_HASH, session_string=Config.STRING_SESSION) 59 | 60 | 61 | @Client.on_message(filters.private & (filters.audio | filters.document | filters.video)) 62 | async def rename_start(client, message): 63 | user_id = message.from_user.id 64 | rkn_file = getattr(message, message.media.value) 65 | filename = rkn_file.file_name 66 | filesize = humanbytes(rkn_file.file_size) 67 | mime_type = rkn_file.mime_type 68 | dcid = FileId.decode(rkn_file.file_id).dc_id 69 | extension_type = mime_type.split('/')[0] 70 | 71 | if client.premium and client.uploadlimit: 72 | await digital_botz.reset_uploadlimit_access(user_id) 73 | user_data = await digital_botz.get_user_data(user_id) 74 | limit = user_data.get('uploadlimit', 0) 75 | used = user_data.get('used_limit', 0) 76 | remain = int(limit) - int(used) 77 | used_percentage = int(used) / int(limit) * 100 78 | if remain < int(rkn_file.file_size): 79 | return await message.reply_text(f"{used_percentage:.2f}% Of Daily Upload Limit {humanbytes(limit)}.\n\n Media Size: {filesize}\n Your Used Daily Limit {humanbytes(used)}\n\nYou have only **{humanbytes(remain)}** Data.\nPlease, Buy Premium Plan s.", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("🪪 Uᴘɢʀᴀᴅᴇ", callback_data="plans")]])) 80 | 81 | 82 | if await digital_botz.has_premium_access(user_id) and client.premium: 83 | if not Config.STRING_SESSION: 84 | if rkn_file.file_size > 2000 * 1024 * 1024: 85 | return await message.reply_text("Sᴏʀʀy Bʀᴏ Tʜɪꜱ Bᴏᴛ Iꜱ Dᴏᴇꜱɴ'ᴛ Sᴜᴩᴩᴏʀᴛ Uᴩʟᴏᴀᴅɪɴɢ Fɪʟᴇꜱ Bɪɢɢᴇʀ Tʜᴀɴ 2Gʙ+") 86 | 87 | try: 88 | await message.reply_text( 89 | text=f"**__ᴍᴇᴅɪᴀ ɪɴꜰᴏ:\n\n◈ ᴏʟᴅ ꜰɪʟᴇ ɴᴀᴍᴇ: `{filename}`\n\n◈ ᴇxᴛᴇɴꜱɪᴏɴ: `{extension_type.upper()}`\n◈ ꜰɪʟᴇ ꜱɪᴢᴇ: `{filesize}`\n◈ ᴍɪᴍᴇ ᴛʏᴇᴩ: `{mime_type}`\n◈ ᴅᴄ ɪᴅ: `{dcid}`\n\nᴘʟᴇᴀsᴇ ᴇɴᴛᴇʀ ᴛʜᴇ ɴᴇᴡ ғɪʟᴇɴᴀᴍᴇ ᴡɪᴛʜ ᴇxᴛᴇɴsɪᴏɴ ᴀɴᴅ ʀᴇᴘʟʏ ᴛʜɪs ᴍᴇssᴀɢᴇ....__**", 90 | reply_to_message_id=message.id, 91 | reply_markup=ForceReply(True) 92 | ) 93 | await sleep(30) 94 | except FloodWait as e: 95 | await sleep(e.value) 96 | await message.reply_text( 97 | text=f"**__ᴍᴇᴅɪᴀ ɪɴꜰᴏ:\n\n◈ ᴏʟᴅ ꜰɪʟᴇ ɴᴀᴍᴇ: `{filename}`\n\n◈ ᴇxᴛᴇɴꜱɪᴏɴ: `{extension_type.upper()}`\n◈ ꜰɪʟᴇ ꜱɪᴢᴇ: `{filesize}`\n◈ ᴍɪᴍᴇ ᴛʏᴇᴩ: `{mime_type}`\n◈ ᴅᴄ ɪᴅ: `{dcid}`\n\nᴘʟᴇᴀsᴇ ᴇɴᴛᴇʀ ᴛʜᴇ ɴᴇᴡ ғɪʟᴇɴᴀᴍᴇ ᴡɪᴛʜ ᴇxᴛᴇɴsɪᴏɴ ᴀɴᴅ ʀᴇᴘʟʏ ᴛʜɪs ᴍᴇssᴀɢᴇ....__**", 98 | reply_to_message_id=message.id, 99 | reply_markup=ForceReply(True) 100 | ) 101 | except: 102 | pass 103 | else: 104 | if rkn_file.file_size > 2000 * 1024 * 1024 and client.premium: 105 | return await message.reply_text("If you want to rename 4GB+ files then you will have to buy premium. /plans") 106 | 107 | try: 108 | await message.reply_text( 109 | text=f"**__ᴍᴇᴅɪᴀ ɪɴꜰᴏ:\n\n◈ ᴏʟᴅ ꜰɪʟᴇ ɴᴀᴍᴇ: `{filename}`\n\n◈ ᴇxᴛᴇɴꜱɪᴏɴ: `{extension_type.upper()}`\n◈ ꜰɪʟᴇ ꜱɪᴢᴇ: `{filesize}`\n◈ ᴍɪᴍᴇ ᴛʏᴇᴩ: `{mime_type}`\n◈ ᴅᴄ ɪᴅ: `{dcid}`\n\nᴘʟᴇᴀsᴇ ᴇɴᴛᴇʀ ᴛʜᴇ ɴᴇᴡ ғɪʟᴇɴᴀᴍᴇ ᴡɪᴛʜ ᴇxᴛᴇɴsɪᴏɴ ᴀɴᴅ ʀᴇᴘʟʏ ᴛʜɪs ᴍᴇssᴀɢᴇ....__**", 110 | reply_to_message_id=message.id, 111 | reply_markup=ForceReply(True) 112 | ) 113 | await sleep(30) 114 | except FloodWait as e: 115 | await sleep(e.value) 116 | await message.reply_text( 117 | text=f"**__ᴍᴇᴅɪᴀ ɪɴꜰᴏ:\n\n◈ ᴏʟᴅ ꜰɪʟᴇ ɴᴀᴍᴇ: `{filename}`\n\n◈ ᴇxᴛᴇɴꜱɪᴏɴ: `{extension_type.upper()}`\n◈ ꜰɪʟᴇ ꜱɪᴢᴇ: `{filesize}`\n◈ ᴍɪᴍᴇ ᴛʏᴇᴩ: `{mime_type}`\n◈ ᴅᴄ ɪᴅ: `{dcid}`\n\nᴘʟᴇᴀsᴇ ᴇɴᴛᴇʀ ᴛʜᴇ ɴᴇᴡ ғɪʟᴇɴᴀᴍᴇ ᴡɪᴛʜ ᴇxᴛᴇɴsɪᴏɴ ᴀɴᴅ ʀᴇᴘʟʏ ᴛʜɪs ᴍᴇssᴀɢᴇ....__**", 118 | reply_to_message_id=message.id, 119 | reply_markup=ForceReply(True) 120 | ) 121 | except: 122 | pass 123 | 124 | @Client.on_message(filters.private & filters.reply) 125 | async def refunc(client, message): 126 | reply_message = message.reply_to_message 127 | if (reply_message.reply_markup) and isinstance(reply_message.reply_markup, ForceReply): 128 | new_name = message.text 129 | await message.delete() 130 | msg = await client.get_messages(message.chat.id, reply_message.id) 131 | file = msg.reply_to_message 132 | media = getattr(file, file.media.value) 133 | if not "." in new_name: 134 | if "." in media.file_name: 135 | extn = media.file_name.rsplit('.', 1)[-1] 136 | else: 137 | extn = "mkv" 138 | new_name = new_name + "." + extn 139 | await reply_message.delete() 140 | 141 | button = [[InlineKeyboardButton("📁 Dᴏᴄᴜᴍᴇɴᴛ",callback_data = "upload_document")]] 142 | if file.media in [MessageMediaType.VIDEO, MessageMediaType.DOCUMENT]: 143 | button.append([InlineKeyboardButton("🎥 Vɪᴅᴇᴏ", callback_data = "upload_video")]) 144 | elif file.media == MessageMediaType.AUDIO: 145 | button.append([InlineKeyboardButton("🎵 Aᴜᴅɪᴏ", callback_data = "upload_audio")]) 146 | await message.reply( 147 | text=f"**Sᴇʟᴇᴄᴛ Tʜᴇ Oᴜᴛᴩᴜᴛ Fɪʟᴇ Tyᴩᴇ**\n**• Fɪʟᴇ Nᴀᴍᴇ :-**`{new_name}`", 148 | reply_to_message_id=file.id, 149 | reply_markup=InlineKeyboardMarkup(button) 150 | ) 151 | 152 | 153 | 154 | @Client.on_callback_query(filters.regex("upload")) 155 | async def doc(bot, update): 156 | rkn_processing = await update.message.edit("`Processing...`") 157 | 158 | # Creating Directory for Metadata 159 | if not os.path.isdir("Metadata"): 160 | os.mkdir("Metadata") 161 | 162 | user_id = int(update.message.chat.id) 163 | new_name = update.message.text 164 | new_filename_ = new_name.split(":-")[1] 165 | user_data = await digital_botz.get_user_data(user_id) 166 | 167 | try: 168 | # adding prefix and suffix 169 | prefix = await digital_botz.get_prefix(user_id) 170 | suffix = await digital_botz.get_suffix(user_id) 171 | new_filename = add_prefix_suffix(new_filename_, prefix, suffix) 172 | except Exception as e: 173 | return await rkn_processing.edit(f"⚠️ Something went wrong can't able to set Prefix or Suffix ☹️ \n\n❄️ Contact My Creator -> @RknDeveloperr\nError: {e}") 174 | 175 | # msg file location 176 | file = update.message.reply_to_message 177 | media = getattr(file, file.media.value) 178 | 179 | # file downloaded path 180 | file_path = f"Renames/{new_filename}" 181 | 182 | metadata_path = f"Metadata/{new_filename}" 183 | 184 | await rkn_processing.edit("`Try To Download....`") 185 | if bot.premium and bot.uploadlimit: 186 | limit = user_data.get('uploadlimit', 0) 187 | used = user_data.get('used_limit', 0) 188 | await digital_botz.set_used_limit(user_id, media.file_size) 189 | total_used = int(used) + int(media.file_size) 190 | await digital_botz.set_used_limit(user_id, total_used) 191 | 192 | try: 193 | dl_path = await bot.download_media(message=file, file_name=file_path, progress=progress_for_pyrogram, progress_args=(DOWNLOAD_TEXT, rkn_processing, time.time())) 194 | except Exception as e: 195 | if bot.premium and bot.uploadlimit: 196 | used_remove = int(used) - int(media.file_size) 197 | await digital_botz.set_used_limit(user_id, used_remove) 198 | return await rkn_processing.edit(e) 199 | 200 | metadata_mode = await digital_botz.get_metadata_mode(user_id) 201 | if (metadata_mode): 202 | metadata = await digital_botz.get_metadata_code(user_id) 203 | if metadata: 204 | await rkn_processing.edit("I Fᴏᴜɴᴅ Yᴏᴜʀ Mᴇᴛᴀᴅᴀᴛᴀ\n\n__**Pʟᴇᴀsᴇ Wᴀɪᴛ...**__\n**Aᴅᴅɪɴɢ Mᴇᴛᴀᴅᴀᴛᴀ Tᴏ Fɪʟᴇ....**") 205 | if change_metadata(dl_path, metadata_path, metadata): 206 | await rkn_processing.edit("Metadata Added.....") 207 | print("Metadata Added.....") 208 | await rkn_processing.edit("**Metadata added to the file successfully ✅**\n\n**Tʀyɪɴɢ Tᴏ Uᴩʟᴏᴀᴅɪɴɢ....**") 209 | else: 210 | await rkn_processing.edit("`Try To Uploading....`") 211 | 212 | duration = 0 213 | try: 214 | parser = createParser(file_path) 215 | metadata = extractMetadata(parser) 216 | if metadata.has("duration"): 217 | duration = metadata.get('duration').seconds 218 | parser.close() 219 | except: 220 | pass 221 | 222 | ph_path = None 223 | c_caption = await digital_botz.get_caption(user_id) 224 | c_thumb = await digital_botz.get_thumbnail(user_id) 225 | 226 | if c_caption: 227 | try: 228 | # adding custom caption 229 | caption = c_caption.format(filename=new_filename, filesize=humanbytes(media.file_size), duration=convert(duration)) 230 | except Exception as e: 231 | if bot.premium and bot.uploadlimit: 232 | used_remove = int(used) - int(media.file_size) 233 | await digital_botz.set_used_limit(user_id, used_remove) 234 | return await rkn_processing.edit(text=f"Yᴏᴜʀ Cᴀᴩᴛɪᴏɴ Eʀʀᴏʀ Exᴄᴇᴩᴛ Kᴇyᴡᴏʀᴅ Aʀɢᴜᴍᴇɴᴛ ●> ({e})") 235 | else: 236 | caption = f"**{new_filename}**" 237 | 238 | if (media.thumbs or c_thumb): 239 | # downloading thumbnail path 240 | if c_thumb: 241 | ph_path = await bot.download_media(c_thumb) 242 | else: 243 | ph_path = await bot.download_media(media.thumbs[0].file_id) 244 | Image.open(ph_path).convert("RGB").save(ph_path) 245 | img = Image.open(ph_path) 246 | img.resize((320, 320)) 247 | img.save(ph_path, "JPEG") 248 | 249 | type = update.data.split("_")[1] 250 | if media.file_size > 2000 * 1024 * 1024: 251 | try: 252 | if type == "document": 253 | filw = await app.send_document( 254 | Config.LOG_CHANNEL, 255 | document=metadata_path if metadata_mode else file_path, 256 | thumb=ph_path, 257 | caption=caption, 258 | progress=progress_for_pyrogram, 259 | progress_args=(UPLOAD_TEXT, rkn_processing, time.time())) 260 | 261 | from_chat = filw.chat.id 262 | mg_id = filw.id 263 | time.sleep(2) 264 | await bot.copy_message(update.from_user.id, from_chat, mg_id) 265 | await bot.delete_messages(from_chat, mg_id) 266 | elif type == "video": 267 | filw = await app.send_video( 268 | Config.LOG_CHANNEL, 269 | video=metadata_path if metadata_mode else file_path, 270 | caption=caption, 271 | thumb=ph_path, 272 | duration=duration, 273 | progress=progress_for_pyrogram, 274 | progress_args=(UPLOAD_TEXT, rkn_processing, time.time())) 275 | 276 | from_chat = filw.chat.id 277 | mg_id = filw.id 278 | time.sleep(2) 279 | await bot.copy_message(update.from_user.id, from_chat, mg_id) 280 | await bot.delete_messages(from_chat, mg_id) 281 | elif type == "audio": 282 | filw = await app.send_audio( 283 | Config.LOG_CHANNEL, 284 | audio=metadata_path if metadata_mode else file_path, 285 | caption=caption, 286 | thumb=ph_path, 287 | duration=duration, 288 | progress=progress_for_pyrogram, 289 | progress_args=(UPLOAD_TEXT, rkn_processing, time.time())) 290 | 291 | from_chat = filw.chat.id 292 | mg_id = filw.id 293 | time.sleep(2) 294 | await bot.copy_message(update.from_user.id, from_chat, mg_id) 295 | await bot.delete_messages(from_chat, mg_id) 296 | except Exception as e: 297 | if bot.premium and bot.uploadlimit: 298 | used_remove = int(used) - int(media.file_size) 299 | await digital_botz.set_used_limit(user_id, used_remove) 300 | await remove_path(ph_path, file_path, dl_path, metadata_path) 301 | return await rkn_processing.edit(f" Eʀʀᴏʀ {e}") 302 | else: 303 | try: 304 | if type == "document": 305 | await bot.send_document( 306 | update.message.chat.id, 307 | document=metadata_path if metadata_mode else file_path, 308 | thumb=ph_path, 309 | caption=caption, 310 | progress=progress_for_pyrogram, 311 | progress_args=(UPLOAD_TEXT, rkn_processing, time.time())) 312 | elif type == "video": 313 | await bot.send_video( 314 | update.message.chat.id, 315 | video=metadata_path if metadata_mode else file_path, 316 | caption=caption, 317 | thumb=ph_path, 318 | duration=duration, 319 | progress=progress_for_pyrogram, 320 | progress_args=(UPLOAD_TEXT, rkn_processing, time.time())) 321 | elif type == "audio": 322 | await bot.send_audio( 323 | update.message.chat.id, 324 | audio=metadata_path if metadata_mode else file_path, 325 | caption=caption, 326 | thumb=ph_path, 327 | duration=duration, 328 | progress=progress_for_pyrogram, 329 | progress_args=(UPLOAD_TEXT, rkn_processing, time.time())) 330 | except Exception as e: 331 | if bot.premium and bot.uploadlimit: 332 | used_remove = int(used) - int(media.file_size) 333 | await digital_botz.set_used_limit(user_id, used_remove) 334 | await remove_path(ph_path, file_path, dl_path, metadata_path) 335 | return await rkn_processing.edit(f" Eʀʀᴏʀ {e}") 336 | 337 | # please give credit 🙏🥲 338 | 339 | await remove_path(ph_path, file_path, dl_path, metadata_path) 340 | return await rkn_processing.edit("Uploaded Successfully....") 341 | 342 | #@RknDeveloper 343 | #✅ Team-RknDeveloper 344 | # Rkn Developer 345 | # Don't Remove Credit 😔 346 | # Telegram Channel @RknDeveloper & @Rkn_Botz 347 | # Developer @RknDeveloperr 348 | # Special Thanks To @ReshamOwner 349 | # Update Channel @Digital_Botz & @DigitalBotz_Support 350 | -------------------------------------------------------------------------------- /plugins/metadata.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | # pyrogram imports 33 | from pyrogram import Client, filters 34 | from pyrogram.types import Message, CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup 35 | 36 | # extra imports 37 | from helper.database import digital_botz 38 | from pyromod.exceptions import ListenerTimeout 39 | from config import rkn 40 | 41 | TRUE = [[InlineKeyboardButton('ᴍᴇᴛᴀᴅᴀᴛᴀ ᴏɴ', callback_data='metadata_1'), 42 | InlineKeyboardButton('✅', callback_data='metadata_1') 43 | ],[ 44 | InlineKeyboardButton('Sᴇᴛ Cᴜsᴛᴏᴍ Mᴇᴛᴀᴅᴀᴛᴀ', callback_data='cutom_metadata')]] 45 | FALSE = [[InlineKeyboardButton('ᴍᴇᴛᴀᴅᴀᴛᴀ ᴏғғ', callback_data='metadata_0'), 46 | InlineKeyboardButton('❌', callback_data='metadata_0') 47 | ],[ 48 | InlineKeyboardButton('Sᴇᴛ Cᴜsᴛᴏᴍ Mᴇᴛᴀᴅᴀᴛᴀ', callback_data='cutom_metadata')]] 49 | 50 | 51 | @Client.on_message(filters.private & filters.command('metadata')) 52 | async def handle_metadata(bot: Client, message: Message): 53 | RknDev = await message.reply_text("**Please Wait...**", reply_to_message_id=message.id) 54 | bool_metadata = await digital_botz.get_metadata_mode(message.from_user.id) 55 | user_metadata = await digital_botz.get_metadata_code(message.from_user.id) 56 | 57 | await RknDev.edit( 58 | f"Your Current Metadata:-\n\n➜ `{user_metadata}`", 59 | reply_markup=InlineKeyboardMarkup(TRUE if bool_metadata else FALSE) 60 | ) 61 | 62 | 63 | @Client.on_callback_query(filters.regex('.*?(custom_metadata|metadata).*?')) 64 | async def query_metadata(bot: Client, query: CallbackQuery): 65 | data = query.data 66 | if data.startswith('metadata_'): 67 | _bool = data.split('_')[1] 68 | user_metadata = await digital_botz.get_metadata_code(query.from_user.id) 69 | bool_meta = bool(eval(_bool)) 70 | await digital_botz.set_metadata_mode(query.from_user.id, bool_meta=not bool_meta) 71 | await query.message.edit(f"Your Current Metadata:-\n\n➜ `{user_metadata}`", reply_markup=InlineKeyboardMarkup(FALSE if bool_meta else TRUE)) 72 | 73 | elif data == 'cutom_metadata': 74 | await query.message.delete() 75 | try: 76 | metadata = await bot.ask(text=rkn.SEND_METADATA, chat_id=query.from_user.id, filters=filters.text, timeout=30, disable_web_page_preview=True) 77 | RknDev = await query.message.reply_text("**Please Wait...**", reply_to_message_id=metadata.id) 78 | await digital_botz.set_metadata_code(query.from_user.id, metadata_code=metadata.text) 79 | await RknDev.edit("**Your Metadata Code Set Successfully ✅**") 80 | except ListenerTimeout: 81 | await query.message.reply_text("⚠️ Error!!\n\n**Request timed out.**\nRestart by using /metadata", reply_to_message_id=query.message.id) 82 | except Exception as e: 83 | print(e) 84 | 85 | # Rkn Developer 86 | # Don't Remove Credit 😔 87 | # Telegram Channel @RknDeveloper & @Rkn_Botz 88 | # Developer @RknDeveloperr 89 | # Special Thanks To @ReshamOwner 90 | # Update Channel @Digital_Botz & @DigitalBotz_Support 91 | -------------------------------------------------------------------------------- /plugins/prefix_&_suffix.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | # imports 33 | from pyrogram import Client, filters, enums 34 | from helper.database import digital_botz 35 | 36 | # prefix commond ✨ 37 | @Client.on_message(filters.private & filters.command('set_prefix')) 38 | async def add_prefix(client, message): 39 | if len(message.command) == 1: 40 | return await message.reply_text("**__Give The Prefix__\n\nExᴀᴍᴩʟᴇ:- `/set_prefix @Rkn_Bots`**") 41 | prefix = message.text.split(" ", 1)[1] 42 | RknDev = await message.reply_text("Please Wait ...", reply_to_message_id=message.id) 43 | await digital_botz.set_prefix(message.from_user.id, prefix) 44 | await RknDev.edit("__**✅ ᴘʀᴇꜰɪx ꜱᴀᴠᴇᴅ**__") 45 | 46 | @Client.on_message(filters.private & filters.command('del_prefix')) 47 | async def delete_prefix(client, message): 48 | RknDev = await message.reply_text("Please Wait ...", reply_to_message_id=message.id) 49 | prefix = await digital_botz.get_prefix(message.from_user.id) 50 | if not prefix: 51 | return await RknDev.edit("__**😔 ʏᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴀɴʏ ᴘʀᴇꜰɪx**__") 52 | await digital_botz.set_prefix(message.from_user.id, None) 53 | await RknDev.edit("__**❌️ ᴘʀᴇꜰɪx ᴅᴇʟᴇᴛᴇᴅ**__") 54 | 55 | @Client.on_message(filters.private & filters.command('see_prefix')) 56 | async def see_prefix(client, message): 57 | RknDev = await message.reply_text("Please Wait ...", reply_to_message_id=message.id) 58 | prefix = await digital_botz.get_prefix(message.from_user.id) 59 | if prefix: 60 | await RknDev.edit(f"**ʏᴏᴜʀ ᴘʀᴇꜰɪx:-**\n\n`{prefix}`") 61 | else: 62 | await RknDev.edit("__**😔 ʏᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴀɴʏ ᴘʀᴇꜰɪx**__") 63 | 64 | # SUFFIX COMMOND ✨ 65 | @Client.on_message(filters.private & filters.command('set_suffix')) 66 | async def add_suffix(client, message): 67 | if len(message.command) == 1: 68 | return await message.reply_text("**__Give The Suffix__\n\nExᴀᴍᴩʟᴇ:- `/set_suffix @Rkn_Bots`**") 69 | suffix = message.text.split(" ", 1)[1] 70 | RknDev = await message.reply_text("Please Wait ...", reply_to_message_id=message.id) 71 | await digital_botz.set_suffix(message.from_user.id, suffix) 72 | await RknDev.edit("__**✅ ꜱᴜꜰꜰɪx ꜱᴀᴠᴇᴅ**__") 73 | 74 | @Client.on_message(filters.private & filters.command('del_suffix')) 75 | async def delete_suffix(client, message): 76 | RknDev = await message.reply_text("Please Wait ...", reply_to_message_id=message.id) 77 | suffix = await digital_botz.get_suffix(message.from_user.id) 78 | if not suffix: 79 | return await RknDev.edit("__**😔 ʏᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴀɴʏ ꜱᴜꜰꜰɪx**__") 80 | await digital_botz.set_suffix(message.from_user.id, None) 81 | await RknDev.edit("__**❌️ ꜱᴜꜰꜰɪx ᴅᴇʟᴇᴛᴇᴅ**__") 82 | 83 | @Client.on_message(filters.private & filters.command('see_suffix')) 84 | async def see_suffix(client, message): 85 | RknDev = await message.reply_text("Please Wait ...", reply_to_message_id=message.id) 86 | suffix = await digital_botz.get_suffix(message.from_user.id) 87 | if suffix: 88 | await RknDev.edit(f"**ʏᴏᴜʀ ꜱᴜꜰꜰɪx:-**\n\n`{suffix}`") 89 | else: 90 | await RknDev.edit("__**😔 ʏᴏᴜ ᴅᴏɴ'ᴛ ʜᴀᴠᴇ ᴀɴʏ ꜱᴜꜰꜰɪx**__") 91 | 92 | # Rkn Developer 93 | # Don't Remove Credit 😔 94 | # Telegram Channel @RknDeveloper & @Rkn_Botz 95 | # Developer @RknDeveloperr 96 | # Special Thanks To @ReshamOwner 97 | # Update Channel @Digital_Botz & @DigitalBotz_Support 98 | -------------------------------------------------------------------------------- /plugins/start_&_cb.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | # extra imports 33 | import random, asyncio, datetime, pytz, time, psutil, shutil 34 | 35 | # pyrogram imports 36 | from pyrogram import Client, filters 37 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, ForceReply, CallbackQuery 38 | 39 | # bots imports 40 | from helper.database import digital_botz 41 | from config import Config, rkn 42 | from helper.utils import humanbytes 43 | from plugins import __version__ as _bot_version_, __developer__, __database__, __library__, __language__, __programer__ 44 | 45 | upgrade_button = InlineKeyboardMarkup([[ 46 | InlineKeyboardButton('buy premium ✓', user_id=int(6705898491)), 47 | ],[ 48 | InlineKeyboardButton("Bᴀᴄᴋ", callback_data = "start") 49 | ]]) 50 | 51 | upgrade_trial_button = InlineKeyboardMarkup([[ 52 | InlineKeyboardButton('buy premium ✓', user_id=int(6705898491)), 53 | ],[ 54 | InlineKeyboardButton("ᴛʀɪᴀʟ - 𝟷𝟸 ʜᴏᴜʀs ✓", callback_data = "give_trial"), 55 | InlineKeyboardButton("Bᴀᴄᴋ", callback_data = "start") 56 | ]]) 57 | 58 | 59 | 60 | @Client.on_message(filters.private & filters.command("start")) 61 | async def start(client, message): 62 | start_button = [[ 63 | InlineKeyboardButton('Uᴩᴅᴀ𝚃ᴇꜱ', url='https://t.me/Digital_Botz'), 64 | InlineKeyboardButton('Sᴜᴩᴩᴏʀ𝚃', url='https://t.me/DigitalBotz_Support') 65 | ],[ 66 | InlineKeyboardButton('Aʙᴏυᴛ', callback_data='about'), 67 | InlineKeyboardButton('Hᴇʟᴩ', callback_data='help') 68 | ]] 69 | 70 | if client.premium: 71 | start_button.append([InlineKeyboardButton('💸 ᴜᴘɢʀᴀᴅᴇ ᴛᴏ ᴘʀᴇᴍɪᴜᴍ 💸', callback_data='upgrade')]) 72 | 73 | user = message.from_user 74 | await digital_botz.add_user(client, message) 75 | if Config.RKN_PIC: 76 | await message.reply_photo(Config.RKN_PIC, caption=rkn.START_TXT.format(user.mention), reply_markup=InlineKeyboardMarkup(start_button)) 77 | else: 78 | await message.reply_text(text=rkn.START_TXT.format(user.mention), reply_markup=InlineKeyboardMarkup(start_button), disable_web_page_preview=True) 79 | 80 | 81 | @Client.on_message(filters.private & filters.command("myplan")) 82 | async def myplan(client, message): 83 | if not client.premium: 84 | return # premium mode disabled ✓ 85 | 86 | user_id = message.from_user.id 87 | user = message.from_user.mention 88 | 89 | if await digital_botz.has_premium_access(user_id): 90 | data = await digital_botz.get_user(user_id) 91 | expiry_str_in_ist = data.get("expiry_time") 92 | time_left_str = expiry_str_in_ist - datetime.datetime.now() 93 | 94 | text = f"ᴜꜱᴇʀ :- {user}\nᴜꜱᴇʀ ɪᴅ :- {user_id}\n" 95 | 96 | if client.uploadlimit: 97 | await digital_botz.reset_uploadlimit_access(user_id) 98 | user_data = await digital_botz.get_user_data(user_id) 99 | limit = user_data.get('uploadlimit', 0) 100 | used = user_data.get('used_limit', 0) 101 | remain = int(limit) - int(used) 102 | type = user_data.get('usertype', "Free") 103 | 104 | text += f"ᴘʟᴀɴ :- `{type}`\nᴅᴀɪʟʏ ᴜᴘʟᴏᴀᴅ ʟɪᴍɪᴛ :- `{humanbytes(limit)}`\nᴛᴏᴅᴀʏ ᴜsᴇᴅ :- `{humanbytes(used)}`\nʀᴇᴍᴀɪɴ :- `{humanbytes(remain)}`\n" 105 | 106 | text += f"ᴛɪᴍᴇ ʟᴇꜰᴛ : {time_left_str}\nᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}" 107 | 108 | await message.reply_text(text, quote=True) 109 | 110 | else: 111 | if client.uploadlimit: 112 | user_data = await digital_botz.get_user_data(user_id) 113 | limit = user_data.get('uploadlimit', 0) 114 | used = user_data.get('used_limit', 0) 115 | remain = int(limit) - int(used) 116 | type = user_data.get('usertype', "Free") 117 | 118 | text = f"ᴜꜱᴇʀ :- {user}\nᴜꜱᴇʀ ɪᴅ :- {user_id}\nᴘʟᴀɴ :- `{type}`\nᴅᴀɪʟʏ ᴜᴘʟᴏᴀᴅ ʟɪᴍɪᴛ :- `{humanbytes(limit)}`\nᴛᴏᴅᴀʏ ᴜsᴇᴅ :- `{humanbytes(used)}`\nʀᴇᴍᴀɪɴ :- `{humanbytes(remain)}`\nᴇxᴘɪʀᴇᴅ ᴅᴀᴛᴇ :- ʟɪғᴇᴛɪᴍᴇ\n\nɪꜰ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴛᴀᴋᴇ ᴘʀᴇᴍɪᴜᴍ ᴛʜᴇɴ ᴄʟɪᴄᴋ ᴏɴ ʙᴇʟᴏᴡ ʙᴜᴛᴛᴏɴ 👇" 119 | 120 | await message.reply_text(text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("💸 ᴄʜᴇᴄᴋᴏᴜᴛ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴꜱ 💸", callback_data='upgrade')]]), quote=True) 121 | 122 | else: 123 | m=await message.reply_sticker("CAACAgIAAxkBAAIBTGVjQbHuhOiboQsDm35brLGyLQ28AAJ-GgACglXYSXgCrotQHjibHgQ") 124 | await message.reply_text(f"ʜᴇʏ {user},\n\nʏᴏᴜ ᴅᴏ ɴᴏᴛ ʜᴀᴠᴇ ᴀɴʏ ᴀᴄᴛɪᴠᴇ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴs, ɪꜰ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴛᴀᴋᴇ ᴘʀᴇᴍɪᴜᴍ ᴛʜᴇɴ ᴄʟɪᴄᴋ ᴏɴ ʙᴇʟᴏᴡ ʙᴜᴛᴛᴏɴ 👇", 125 | reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("💸 ᴄʜᴇᴄᴋᴏᴜᴛ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴꜱ 💸", callback_data='upgrade')]])) 126 | await asyncio.sleep(2) 127 | await m.delete() 128 | 129 | @Client.on_message(filters.private & filters.command("plans")) 130 | async def plans(client, message): 131 | if not client.premium: 132 | return # premium mode disabled ✓ 133 | 134 | user = message.from_user 135 | upgrade_msg = rkn.UPGRADE_PLAN.format(user.mention) if client.uploadlimit else rkn.UPGRADE_PREMIUM.format(user.mention) 136 | 137 | free_trial_status = await digital_botz.get_free_trial_status(user.id) 138 | if not await digital_botz.has_premium_access(user.id): 139 | if not free_trial_status: 140 | await message.reply_text(text=upgrade_msg, reply_markup=upgrade_trial_button, disable_web_page_preview=True) 141 | else: 142 | await message.reply_text(text=upgrade_msg, reply_markup=upgrade_button, disable_web_page_preview=True) 143 | else: 144 | await message.reply_text(text=upgrade_msg, reply_markup=upgrade_button, disable_web_page_preview=True) 145 | 146 | 147 | @Client.on_callback_query() 148 | async def cb_handler(client, query: CallbackQuery): 149 | data = query.data 150 | if data == "start": 151 | start_button = [[ 152 | InlineKeyboardButton('Uᴩᴅᴀ𝚃ᴇꜱ', url='https://t.me/Digital_Botz'), 153 | InlineKeyboardButton('Sᴜᴩᴩᴏʀ𝚃', url='https://t.me/DigitalBotz_Support') 154 | ],[ 155 | InlineKeyboardButton('Aʙᴏυᴛ', callback_data='about'), 156 | InlineKeyboardButton('Hᴇʟᴩ', callback_data='help') 157 | ]] 158 | 159 | if client.premium: 160 | start_button.append([InlineKeyboardButton('💸 ᴜᴘɢʀᴀᴅᴇ ᴛᴏ ᴘʀᴇᴍɪᴜᴍ 💸', callback_data='upgrade')]) 161 | 162 | await query.message.edit_text( 163 | text=rkn.START_TXT.format(query.from_user.mention), 164 | disable_web_page_preview=True, 165 | reply_markup = InlineKeyboardMarkup(start_button)) 166 | 167 | elif data == "help": 168 | await query.message.edit_text( 169 | text=rkn.HELP_TXT, 170 | disable_web_page_preview=True, 171 | reply_markup=InlineKeyboardMarkup([[ 172 | #⚠️ don't change source code & source link ⚠️ # 173 | InlineKeyboardButton("ᴛʜᴜᴍʙɴᴀɪʟ", callback_data = "thumbnail"), 174 | InlineKeyboardButton("ᴄᴀᴘᴛɪᴏɴ", callback_data = "caption") 175 | ],[ 176 | InlineKeyboardButton("ᴄᴜsᴛᴏᴍ ғɪʟᴇ ɴᴀᴍᴇ", callback_data = "custom_file_name") 177 | ],[ 178 | InlineKeyboardButton("ᴀʙᴏᴜᴛ", callback_data = "about"), 179 | InlineKeyboardButton("ᴍᴇᴛᴀᴅᴀᴛᴀ", callback_data = "digital_meta_data") 180 | ],[ 181 | InlineKeyboardButton("Bᴀᴄᴋ", callback_data = "start") 182 | ]])) 183 | 184 | elif data == "about": 185 | about_button = [[ 186 | #⚠️ don't change source code & source link ⚠️ # 187 | InlineKeyboardButton("𝚂ᴏᴜʀᴄᴇ", callback_data = "source_code"), #Whoever is deploying this repo is given a warning ⚠️ not to remove this repo link #first & last warning ⚠️ 188 | InlineKeyboardButton("ʙᴏᴛ sᴛᴀᴛᴜs", callback_data = "bot_status") 189 | ],[ 190 | InlineKeyboardButton("ʟɪᴠᴇ sᴛᴀᴛᴜs", callback_data = "live_status") 191 | ]] 192 | if client.premium: 193 | about_button[-1].append(InlineKeyboardButton("ᴜᴘɢʀᴀᴅᴇ", callback_data = "upgrade")) 194 | about_button.append([InlineKeyboardButton("Bᴀᴄᴋ", callback_data = "start")]) 195 | else: 196 | about_button[-1].append(InlineKeyboardButton("Bᴀᴄᴋ", callback_data = "start")) 197 | 198 | await query.message.edit_text( 199 | text=rkn.ABOUT_TXT.format(client.mention, __developer__, __programer__, __library__, __language__, __database__, _bot_version_), 200 | disable_web_page_preview = True, 201 | reply_markup=InlineKeyboardMarkup(about_button)) 202 | 203 | elif data == "upgrade": 204 | if not client.premium: 205 | return await query.message.delete() 206 | 207 | user = query.from_user 208 | upgrade_msg = rkn.UPGRADE_PLAN.format(user.mention) if client.uploadlimit else rkn.UPGRADE_PREMIUM.format(user.mention) 209 | 210 | free_trial_status = await digital_botz.get_free_trial_status(query.from_user.id) 211 | if not await digital_botz.has_premium_access(query.from_user.id): 212 | if not free_trial_status: 213 | await query.message.edit_text(text=upgrade_msg, disable_web_page_preview=True, reply_markup=upgrade_trial_button) 214 | else: 215 | await query.message.edit_text(text=upgrade_msg, disable_web_page_preview=True, reply_markup=upgrade_button) 216 | else: 217 | await query.message.edit_text(text=upgrade_msg, disable_web_page_preview=True, reply_markup=upgrade_button) 218 | 219 | elif data == "give_trial": 220 | if not client.premium: 221 | return await query.message.delete() 222 | 223 | await query.message.delete() 224 | free_trial_status = await digital_botz.get_free_trial_status(query.from_user.id) 225 | if not free_trial_status: 226 | await digital_botz.give_free_trail(query.from_user.id) 227 | new_text = "**ʏᴏᴜʀ ᴘʀᴇᴍɪᴜᴍ ᴛʀɪᴀʟ ʜᴀs ʙᴇᴇɴ ᴀᴅᴅᴇᴅ ғᴏʀ 𝟷𝟸 ʜᴏᴜʀs.\n\nʏᴏᴜ ᴄᴀɴ ᴜsᴇ ꜰʀᴇᴇ ᴛʀᴀɪʟ ꜰᴏʀ 𝟷𝟸 ʜᴏᴜʀs ꜰʀᴏᴍ ɴᴏᴡ 😀\n\nआप अब से 𝟷𝟸 घण्टा के लिए निःशुल्क ट्रायल का उपयोग कर सकते हैं 😀**" 228 | else: 229 | new_text = "**🤣 ʏᴏᴜ ᴀʟʀᴇᴀᴅʏ ᴜsᴇᴅ ғʀᴇᴇ ɴᴏᴡ ɴᴏ ᴍᴏʀᴇ ғʀᴇᴇ ᴛʀᴀɪʟ. ᴘʟᴇᴀsᴇ ʙᴜʏ sᴜʙsᴄʀɪᴘᴛɪᴏɴ ʜᴇʀᴇ ᴀʀᴇ ᴏᴜʀ 👉 /plans**" 230 | await client.send_message(query.from_user.id, text=new_text) 231 | 232 | elif data == "thumbnail": 233 | await query.message.edit_text( 234 | text=rkn.THUMBNAIL, 235 | disable_web_page_preview=True, 236 | reply_markup=InlineKeyboardMarkup([[ 237 | InlineKeyboardButton(" Bᴀᴄᴋ", callback_data = "help")]])) 238 | 239 | elif data == "caption": 240 | await query.message.edit_text( 241 | text=rkn.CAPTION, 242 | disable_web_page_preview=True, 243 | reply_markup=InlineKeyboardMarkup([[ 244 | InlineKeyboardButton(" Bᴀᴄᴋ", callback_data = "help")]])) 245 | 246 | elif data == "custom_file_name": 247 | await query.message.edit_text( 248 | text=rkn.CUSTOM_FILE_NAME, 249 | disable_web_page_preview=True, 250 | reply_markup=InlineKeyboardMarkup([[ 251 | InlineKeyboardButton(" Bᴀᴄᴋ", callback_data = "help")]])) 252 | 253 | elif data == "digital_meta_data": 254 | await query.message.edit_text( 255 | text=rkn.DIGITAL_METADATA, 256 | disable_web_page_preview=True, 257 | reply_markup=InlineKeyboardMarkup([[ 258 | InlineKeyboardButton(" Bᴀᴄᴋ", callback_data = "help")]])) 259 | 260 | elif data == "bot_status": 261 | total_users = await digital_botz.total_users_count() 262 | if client.premium: 263 | total_premium_users = await digital_botz.total_premium_users_count() 264 | else: 265 | total_premium_users = "Disabled ✅" 266 | 267 | uptime = time.strftime("%Hh%Mm%Ss", time.gmtime(time.time() - client.uptime)) 268 | sent = humanbytes(psutil.net_io_counters().bytes_sent) 269 | recv = humanbytes(psutil.net_io_counters().bytes_recv) 270 | await query.message.edit_text( 271 | text=rkn.BOT_STATUS.format(uptime, total_users, total_premium_users, sent, recv), 272 | disable_web_page_preview=True, 273 | reply_markup=InlineKeyboardMarkup([[ 274 | InlineKeyboardButton(" Bᴀᴄᴋ", callback_data = "about")]])) 275 | 276 | elif data == "live_status": 277 | currentTime = time.strftime("%Hh%Mm%Ss", time.gmtime(time.time() - client.uptime)) 278 | total, used, free = shutil.disk_usage(".") 279 | total = humanbytes(total) 280 | used = humanbytes(used) 281 | free = humanbytes(free) 282 | sent = humanbytes(psutil.net_io_counters().bytes_sent) 283 | recv = humanbytes(psutil.net_io_counters().bytes_recv) 284 | cpu_usage = psutil.cpu_percent() 285 | ram_usage = psutil.virtual_memory().percent 286 | disk_usage = psutil.disk_usage('/').percent 287 | await query.message.edit_text( 288 | text=rkn.LIVE_STATUS.format(currentTime, cpu_usage, ram_usage, total, used, disk_usage, free, sent, recv), 289 | disable_web_page_preview=True, 290 | reply_markup=InlineKeyboardMarkup([[ 291 | InlineKeyboardButton(" Bᴀᴄᴋ", callback_data = "about")]])) 292 | 293 | elif data == "source_code": 294 | await query.message.edit_text( 295 | text=rkn.DEV_TXT, 296 | disable_web_page_preview=True, 297 | reply_markup=InlineKeyboardMarkup([[ 298 | #⚠️ don't change source code & source link ⚠️ # 299 | #Whoever is deploying this repo is given a warning ⚠️ not to remove this repo link #first & last warning ⚠️ 300 | InlineKeyboardButton("💞 Sᴏᴜʀᴄᴇ Cᴏᴅᴇ 💞", url="https://github.com/DigitalBotz/Digital-Rename-Bot") 301 | ],[ 302 | InlineKeyboardButton("🔒 Cʟᴏꜱᴇ", callback_data = "close"), 303 | InlineKeyboardButton("◀️ Bᴀᴄᴋ", callback_data = "start") 304 | ]]) 305 | ) 306 | elif data == "close": 307 | try: 308 | await query.message.delete() 309 | await query.message.reply_to_message.delete() 310 | await query.message.continue_propagation() 311 | except: 312 | await query.message.delete() 313 | await query.message.continue_propagation() 314 | 315 | # (c) @RknDeveloperr 316 | # Rkn Developer 317 | # Don't Remove Credit 😔 318 | # Telegram Channel @RknDeveloper & @Rkn_Botz 319 | # Developer @RknDeveloperr 320 | # Update Channel @Digital_Botz & @DigitalBotz_Support 321 | -------------------------------------------------------------------------------- /plugins/thumb_&_cap.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | # imports 33 | from pyrogram import Client, filters 34 | from helper.database import digital_botz 35 | 36 | @Client.on_message(filters.private & filters.command('set_caption')) 37 | async def add_caption(client, message): 38 | rkn = await message.reply_text("__**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ**__") 39 | if len(message.command) == 1: 40 | return await rkn.edit("**__Gɪᴠᴇ Tʜᴇ Cᴀᴩᴛɪᴏɴ__\n\nExᴀᴍᴩʟᴇ:- `/set_caption {filename}\n\n💾 Sɪᴢᴇ: {filesize}\n\n⏰ Dᴜʀᴀᴛɪᴏɴ: {duration}`**") 41 | caption = message.text.split(" ", 1)[1] 42 | await digital_botz.set_caption(message.from_user.id, caption=caption) 43 | await rkn.edit("__**✅ Cᴀᴩᴛɪᴏɴ Sᴀᴠᴇᴅ**__") 44 | 45 | @Client.on_message(filters.private & filters.command(['del_caption', 'delete_caption', 'delcaption'])) 46 | async def delete_caption(client, message): 47 | rkn = await message.reply_text("__**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ**__") 48 | caption = await digital_botz.get_caption(message.from_user.id) 49 | if not caption: 50 | return await rkn.edit("__**😔 Yᴏᴜ Dᴏɴ'ᴛ Hᴀᴠᴇ Aɴy Cᴀᴩᴛɪᴏɴ**__") 51 | await digital_botz.set_caption(message.from_user.id, caption=None) 52 | await rkn.edit("__**❌️ Cᴀᴩᴛɪᴏɴ Dᴇʟᴇᴛᴇᴅ**__") 53 | 54 | @Client.on_message(filters.private & filters.command(['see_caption', 'view_caption'])) 55 | async def see_caption(client, message): 56 | rkn = await message.reply_text("__**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ**__") 57 | caption = await digital_botz.get_caption(message.from_user.id) 58 | if caption: 59 | await rkn.edit(f"**Yᴏᴜ'ʀᴇ Cᴀᴩᴛɪᴏɴ:-**\n\n`{caption}`") 60 | else: 61 | await rkn.edit("__**😔 Yᴏᴜ Dᴏɴ'ᴛ Hᴀᴠᴇ Aɴy Cᴀᴩᴛɪᴏɴ**__") 62 | 63 | @Client.on_message(filters.private & filters.command(['view_thumb', 'viewthumb'])) 64 | async def viewthumb(client, message): 65 | rkn = await message.reply_text("__**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ**__") 66 | thumb = await digital_botz.get_thumbnail(message.from_user.id) 67 | if thumb: 68 | await client.send_photo(chat_id=message.chat.id, photo=thumb) 69 | await rkn.delete() 70 | else: 71 | await rkn.edit("😔 __**Yᴏᴜ Dᴏɴ'ᴛ Hᴀᴠᴇ Aɴy Tʜᴜᴍʙɴᴀɪʟ**__") 72 | 73 | @Client.on_message(filters.private & filters.command(['del_thumb', 'delete_thumb', 'delthumb'])) 74 | async def removethumb(client, message): 75 | rkn = await message.reply_text("__**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ**__") 76 | thumb = await digital_botz.get_thumbnail(message.from_user.id) 77 | if thumb: 78 | await digital_botz.set_thumbnail(message.from_user.id, file_id=None) 79 | await rkn.edit("❌️ __**Tʜᴜᴍʙɴᴀɪʟ Dᴇʟᴇᴛᴇᴅ**__") 80 | return 81 | await rkn.edit("😔 __**Yᴏᴜ Dᴏɴ'ᴛ Hᴀᴠᴇ Aɴy Tʜᴜᴍʙɴᴀɪʟ**__") 82 | 83 | 84 | @Client.on_message(filters.private & filters.photo) 85 | async def addthumbs(client, message): 86 | rkn = await message.reply_text("__**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ**__") 87 | await digital_botz.set_thumbnail(message.from_user.id, file_id=message.photo.file_id) 88 | await rkn.edit("✅️ __**Tʜᴜᴍʙɴᴀɪʟ Sᴀᴠᴇᴅ**__") 89 | 90 | # (c) @RknDeveloperr 91 | # Rkn Developer 92 | # Don't Remove Credit 😔 93 | # Telegram Channel @RknDeveloper & @Rkn_Botz 94 | # Developer @RknDeveloperr 95 | # Update Channel @Digital_Botz & @DigitalBotz_Support 96 | -------------------------------------------------------------------------------- /plugins/web_support.py: -------------------------------------------------------------------------------- 1 | # (c) @RknDeveloperr 2 | # Rkn Developer 3 | # Don't Remove Credit 😔 4 | # Telegram Channel @RknDeveloper & @Rkn_Botz 5 | # Developer @RknDeveloperr 6 | # Special Thanks To @ReshamOwner 7 | # Update Channel @Digital_Botz & @DigitalBotz_Support 8 | """ 9 | Apache License 2.0 10 | Copyright (c) 2022 @Digital_Botz 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Telegram Link : https://t.me/Digital_Botz 28 | Repo Link : https://github.com/DigitalBotz/Digital-Rename-Bot 29 | License Link : https://github.com/DigitalBotz/Digital-Rename-Bot/blob/main/LICENSE 30 | """ 31 | 32 | from aiohttp import web 33 | 34 | Rkn_FileRenameBot = web.RouteTableDef() 35 | 36 | @Rkn_FileRenameBot.get("/", allow_head=True) 37 | async def root_route_handler(request): 38 | return web.json_response("RknDeveloper") 39 | 40 | async def web_server(): 41 | web_app = web.Application(client_max_size=30000000) 42 | web_app.add_routes(Rkn_FileRenameBot) 43 | return web_app 44 | 45 | # Rkn Developer 46 | # Don't Remove Credit 😔 47 | # Telegram Channel @RknDeveloper & @Rkn_Botz 48 | # Developer @RknDeveloperr 49 | # Update Channel @Digital_Botz & @DigitalBotz_Support 50 | -------------------------------------------------------------------------------- /render.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | - type: web 3 | plan: free 4 | name: Digital-test 5 | env: python 6 | buildCommand: pip install -r requirements.txt 7 | startCommand: python3 bot.py 8 | repo: https://github.com/DigitalBotz/Digital-test.git 9 | branch: main 10 | autoDeploy: false 11 | envVars: 12 | - key: PYTHON_VERSION 13 | value: 3.11.9 14 | - key: BOT_TOKEN 15 | sync: false 16 | - key: API_ID 17 | sync: false 18 | - key: API_HASH 19 | sync: false 20 | - key: FORCE_SUB 21 | sync: false 22 | - key: LOG_CHANNEL 23 | sync: false 24 | - key: DB_NAME 25 | sync: false 26 | - key: DB_URL 27 | sync: false 28 | - key: RKN_PIC 29 | sync: false 30 | - key: ADMIN 31 | sync: false 32 | - key: STRING_SESSION 33 | sync: false 34 | 35 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram==2.0.93 2 | TgCrypto 3 | motor 4 | dnspython 5 | hachoir 6 | Pillow 7 | aiohttp 8 | pytz 9 | psutil 10 | pyromod 11 | ffmpeg-python 12 | ffmpeg 13 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.12.7 2 | --------------------------------------------------------------------------------