├── .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 | 
9 |
10 |
13 | 14 |  15 |  16 |  17 |  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 |{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 |
--------------------------------------------------------------------------------