Skip to content

Commit 68c0bf6

Browse files
Update in.py
1 parent dfc87de commit 68c0bf6

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

utils/in.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import shutil
3+
34
from pyrogram import Client, filters
45
from pyrogram.types import Message
56

@@ -10,31 +11,28 @@
1011
async def in_f(client: Client, message: Message):
1112
if message.reply_to_message.document:
1213
module = await client.download_media(message.reply_to_message)
14+
module_name = os.path.basename(module)
1315
if os.path.exists(module):
14-
shutil.copyfile(module, f"modules/custom_modules/{module}")
15-
await message.edit(f"<b>Module {module} downloaded succesfully restartin UB!</b>")
16-
restart()
17-
else:
18-
await message.edit(
19-
f"<b>Usage: </b><code>{prefix}dlf [reply to a file]</code>"
20-
)
16+
shutil.move(module, f"modules/custom_modules/{module_name}")
17+
await message.edit(f"<b>Module {module_name} downloaded successfully, restarting UB!</b>")
18+
restart()
19+
else:
20+
await message.edit(f"<b>Usage: </b><code>{prefix}dlf [reply to a file]</code>")
2121

2222
@Client.on_message(filters.command("un", prefix) & filters.me)
2323
async def un_f(client: Client, message: Message):
2424
if message.reply_to_message.document:
2525
module = message.reply_to_message.document.file_name
2626
if os.path.exists(f"modules/custom_modules/{module}"):
2727
os.remove(f"modules/custom_modules/{module}")
28-
await message.edit(f"<b>Module {module} removed succesfully restarting UB!</b>")
28+
await message.edit(f"<b>Module {module} removed successfully, restarting UB!</b>")
2929
restart()
3030
else:
3131
await message.edit(f"<b>Module {module} not found!</b>")
3232
else:
33-
await message.edit(
34-
f"<b>Usage: </b><code>{prefix}ulf [reply to a module name]</code>"
35-
)
33+
await message.edit(f"<b>Usage: </b><code>{prefix}un [reply to a module name]</code>")
3634

37-
modules_help = {
35+
modules_help["in"] = {
3836
"in [reply*]": "Download a module from telegram",
3937
"un [reply*]": "Remove a module from telegram"
4038
}

0 commit comments

Comments
 (0)