mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
fix
This commit is contained in:
parent
30ca295d8f
commit
4d2432e344
7 changed files with 28 additions and 136 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import asyncio
|
||||
from logging import getLogger
|
||||
|
||||
from pyrogram.errors import ChatWriteForbidden, FloodWait, MessageNotModified
|
||||
from pyrogram.errors import ChatWriteForbidden, FloodWait, MessageNotModified, ChatAdminRequired, MessageIdInvalid
|
||||
|
||||
LOGGER = getLogger(__name__)
|
||||
|
||||
|
|
@ -9,26 +9,29 @@ LOGGER = getLogger(__name__)
|
|||
|
||||
|
||||
# Send MSG Pyro
|
||||
async def kirimPesan(msg, text: str, quote=True, disable_web_page_preview=True, reply_markup=None):
|
||||
async def kirimPesan(msg, text, **kwargs):
|
||||
try:
|
||||
return await msg.reply(text=text, quote=quote, disable_web_page_preview=disable_web_page_preview, reply_markup=reply_markup)
|
||||
return await msg.reply(text, **kwargs)
|
||||
except FloodWait as e:
|
||||
LOGGER.warning(str(e))
|
||||
await asyncio.sleep(e.value)
|
||||
return await kirimPesan(msg, text=text, quote=quote, disable_web_page_preview=disable_web_page_preview, reply_markup=reply_markup)
|
||||
return await kirimPesan(msg, text, **kwargs)
|
||||
except (ChatWriteForbidden, ChatAdminRequired):
|
||||
LOGGER.info(f"Leaving from {msg.chat.title} [{msg.chat.id}] because doesn't have admin permission.")
|
||||
return await msg.leave()
|
||||
except Exception as e:
|
||||
LOGGER.error(str(e))
|
||||
return
|
||||
|
||||
# Edit MSG Pyro
|
||||
async def editPesan(msg, text: str, disable_web_page_preview=True, reply_markup=None):
|
||||
async def editPesan(msg, text, **kwargs):
|
||||
try:
|
||||
return await msg.edit(text=text, disable_web_page_preview=disable_web_page_preview, reply_markup=reply_markup)
|
||||
return await msg.edit(text, **kwargs)
|
||||
except FloodWait as e:
|
||||
LOGGER.warning(str(e))
|
||||
await asyncio.sleep(e.value)
|
||||
return await editPesan(msg, text=text, disable_web_page_preview=disable_web_page_preview, reply_markup=reply_markup)
|
||||
except MessageNotModified:
|
||||
return await editPesan(msg, text, **kwargs)
|
||||
except (MessageNotModified, MessageIdInvalid):
|
||||
return
|
||||
except Exception as e:
|
||||
LOGGER.error(str(e))
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ from misskaty.core.decorator.permissions import (
|
|||
member_permissions,
|
||||
)
|
||||
from misskaty.core.keyboard import ikb
|
||||
from misskaty.core.message_utils import kirimPesan
|
||||
from misskaty.helper.functions import (
|
||||
extract_user,
|
||||
extract_user_and_reason,
|
||||
|
|
@ -495,31 +496,6 @@ async def unmute(_, message):
|
|||
await message.reply_text(f"Unmuted! {umention}")
|
||||
|
||||
|
||||
# Ban deleted accounts
|
||||
@app.on_message(filters.command("ban_ghosts", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def ban_deleted_accounts(_, message):
|
||||
if not message.from_user: return
|
||||
chat_id = message.chat.id
|
||||
deleted_users = []
|
||||
m = await message.reply("Finding ghosts...")
|
||||
|
||||
async for i in app.iter_chat_members(chat_id):
|
||||
if i.user.is_deleted:
|
||||
deleted_users.append(i.user.id)
|
||||
if deleted_users:
|
||||
banned_users = 0
|
||||
for deleted_user in deleted_users:
|
||||
try:
|
||||
await message.chat.ban_member(deleted_user)
|
||||
except Exception:
|
||||
pass
|
||||
banned_users += 1
|
||||
await m.edit(f"Banned {banned_users} Deleted Accounts")
|
||||
else:
|
||||
await m.edit("There are no deleted accounts in this chat")
|
||||
|
||||
|
||||
@app.on_message(filters.command(["warn", "dwarn"], COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def warn_user(client, message):
|
||||
|
|
@ -663,7 +639,6 @@ async def check_warns(_, message):
|
|||
@app.on_message((filters.command("report", COMMAND_HANDLER) | filters.command(["admins", "admin"], prefixes="@")) & filters.group)
|
||||
@capture_err
|
||||
async def report_user(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.reply_to_message:
|
||||
return await message.reply_text("Reply to a message to report that user.")
|
||||
reply = message.reply_to_message
|
||||
|
|
@ -677,7 +652,6 @@ async def report_user(_, message):
|
|||
if linked_chat is None:
|
||||
if reply_id in list_of_admins or reply_id == message.chat.id:
|
||||
return await message.reply_text("Do you know that the user you are replying is an admin ?")
|
||||
|
||||
elif reply_id in list_of_admins or reply_id == message.chat.id or reply_id == linked_chat.id:
|
||||
return await message.reply_text("Do you know that the user you are replying is an admin ?")
|
||||
user_mention = reply.from_user.mention if reply.from_user else reply.sender_chat.title
|
||||
|
|
@ -687,5 +661,5 @@ async def report_user(_, message):
|
|||
if admin.user.is_bot or admin.user.is_deleted:
|
||||
# return bots or deleted admins
|
||||
continue
|
||||
text += f"[\u2063](tg://user?id={admin.user.id})"
|
||||
await message.reply_to_message.reply_text(text)
|
||||
text += f"<a href='tg://user?id={admin.user.id}>\u2063</a>"
|
||||
await kirimPesan(message.reply_to_message, text)
|
||||
|
|
|
|||
|
|
@ -115,8 +115,7 @@ async def genss_link(client, m):
|
|||
await m.reply_media_group(images, reply_to_message_id=m.id)
|
||||
await kirimPesan(
|
||||
m,
|
||||
f"☑️ Uploaded [8] screenshoot.\n\nGenerated by @{BOT_USERNAME}.",
|
||||
reply_to_message_id=m.id,
|
||||
f"☑️ Uploaded [8] screenshoot.\n\nGenerated by @{BOT_USERNAME}."
|
||||
)
|
||||
await process.delete()
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from pyrogram.errors.exceptions.bad_request_400 import (
|
|||
from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden
|
||||
|
||||
from misskaty import app
|
||||
from misskaty.core.message_utils import kirimPesan
|
||||
from misskaty.core.message_utils import editPesan, kirimPesan
|
||||
from misskaty.vars import COMMAND_HANDLER
|
||||
|
||||
__MODULE__ = "Inkick"
|
||||
|
|
@ -94,7 +94,7 @@ async def uname(_, message):
|
|||
await sent_message.delete()
|
||||
|
||||
|
||||
@app.on_message(filters.incoming & ~filters.private & filters.command(["dkick"], COMMAND_HANDLER))
|
||||
@app.on_message(filters.incoming & ~filters.private & filters.command(["ban_ghosts"], COMMAND_HANDLER))
|
||||
async def dkick(client, message):
|
||||
if message.sender_chat:
|
||||
return await message.reply("This feature not available for channel.")
|
||||
|
|
@ -118,6 +118,8 @@ async def dkick(client, message):
|
|||
break
|
||||
except FloodWait as e:
|
||||
await sleep(e.value)
|
||||
if count == 0:
|
||||
return await editPesan(sent_message, "There are no deleted accounts in this chat.")
|
||||
try:
|
||||
await sent_message.edit(f"✔️ **Berhasil menendang {count} akun terhapus.**")
|
||||
except ChatWriteForbidden:
|
||||
|
|
@ -178,7 +180,7 @@ async def instatus(client, message):
|
|||
end_time = time.perf_counter()
|
||||
timelog = "{:.2f}".format(end_time - start_time)
|
||||
await sent_message.edit(
|
||||
"<b>💠 {}\n👥 {} Anggota\n——————\n👁🗨 Informasi Status Anggota\n——————\n</b>🕒 <code>recently</code>: {}\n🕒 <code>last_week</code>: {}\n🕒 <code>last_month</code>: {}\n🕒 <code>long_ago</code>: {}\n🉑 Tanpa Username: {}\n🤐 Dibatasi: {}\n🚫 Diblokir: {}\n👻 Deleted Account (<code>/dkick</code>): {}\n🤖 Bot: {}\n⭐️ Premium User: {}\n👽 UnCached: {}\n\n⏱ Waktu eksekusi {} detik.".format(
|
||||
"<b>💠 {}\n👥 {} Anggota\n——————\n👁🗨 Informasi Status Anggota\n——————\n</b>🕒 <code>recently</code>: {}\n🕒 <code>last_week</code>: {}\n🕒 <code>last_month</code>: {}\n🕒 <code>long_ago</code>: {}\n🉑 Tanpa Username: {}\n🤐 Dibatasi: {}\n🚫 Diblokir: {}\n👻 Deleted Account (<code>/ban_ghosts</code>): {}\n🤖 Bot: {}\n⭐️ Premium User: {}\n👽 UnCached: {}\n\n⏱ Waktu eksekusi {} detik.".format(
|
||||
message.chat.title,
|
||||
count,
|
||||
recently,
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ async def inline_menu(_, inline_query: InlineQuery):
|
|||
InlineButton("Open Docs", url=link),
|
||||
InlineButton("Search Again", switch_inline_query_current_chat=inline_query.query),
|
||||
)
|
||||
buttons.row(
|
||||
InlineButton("Give Coffee", url="https://yasirpedia.eu.org"),
|
||||
)
|
||||
returns = "".join(f"{i}, " for i in parsemethod[method]["returns"])
|
||||
msg = f"<b>{method}</b> (<code>{returns[:-2]}</code>)\n"
|
||||
msg += f"{description}\n\n"
|
||||
|
|
@ -143,9 +146,12 @@ async def inline_menu(_, inline_query: InlineQuery):
|
|||
description = parsetypes[types]["description"][0]
|
||||
buttons = InlineKeyboard()
|
||||
buttons.row(
|
||||
InlineButton("Open Docs", url=link),
|
||||
InlineButton("Open Docs", url=link),
|
||||
InlineButton("Search Again", switch_inline_query_current_chat=inline_query.query),
|
||||
)
|
||||
buttons.row(
|
||||
InlineButton("Give Coffee", url="https://yasirpedia.eu.org"),
|
||||
)
|
||||
msg = f"<b>{types}</b>\n"
|
||||
msg += f"{description}\n\n"
|
||||
msg += f"<b>Variables:</b>\n"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from misskaty.vars import API_HASH, API_ID, COMMAND_HANDLER
|
|||
|
||||
LOGGER = getLogger(__name__)
|
||||
|
||||
__MODULE__ = "Session Generator"
|
||||
__MODULE__ = "SessionGen"
|
||||
__HELP__ = """
|
||||
/genstring - Generate string session using this bot. Only support Pyrogram v2 and Telethon.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ __HELP__ = """
|
|||
/terbit21 [query <optional>] - Scrape website data from Terbit21.
|
||||
/savefilm21 [query <optional>] - Scrape website data from Savefilm21.
|
||||
/movieku [query <optional>] - Scrape website data from Movieku.cc
|
||||
/nodrakor [query <optional>] - Scrape website data from nodrakor.icu
|
||||
/kusonime [query <optional>] - Scrape website data from Kusonime
|
||||
/lendrive [query <optional>] - Scrape website data from Lendrive
|
||||
/gomov [query <optional>] - Scrape website data from GoMov.
|
||||
|
|
@ -126,42 +125,6 @@ async def getDataPahe(msg, kueri, CurrentPage):
|
|||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, None
|
||||
|
||||
# Nodrakor GetData
|
||||
async def getDataNodrakor(msg, kueri, CurrentPage):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
nodrakor = await http.get(f'http://173.212.199.27/?s={kueri}', headers=headers)
|
||||
text = BeautifulSoup(nodrakor.text, "lxml")
|
||||
entry = text.find_all(class_="entry-header")
|
||||
if "Nothing Found" in entry[0].text:
|
||||
if not kueri:
|
||||
await editPesan(msg, "Sorry, could not find any result.")
|
||||
return None, None
|
||||
else:
|
||||
await editPesan(msg, f"Sorry, could not find any result for: {kueri}")
|
||||
return None, None
|
||||
data = []
|
||||
for i in entry:
|
||||
genre = i.find(class_="gmr-movie-on").text
|
||||
genre = f"{genre}" if genre != "" else "N/A"
|
||||
judul = i.find(class_="entry-title").find("a").text
|
||||
link = i.find(class_="entry-title").find("a").get("href")
|
||||
data.append({"judul": judul, "link": link, "genre": genre})
|
||||
SCRAP_DICT[msg.id] = [split_arr(data, 6), kueri]
|
||||
try:
|
||||
index = int(CurrentPage - 1)
|
||||
PageLen = len(SCRAP_DICT[msg.id][0])
|
||||
|
||||
NodrakorResult = f"<b>#Nodrakor Results For:</b> <code>{kueri}</code>\n\n" if kueri else f"<b>#Nodrakor Latest:</b>\n🌀 Use /nodrakor [title] to start search with title.\n\n"
|
||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
NodrakorResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Genre:</b> <code>{i['genre']}</code>\n"
|
||||
NodrakorResult += f"<b>Extract:</b> <code>/nodrakor_scrap {i['link']}</code>\n\n" if "/tv/" not in i["link"] else "\n"
|
||||
IGNORE_CHAR = "[]"
|
||||
NodrakorResult = ''.join(i for i in NodrakorResult if not i in IGNORE_CHAR)
|
||||
return NodrakorResult, PageLen
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, None
|
||||
|
||||
# Kusonime GetData
|
||||
async def getDataKuso(msg, kueri, CurrentPage, user):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
|
|
@ -492,23 +455,6 @@ async def savefilm_s(client, message):
|
|||
)
|
||||
await editPesan(pesan, savefilmres, reply_markup=keyboard)
|
||||
|
||||
# Nodrakor CMD
|
||||
@app.on_message(filters.command(['nodrakor'], COMMAND_HANDLER))
|
||||
async def nodrakor_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Nodrakor..", quote=True)
|
||||
CurrentPage = 1
|
||||
nodrakorres, PageLen = await getDataNodrakor(pesan, kueri, CurrentPage)
|
||||
if not nodrakorres: return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_nodrakor#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
await editPesan(pesan, nodrakorres, reply_markup=keyboard)
|
||||
|
||||
# Kusonime CMD
|
||||
@app.on_message(filters.command(['kusonime'], COMMAND_HANDLER))
|
||||
async def kusonime_s(client, message):
|
||||
|
|
@ -620,30 +566,6 @@ async def kusopage_callback(client, callback_query):
|
|||
)
|
||||
await editPesan(callback_query.message, kusores, reply_markup=keyboard)
|
||||
|
||||
# Nodrakor Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_nodrakor#' in query.data))
|
||||
async def nodraakorpage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
return await callback_query.answer("Not yours..", True)
|
||||
message_id = int(callback_query.data.split('#')[2])
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
return await callback_query.answer("Invalid callback data, please send CMD again..")
|
||||
|
||||
try:
|
||||
modrakorres, PageLen = await getDataNodrakor(callback_query.message, kueri, CurrentPage)
|
||||
except TypeError:
|
||||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_nodrakor#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
await editPesan(callback_query.message, modrakorres, reply_markup=keyboard)
|
||||
|
||||
# Lendrive Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_lendrive#' in query.data))
|
||||
async def moviekupage_callback(client, callback_query):
|
||||
|
|
@ -882,20 +804,6 @@ async def savefilm21_scrap(_, callback_query):
|
|||
return
|
||||
await editPesan(callback_query.message, f"<b>Scrape result from</b> <code>{link}</code>:\n\n{res}", reply_markup=keyboard)
|
||||
|
||||
# Scrape DDL Link Nodrakor
|
||||
@app.on_message(filters.command(["nodrakor_scrap"], COMMAND_HANDLER))
|
||||
async def nodrakor_scrap(_, message):
|
||||
try:
|
||||
link = message.text.split(" ", maxsplit=1)[1]
|
||||
html = await http.get(link, headers=headers)
|
||||
soup = BeautifulSoup(html.text, "lxml")
|
||||
hasil = soup.find_all(class_="gmr-download-wrap clearfix")[0]
|
||||
await message.reply(f"<b>Hasil Scrap dari {link}</b>:\n{hasil}")
|
||||
except IndexError:
|
||||
return await message.reply(f"Gunakan command /{message.command[0]} <b>[link]</b> untuk scrap link download")
|
||||
except Exception as e:
|
||||
await message.reply(f"ERROR: {str(e)}")
|
||||
|
||||
|
||||
# Scrape Link Download Movieku.CC
|
||||
@app.on_message(filters.command(["movieku_scrap"], COMMAND_HANDLER))
|
||||
|
|
|
|||
Loading…
Reference in a new issue