Spaces:
Paused
Paused
Jishu Developer
commited on
Update start.py
Browse files- plugins/start.py +34 -29
plugins/start.py
CHANGED
|
@@ -14,14 +14,14 @@ from pyrogram.enums import ParseMode
|
|
| 14 |
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
|
| 15 |
from pyrogram.errors import FloodWait, UserIsBlocked, InputUserDeactivated
|
| 16 |
from bot import Bot
|
| 17 |
-
from config import ADMINS, FORCE_MSG, START_MSG, CUSTOM_CAPTION, DISABLE_CHANNEL_BUTTON, PROTECT_CONTENT
|
| 18 |
from helper_func import subscribed, encode, decode, get_messages
|
| 19 |
from database.database import add_user, del_user, full_userbase, present_user
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
# add time im seconds for waitingwaiting before delete
|
| 23 |
-
# 1 minutes = 60, 2 minutes = 60×2=120, 5 minutes = 60×5=300
|
| 24 |
-
SECONDS = int(os.getenv("SECONDS", "600"))
|
| 25 |
|
| 26 |
|
| 27 |
|
|
@@ -63,15 +63,16 @@ async def start_command(client: Client, message: Message):
|
|
| 63 |
ids = [int(int(argument[1]) / abs(client.db_channel.id))]
|
| 64 |
except:
|
| 65 |
return
|
| 66 |
-
temp_msg = await message.reply("Please
|
| 67 |
try:
|
| 68 |
messages = await get_messages(client, ids)
|
| 69 |
except:
|
| 70 |
-
await message.reply_text("Something
|
| 71 |
return
|
| 72 |
await temp_msg.delete()
|
| 73 |
|
| 74 |
-
|
|
|
|
| 75 |
for msg in messages:
|
| 76 |
|
| 77 |
if bool(CUSTOM_CAPTION) & bool(msg.document):
|
|
@@ -85,20 +86,29 @@ async def start_command(client: Client, message: Message):
|
|
| 85 |
reply_markup = None
|
| 86 |
|
| 87 |
try:
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
| 90 |
except FloodWait as e:
|
| 91 |
await asyncio.sleep(e.x)
|
| 92 |
-
|
| 93 |
-
|
|
|
|
| 94 |
except:
|
| 95 |
pass
|
| 96 |
-
k = await client.send_message(chat_id = message.from_user.id, text=f"<b>❗️ <u>IMPORTANT</u> ❗️</b>\n\nThis video / file will be deleted in 10 minutes (Due to copyright issues).\n\n📌 Please forward this video / file to somewhere else and start downloading there.")
|
| 97 |
-
await asyncio.sleep(SECONDS)
|
| 98 |
-
await f.delete()
|
| 99 |
-
await k.edit_text("Your video / file is successfully deleted !")
|
| 100 |
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
return
|
| 103 |
else:
|
| 104 |
reply_markup = InlineKeyboardMarkup(
|
|
@@ -124,13 +134,8 @@ async def start_command(client: Client, message: Message):
|
|
| 124 |
return
|
| 125 |
|
| 126 |
|
| 127 |
-
#=====================================================================================##
|
| 128 |
-
|
| 129 |
-
WAIT_MSG = """"<b>Processing ...</b>"""
|
| 130 |
|
| 131 |
-
REPLY_ERROR = """<code>Use this command as a replay to any telegram message with out any spaces.</code>"""
|
| 132 |
|
| 133 |
-
#=====================================================================================##
|
| 134 |
|
| 135 |
|
| 136 |
|
|
@@ -170,9 +175,9 @@ async def not_joined(client: Client, message: Message):
|
|
| 170 |
|
| 171 |
@Bot.on_message(filters.command('users') & filters.private & filters.user(ADMINS))
|
| 172 |
async def get_users(client: Bot, message: Message):
|
| 173 |
-
msg = await client.send_message(chat_id=message.chat.id, text=
|
| 174 |
users = await full_userbase()
|
| 175 |
-
await msg.edit(f"{len(users)}
|
| 176 |
|
| 177 |
|
| 178 |
|
|
@@ -207,18 +212,18 @@ async def send_text(client: Bot, message: Message):
|
|
| 207 |
pass
|
| 208 |
total += 1
|
| 209 |
|
| 210 |
-
status = f"""<b><u>Broadcast Completed</u>
|
| 211 |
|
| 212 |
-
Total Users
|
| 213 |
-
Successful
|
| 214 |
-
Blocked Users
|
| 215 |
-
Deleted Accounts
|
| 216 |
-
Unsuccessful
|
| 217 |
|
| 218 |
return await pls_wait.edit(status)
|
| 219 |
|
| 220 |
else:
|
| 221 |
-
msg = await message.reply(
|
| 222 |
await asyncio.sleep(8)
|
| 223 |
await msg.delete()
|
| 224 |
|
|
|
|
| 14 |
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
|
| 15 |
from pyrogram.errors import FloodWait, UserIsBlocked, InputUserDeactivated
|
| 16 |
from bot import Bot
|
| 17 |
+
from config import ADMINS, FORCE_MSG, START_MSG, CUSTOM_CAPTION, DISABLE_CHANNEL_BUTTON, PROTECT_CONTENT, FILE_AUTO_DELETE
|
| 18 |
from helper_func import subscribed, encode, decode, get_messages
|
| 19 |
from database.database import add_user, del_user, full_userbase, present_user
|
| 20 |
|
| 21 |
+
madflixofficials = FILE_AUTO_DELETE
|
| 22 |
+
jishudeveloper = madflixofficials
|
| 23 |
+
file_auto_delete = humanize.naturaldelta(jishudeveloper)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
|
|
|
|
| 63 |
ids = [int(int(argument[1]) / abs(client.db_channel.id))]
|
| 64 |
except:
|
| 65 |
return
|
| 66 |
+
temp_msg = await message.reply("Please Wait...")
|
| 67 |
try:
|
| 68 |
messages = await get_messages(client, ids)
|
| 69 |
except:
|
| 70 |
+
await message.reply_text("Something Went Wrong..!")
|
| 71 |
return
|
| 72 |
await temp_msg.delete()
|
| 73 |
|
| 74 |
+
madflix_msgs = []
|
| 75 |
+
|
| 76 |
for msg in messages:
|
| 77 |
|
| 78 |
if bool(CUSTOM_CAPTION) & bool(msg.document):
|
|
|
|
| 86 |
reply_markup = None
|
| 87 |
|
| 88 |
try:
|
| 89 |
+
madflix_msg = await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = ParseMode.HTML, reply_markup = reply_markup, protect_content=PROTECT_CONTENT)
|
| 90 |
+
# await asyncio.sleep(0.5)
|
| 91 |
+
madflix_msgs.append(madflix_msg)
|
| 92 |
+
|
| 93 |
except FloodWait as e:
|
| 94 |
await asyncio.sleep(e.x)
|
| 95 |
+
madflix_msg = await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = ParseMode.HTML, reply_markup = reply_markup, protect_content=PROTECT_CONTENT)
|
| 96 |
+
madflix_msgs.append(madflix_msg)
|
| 97 |
+
|
| 98 |
except:
|
| 99 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
|
| 102 |
+
k = await client.send_message(chat_id = message.from_user.id, text=f"<b>❗️ <u>IMPORTANT</u> ❗️</b>\n\nThis Video / File Will Be Deleted In {file_auto_delete} (Due To Copyright Issues).\n\n📌 Please Forward This Video / File To Somewhere Else And Start Downloading There.")
|
| 103 |
+
await asyncio.sleep(FILE_AUTO_DELETE)
|
| 104 |
+
|
| 105 |
+
for madflix_msg in madflix_msgs:
|
| 106 |
+
try:
|
| 107 |
+
await madflix_msg.delete()
|
| 108 |
+
await k.edit_text("Your Video / File Is Successfully Deleted ✅")
|
| 109 |
+
except:
|
| 110 |
+
pass
|
| 111 |
+
|
| 112 |
return
|
| 113 |
else:
|
| 114 |
reply_markup = InlineKeyboardMarkup(
|
|
|
|
| 134 |
return
|
| 135 |
|
| 136 |
|
|
|
|
|
|
|
|
|
|
| 137 |
|
|
|
|
| 138 |
|
|
|
|
| 139 |
|
| 140 |
|
| 141 |
|
|
|
|
| 175 |
|
| 176 |
@Bot.on_message(filters.command('users') & filters.private & filters.user(ADMINS))
|
| 177 |
async def get_users(client: Bot, message: Message):
|
| 178 |
+
msg = await client.send_message(chat_id=message.chat.id, text=f"Processing...")
|
| 179 |
users = await full_userbase()
|
| 180 |
+
await msg.edit(f"{len(users)} Users Are Using This Bot")
|
| 181 |
|
| 182 |
|
| 183 |
|
|
|
|
| 212 |
pass
|
| 213 |
total += 1
|
| 214 |
|
| 215 |
+
status = f"""<b><u>Broadcast Completed</u></b>
|
| 216 |
|
| 217 |
+
<b>Total Users :</b> <code>{total}</code>
|
| 218 |
+
<b>Successful :</b> <code>{successful}</code>
|
| 219 |
+
<b>Blocked Users :</b> <code>{blocked}</code>
|
| 220 |
+
<b>Deleted Accounts :</b> <code>{deleted}</code>
|
| 221 |
+
<b>Unsuccessful :</b> <code>{unsuccessful}</code>"""
|
| 222 |
|
| 223 |
return await pls_wait.edit(status)
|
| 224 |
|
| 225 |
else:
|
| 226 |
+
msg = await message.reply(f"Use This Command As A Reply To Any Telegram Message With Out Any Spaces.")
|
| 227 |
await asyncio.sleep(8)
|
| 228 |
await msg.delete()
|
| 229 |
|