(client, message)
| 32 | |
| 33 | @Client.on_message(filters.command("addpremium") & filters.user(Config.ADMIN)) |
| 34 | async def add_premium(client, message): |
| 35 | if not client.premium: |
| 36 | return await message.reply_text("premium mode disabled ✅") |
| 37 | if client.uploadlimit: |
| 38 | if len(message.command) < 4: |
| 39 | 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) |
| 40 | user_id = int(message.command[1]) |
| 41 | plan_type = message.command[2] |
| 42 | if plan_type not in ["Pro", "UltraPro"]: |
| 43 | return await message.reply_text("Invalid Plan Type. Please use 'Pro' or 'UltraPro'.", quote=True) |
| 44 | time_string = " ".join(message.command[3:]) |
| 45 | time_zone = datetime.datetime.now(pytz.timezone("Asia/Kolkata")) |
| 46 | current_time = time_zone.strftime("%d-%m-%Y\n⏱️ ᴊᴏɪɴɪɴɢ ᴛɪᴍᴇ : %I:%M:%S %p") |
| 47 | user = await client.get_users(user_id) |
| 48 | if plan_type == "Pro": |
| 49 | limit = 107374182400 |
| 50 | type = "Pro" |
| 51 | elif plan_type == "UltraPro": |
| 52 | limit = 1073741824000 |
| 53 | type = "UltraPro" |
| 54 | |
| 55 | seconds = await get_seconds(time_string) |
| 56 | if seconds <= 0: |
| 57 | 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) |
| 58 | expiry_time = datetime.datetime.now() + datetime.timedelta(seconds=seconds) |
| 59 | user_data = {"id": user_id, "expiry_time": expiry_time} |
| 60 | await digital_botz.addpremium(user_id, user_data, limit, type) |
| 61 | user_data = await digital_botz.get_user_data(user_id) |
| 62 | limit = user_data.get('uploadlimit', 0) |
| 63 | type = user_data.get('usertype', "Free") |
| 64 | data = await digital_botz.get_user(user_id) |
| 65 | expiry = data.get("expiry_time") |
| 66 | expiry_str_in_ist = expiry.astimezone(pytz.timezone("Asia/Kolkata")).strftime("%d-%m-%Y\n⏱️ ᴇxᴘɪʀʏ ᴛɪᴍᴇ : %I:%M:%S %p") |
| 67 | await message.reply_text(f"ᴘʀᴇᴍɪᴜᴍ ᴀᴅᴅᴇᴅ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ✅\n\n👤 ᴜꜱᴇʀ : {user.mention}\n⚡ ᴜꜱᴇʀ ɪᴅ : <code>{user_id}</code>\nᴘʟᴀɴ :- `{type}`\nᴅᴀɪʟʏ ᴜᴘʟᴏᴀᴅ ʟɪᴍɪᴛ :- `{humanbytes(limit)}`\n⏰ ᴘʀᴇᴍɪᴜᴍ ᴀᴄᴄᴇꜱꜱ : <code>{time_string}</code>\n\n⏳ ᴊᴏɪɴɪɴɢ ᴅᴀᴛᴇ : {current_time}\n\n⌛️ ᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}", quote=True, disable_web_page_preview=True) |
| 68 | await client.send_message( |
| 69 | chat_id=user_id, |
| 70 | text=f"👋 ʜᴇʏ {user.mention},\nᴛʜᴀɴᴋ ʏᴏᴜ ꜰᴏʀ ᴘᴜʀᴄʜᴀꜱɪɴɢ ᴘʀᴇᴍɪᴜᴍ.\nᴇɴᴊᴏʏ !! ✨🎉\n\n⏰ ᴘʀᴇᴍɪᴜᴍ ᴀᴄᴄᴇꜱꜱ : <code>{time}</code>\nᴘʟᴀɴ :- `{type}`\nᴅᴀɪʟʏ ᴜᴘʟᴏᴀᴅ ʟɪᴍɪᴛ :- `{humanbytes(limit)}`\n⏳ ᴊᴏɪɴɪɴɢ ᴅᴀᴛᴇ : {current_time}\n\n⌛️ ᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}", disable_web_page_preview=True |
| 71 | ) |
| 72 | else: |
| 73 | if len(message.command) < 3: |
| 74 | 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) |
| 75 | user_id = int(message.command[1]) |
| 76 | time_string = " ".join(message.command[2:]) |
| 77 | time_zone = datetime.datetime.now(pytz.timezone("Asia/Kolkata")) |
| 78 | current_time = time_zone.strftime("%d-%m-%Y\n⏱️ ᴊᴏɪɴɪɴɢ ᴛɪᴍᴇ : %I:%M:%S %p") |
| 79 | user = await client.get_users(user_id) |
| 80 | seconds = await get_seconds(time_string) |
| 81 | if seconds <= 0: |
| 82 | 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) |
| 83 | expiry_time = datetime.datetime.now() + datetime.timedelta(seconds=seconds) |
| 84 | user_data = {"id": user_id, "expiry_time": expiry_time} |
| 85 | await digital_botz.addpremium(user_id, user_data) |
| 86 | data = await digital_botz.get_user(user_id) |
| 87 | expiry = data.get("expiry_time") |
| 88 | expiry_str_in_ist = expiry.astimezone(pytz.timezone("Asia/Kolkata")).strftime("%d-%m-%Y\n⏱️ ᴇxᴘɪʀʏ ᴛɪᴍᴇ : %I:%M:%S %p") |
| 89 | await message.reply_text(f"ᴘʀᴇᴍɪᴜᴍ ᴀᴅᴅᴇᴅ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ ✅\n\n👤 ᴜꜱᴇʀ : {user.mention}\n⚡ ᴜꜱᴇʀ ɪᴅ : <code>{user_id}</code>\n⏰ ᴘʀᴇᴍɪᴜᴍ ᴀᴄᴄᴇꜱꜱ : <code>{time_string}</code>\n\n⏳ ᴊᴏɪɴɪɴɢ ᴅᴀᴛᴇ : {current_time}\n\n⌛️ ᴇxᴘɪʀʏ ᴅᴀᴛᴇ : {expiry_str_in_ist}", quote=True, disable_web_page_preview=True) |
| 90 | await client.send_message( |
| 91 | chat_id=user_id, |
nothing calls this directly
no test coverage detected