mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Sourcery refactored master branch (#18)
* 'Refactored by Sourcery' * reformating: code --------- Co-authored-by: Sourcery AI <> Co-authored-by: yasirarism <yasiramunandar@gmail.com>
This commit is contained in:
parent
b6548f3cd3
commit
376755e7b3
30 changed files with 497 additions and 604 deletions
|
|
@ -2,25 +2,31 @@ from database import dbname
|
|||
|
||||
matadb = dbname.sangmata
|
||||
|
||||
|
||||
# Get Data User
|
||||
async def cek_userdata(user_id: int) -> bool:
|
||||
user = await matadb.find_one({"user_id": user_id})
|
||||
return bool(user)
|
||||
|
||||
|
||||
async def get_userdata(user_id: int) -> bool:
|
||||
user = await matadb.find_one({"user_id": user_id})
|
||||
return user["username"], user["first_name"], user["last_name"]
|
||||
|
||||
|
||||
async def add_userdata(user_id: int, username, first_name, last_name):
|
||||
await matadb.update_one({"user_id": user_id}, {"$set": {"username": username, "first_name": first_name, "last_name": last_name}}, upsert=True)
|
||||
|
||||
|
||||
# Enable Mata MissKaty in Selected Chat
|
||||
async def is_sangmata_on(chat_id: int) -> bool:
|
||||
chat = await matadb.find_one({"chat_id_toggle": chat_id})
|
||||
return bool(chat)
|
||||
|
||||
|
||||
async def sangmata_on(chat_id: int) -> bool:
|
||||
await matadb.insert_one({"chat_id_toggle": chat_id})
|
||||
|
||||
|
||||
async def sangmata_off(chat_id: int):
|
||||
await matadb.delete_one({"chat_id_toggle": chat_id})
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
from pyrogram import filters
|
||||
from misskaty.core.message_utils import *
|
||||
import asyncio, time
|
||||
import asyncio
|
||||
|
||||
data = {}
|
||||
|
||||
|
||||
async def task(msg, warn=False, sec=None):
|
||||
try:await msg.delete()
|
||||
except:pass
|
||||
try:
|
||||
await msg.delete()
|
||||
except:
|
||||
pass
|
||||
if warn:
|
||||
user = msg.from_user
|
||||
ids = await kirimPesan(msg, f"Sorry {user.mention} [<code>{user.id}</code>], you must wait for {sec}s before using command again..")
|
||||
|
|
@ -15,22 +18,24 @@ async def task(msg, warn = False, sec = None):
|
|||
await asyncio.sleep(2)
|
||||
await hapusPesan(ids)
|
||||
|
||||
|
||||
def wait(sec):
|
||||
async def ___(flt, cli, msg):
|
||||
user_id = msg.from_user.id
|
||||
if user_id in data:
|
||||
if msg.date.timestamp() >= data[user_id]['timestamp'] + flt.data:
|
||||
data[user_id] = {'timestamp' : msg.date.timestamp(), 'warned' : False}
|
||||
if msg.date.timestamp() >= data[user_id]["timestamp"] + flt.data:
|
||||
data[user_id] = {"timestamp": msg.date.timestamp(), "warned": False}
|
||||
return True
|
||||
else:
|
||||
if not data[user_id]['warned']:
|
||||
data[user_id]['warned'] = True
|
||||
if not data[user_id]["warned"]:
|
||||
data[user_id]["warned"] = True
|
||||
asyncio.ensure_future(task(msg, True, flt.data)) # for super accuracy use (future - time.time())
|
||||
return False # cause we dont need delete again
|
||||
|
||||
asyncio.ensure_future(task(msg))
|
||||
return False
|
||||
else:
|
||||
data.update({user_id : {'timestamp' : msg.date.timestamp(), 'warned' : False}})
|
||||
data.update({user_id: {"timestamp": msg.date.timestamp(), "warned": False}})
|
||||
return True
|
||||
|
||||
return filters.create(___, data=sec)
|
||||
|
|
@ -23,6 +23,7 @@ async def kirimPesan(msg, text, **kwargs):
|
|||
LOGGER.error(str(e))
|
||||
return
|
||||
|
||||
|
||||
# Edit MSG Pyro
|
||||
async def editPesan(msg, text, **kwargs):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import chevron
|
||||
import telegraph
|
||||
|
|
@ -12,9 +10,9 @@ from bs4 import BeautifulSoup as bs4
|
|||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
telegraph = telegraph.Telegraph()
|
||||
if telegraph.get_access_token() == None:
|
||||
if telegraph.get_access_token() is None:
|
||||
token_ph = telegraph.create_account(short_name=BOT_USERNAME)
|
||||
LOGGER.info(f"kuso_utils: Create TGH Account ..")
|
||||
LOGGER.info("kuso_utils: Create TGH Account ..")
|
||||
|
||||
headers = {"Accept": "*/*", "User-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"}
|
||||
|
||||
|
|
@ -34,15 +32,14 @@ async def kusonimeBypass(url: str, slug=None):
|
|||
data = []
|
||||
# title = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > p:nth-child(3) > strong")[0].text.strip()
|
||||
title = soup.find("h1", {"class": "jdlz"}).text # fix title njing haha
|
||||
num = 1
|
||||
genre = []
|
||||
for _genre in soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(2)"):
|
||||
gen = _genre.text.split(":").pop().strip().split(", ")
|
||||
genre = gen
|
||||
status_anime = soup.select("#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.info > p:nth-child(6)")[0].text.split(":").pop().strip()
|
||||
for smokedl in soup.find("div", {"class": "dlbod"}).find_all("div", {"class": "smokeddl"}):
|
||||
for num, smokedl in enumerate(soup.find("div", {"class": "dlbod"}).find_all("div", {"class": "smokeddl"}), start=1):
|
||||
titl = soup.select(f"#venkonten > div.vezone > div.venser > div.venutama > div.lexot > div.dlbod > div:nth-child({num}) > div.smokettl")[0].text
|
||||
titl = re.sub(f"Download", "", titl).strip()
|
||||
titl = re.sub("Download", "", titl).strip()
|
||||
mendata = {"name": titl, "links": []}
|
||||
for smokeurl in smokedl.find_all("div", {"class": "smokeurl"}):
|
||||
quality = smokeurl.find("strong").text
|
||||
|
|
@ -53,10 +50,17 @@ async def kusonimeBypass(url: str, slug=None):
|
|||
links.append({"client": client, "url": url})
|
||||
mendata["links"].append(dict(quality=quality, link_download=links))
|
||||
data.append(mendata)
|
||||
num += 1
|
||||
hasil.update({"error": False, "title": title, "thumb": thumb, "genre": genre, "genre_string": ", ".join(genre), "status_anim": status_anime, "data": data})
|
||||
hasil |= {
|
||||
"error": False,
|
||||
"title": title,
|
||||
"thumb": thumb,
|
||||
"genre": genre,
|
||||
"genre_string": ", ".join(genre),
|
||||
"status_anim": status_anime,
|
||||
"data": data,
|
||||
}
|
||||
except:
|
||||
hasil.update({"error": True, "error_message": "kuso bypass error"})
|
||||
hasil |= {"error": True, "error_message": "kuso bypass error"}
|
||||
finally:
|
||||
await request.close()
|
||||
return hasil
|
||||
|
|
@ -65,6 +69,7 @@ async def kusonimeBypass(url: str, slug=None):
|
|||
async def byPassPh(url: str, msg_id: int):
|
||||
kusonime = await kusonimeBypass(url)
|
||||
results = {"error": True, "error_message": "Post to or create TGH error"}
|
||||
if not kusonime["error"]:
|
||||
template = """
|
||||
<img src={{{thumb}}}>
|
||||
<p><b>Title</b> : <code>{{title}}</code></p>
|
||||
|
|
@ -82,10 +87,9 @@ async def byPassPh(url: str, msg_id: int):
|
|||
<br>
|
||||
{{/data}}
|
||||
""".strip()
|
||||
if not kusonime["error"]:
|
||||
html = chevron.render(template, kusonime)
|
||||
page = telegraph.create_page(f"{kusonime.get('title')}-{msg_id}", html_content=html)
|
||||
results.update({"error": False, "url": "https://telegra.ph/{}".format(page["path"])})
|
||||
results |= {"error": False, "url": f'https://telegra.ph/{page["path"]}'}
|
||||
del results["error_message"]
|
||||
return results
|
||||
|
||||
|
|
|
|||
|
|
@ -10,21 +10,16 @@ from utils import LOGGER
|
|||
|
||||
async def post_to_telegraph(is_media: bool, title=None, content=None, media=None):
|
||||
telegraph = Telegraph()
|
||||
if telegraph.get_access_token() == None:
|
||||
if telegraph.get_access_token() is None:
|
||||
await telegraph.create_account(short_name=BOT_USERNAME)
|
||||
LOGGER.info(f"Create TGH Account ..")
|
||||
LOGGER.info("Create TGH Account ..")
|
||||
if is_media:
|
||||
"""Create a Telegram Post Foto/Video"""
|
||||
response = await telegraph.upload_file(media)
|
||||
return f"https://telegra.ph{response[0]['src']}"
|
||||
"""Create a Telegram Post using HTML Content"""
|
||||
response = await telegraph.create_page(
|
||||
title,
|
||||
html_content=content,
|
||||
author_url=f"https://t.me/{BOT_USERNAME}",
|
||||
author_name=BOT_USERNAME
|
||||
)
|
||||
return response['url']
|
||||
response = await telegraph.create_page(title, html_content=content, author_url=f"https://t.me/{BOT_USERNAME}", author_name=BOT_USERNAME)
|
||||
return response["url"]
|
||||
|
||||
|
||||
async def run_subprocess(cmd):
|
||||
|
|
|
|||
|
|
@ -8,63 +8,59 @@ import uuid
|
|||
from pathlib import Path
|
||||
|
||||
from pyrogram import enums
|
||||
from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup,
|
||||
InputMediaPhoto)
|
||||
from pyrogram.types import InlineKeyboardButton, InputMediaPhoto
|
||||
|
||||
from misskaty.core.message_utils import *
|
||||
|
||||
|
||||
async def run_subprocess(cmd):
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
process = await asyncio.create_subprocess_shell(cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||
return await process.communicate()
|
||||
|
||||
|
||||
def get_random_start_at(seconds, dur=0):
|
||||
return random.randint(0, seconds - dur)
|
||||
|
||||
|
||||
async def get_duration(input_file_link):
|
||||
ffmpeg_dur_cmd = f"ffprobe -v error -show_entries format=duration -of csv=p=0:s=x -select_streams v:0 {shlex.quote(input_file_link)}"
|
||||
# print(ffmpeg_dur_cmd)
|
||||
out, err = await run_subprocess(ffmpeg_dur_cmd)
|
||||
out = out.decode().strip()
|
||||
if not out:
|
||||
if out := out.decode().strip():
|
||||
return duration if (duration := round(float(out))) else "No duration!"
|
||||
else:
|
||||
return err.decode()
|
||||
duration = round(float(out))
|
||||
if duration:
|
||||
return duration
|
||||
return 'No duration!'
|
||||
|
||||
|
||||
def is_url(text):
|
||||
return text.startswith('http')
|
||||
return text.startswith("http")
|
||||
|
||||
|
||||
async def get_dimentions(input_file_link):
|
||||
ffprobe_cmd = f"ffprobe -v error -show_entries stream=width,height -of csv=p=0:s=x -select_streams v:0 {shlex.quote(input_file_link)}"
|
||||
output = await run_subprocess(ffprobe_cmd)
|
||||
try:
|
||||
width, height = [int(i.strip()) for i in output[0].decode().split('x')]
|
||||
width, height = [int(i.strip()) for i in output[0].decode().split("x")]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
width, height = 1280, 534
|
||||
return width, height
|
||||
|
||||
async def screenshot_flink(c, m):
|
||||
|
||||
chat_id = m.from_user.id
|
||||
async def screenshot_flink(c, m):
|
||||
m.from_user.id
|
||||
# if c.CURRENT_PROCESSES.get(chat_id, 0) == 1:
|
||||
# return await m.answer('You have reached the maximum parallel processes! Try again after one of them finishes.', show_alert=True)
|
||||
# if not c.CURRENT_PROCESSES.get(chat_id):
|
||||
# c.CURRENT_PROCESSES[chat_id] = 0
|
||||
# c.CURRENT_PROCESSES[chat_id] += 1
|
||||
|
||||
_, num_screenshots = m.data.split('+')
|
||||
_, num_screenshots = m.data.split("+")
|
||||
num_screenshots = int(num_screenshots)
|
||||
media_msg = m.message.reply_to_message
|
||||
# print(media_msg)
|
||||
if media_msg.empty:
|
||||
await editPesan(m.message, 'Why did you delete the file 😠, Now i cannot help you 😒.')
|
||||
await editPesan(m.message, "Why did you delete the file 😠, Now i cannot help you 😒.")
|
||||
# c.CURRENT_PROCESSES[chat_id] -= 1
|
||||
return
|
||||
|
||||
|
|
@ -76,9 +72,9 @@ async def screenshot_flink(c, m):
|
|||
try:
|
||||
start_time = time.time()
|
||||
|
||||
await editPesan(m.message, 'Give me some time bruh!! 😴')
|
||||
await editPesan(m.message, "Give me some time bruh!! 😴")
|
||||
|
||||
await editPesan(m.message, '😀 Taking Snaps!')
|
||||
await editPesan(m.message, "😀 Taking Snaps!")
|
||||
file_link = m.message.reply_to_message.command[1]
|
||||
duration = await get_duration(file_link)
|
||||
if isinstance(duration, str):
|
||||
|
|
@ -89,55 +85,46 @@ async def screenshot_flink(c, m):
|
|||
reduced_sec = duration - int(duration * 2 / 100)
|
||||
print(f"Total seconds: {duration}, Reduced seconds: {reduced_sec}")
|
||||
screenshots = []
|
||||
ffmpeg_errors = ''
|
||||
ffmpeg_errors = ""
|
||||
|
||||
screenshot_secs = [get_random_start_at(reduced_sec) for i in range(1, 1+num_screenshots)]
|
||||
screenshot_secs = [get_random_start_at(reduced_sec) for _ in range(1, 1 + num_screenshots)]
|
||||
width, height = await get_dimentions(file_link)
|
||||
|
||||
for i, sec in enumerate(screenshot_secs):
|
||||
thumbnail_template = output_folder.joinpath(f'{i+1}.png')
|
||||
thumbnail_template = output_folder.joinpath(f"{i+1}.png")
|
||||
# print(sec)
|
||||
ffmpeg_cmd = f"mediaextract -hide_banner -ss {sec} -i {shlex.quote(file_link)} -vframes 1 '{thumbnail_template}'"
|
||||
output = await run_subprocess(ffmpeg_cmd)
|
||||
await editPesan(m.message, f'😀 `{i+1}` of `{num_screenshots}` generated!')
|
||||
await editPesan(m.message, f"😀 `{i+1}` of `{num_screenshots}` generated!")
|
||||
if thumbnail_template.exists():
|
||||
screenshots.append(
|
||||
InputMediaPhoto(
|
||||
str(thumbnail_template),
|
||||
caption=f"ScreenShot at {datetime.timedelta(seconds=sec)}"
|
||||
)
|
||||
)
|
||||
screenshots.append(InputMediaPhoto(str(thumbnail_template), caption=f"ScreenShot at {datetime.timedelta(seconds=sec)}"))
|
||||
continue
|
||||
ffmpeg_errors += output[1].decode() + '\n\n'
|
||||
ffmpeg_errors += output[1].decode() + "\n\n"
|
||||
|
||||
# print(screenshots)
|
||||
if not screenshots:
|
||||
await editPesan(m.message, '😟 Sorry! Screenshot generation failed possibly due to some infrastructure failure 😥.')
|
||||
await editPesan(m.message, "😟 Sorry! Screenshot generation failed possibly due to some infrastructure failure 😥.")
|
||||
# c.CURRENT_PROCESSES[chat_id] -= 1
|
||||
return
|
||||
|
||||
await editPesan(m.message, f'🤓 Its done , Now starting to upload!')
|
||||
await editPesan(m.message, "🤓 Its done , Now starting to upload!")
|
||||
await media_msg.reply_chat_action(enums.ChatAction.UPLOAD_PHOTO)
|
||||
await media_msg.reply_media_group(screenshots, True)
|
||||
|
||||
await editPesan(m.message, f'Completed in {datetime.timedelta(seconds=int(time.time()-start_time))}\n\nJoin @YasirPediaChannel\n\n©️ https://yasirpedia.eu.org')
|
||||
await editPesan(m.message, f"Completed in {datetime.timedelta(seconds=int(time.time()-start_time))}\n\nJoin @YasirPediaChannel\n\n©️ https://yasirpedia.eu.org")
|
||||
# c.CURRENT_PROCESSES[chat_id] -= 1
|
||||
|
||||
except:
|
||||
aa = traceback.print_exc()
|
||||
await editPesan(m.message, '😟 Sorry! Screenshot generation failed, ERR: {aa} 😥.')
|
||||
traceback.print_exc()
|
||||
await editPesan(m.message, "😟 Sorry! Screenshot generation failed, ERR: {aa} 😥.")
|
||||
# c.CURRENT_PROCESSES[chat_id] -= 1
|
||||
|
||||
|
||||
def gen_ik_buttons():
|
||||
btns = []
|
||||
i_keyboard = []
|
||||
for i in range(2, 11):
|
||||
i_keyboard.append(
|
||||
InlineKeyboardButton(
|
||||
f"{i}",
|
||||
f"scht+{i}"
|
||||
)
|
||||
)
|
||||
i_keyboard.append(InlineKeyboardButton(f"{i}", f"scht+{i}"))
|
||||
if (i > 2) and (i % 2) == 1:
|
||||
btns.append(i_keyboard)
|
||||
i_keyboard = []
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ async def rentry(teks):
|
|||
.get("url")
|
||||
)
|
||||
|
||||
def get_provider(url):
|
||||
|
||||
def get_provider(url):
|
||||
def pretty(names):
|
||||
name = names[1]
|
||||
if names[0] == "play":
|
||||
|
|
@ -102,7 +102,8 @@ def get_provider(url):
|
|||
return name.title()
|
||||
|
||||
netloc = urlparse(url).netloc
|
||||
return pretty(netloc.split('.'))
|
||||
return pretty(netloc.split("."))
|
||||
|
||||
|
||||
async def search_jw(movie_name: str, locale: str):
|
||||
m_t_ = ""
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ async def admin_cache_func(_, cmu):
|
|||
@app.on_message(filters.command("purge", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_delete_messages")
|
||||
async def purge(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
try:
|
||||
repliedmsg = message.reply_to_message
|
||||
await message.delete()
|
||||
|
|
@ -86,8 +87,7 @@ async def purge(_, message):
|
|||
cmd = message.command
|
||||
if len(cmd) > 1 and cmd[1].isdigit():
|
||||
purge_to = repliedmsg.id + int(cmd[1])
|
||||
if purge_to > message.id:
|
||||
purge_to = message.id
|
||||
purge_to = min(purge_to, message.id)
|
||||
else:
|
||||
purge_to = message.id
|
||||
|
||||
|
|
@ -129,7 +129,8 @@ async def purge(_, message):
|
|||
@app.on_message(filters.command(["kick", "dkick"], COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def kickFunc(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
user_id, reason = await extract_user_and_reason(message)
|
||||
if not user_id:
|
||||
return await message.reply_text("I can't find that user.")
|
||||
|
|
@ -159,7 +160,8 @@ async def kickFunc(client, message):
|
|||
@app.on_message(filters.command(["ban", "dban", "tban"], COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def banFunc(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
user_id, reason = await extract_user_and_reason(message, sender_chat=True)
|
||||
|
||||
if not user_id:
|
||||
|
|
@ -210,7 +212,8 @@ async def banFunc(client, message):
|
|||
@app.on_message(filters.command("unban", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def unban_func(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
# we don't need reasons for unban, also, we
|
||||
# don't need to get "text_mention" entity, because
|
||||
# normal users won't get text_mention if the user
|
||||
|
|
@ -234,7 +237,8 @@ async def unban_func(_, message):
|
|||
# Ban users listed in a message
|
||||
@app.on_message(filters.user(SUDO) & filters.command("listban", COMMAND_HANDLER) & filters.group)
|
||||
async def list_ban_(c, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
userid, msglink_reason = await extract_user_and_reason(message)
|
||||
if not userid or not msglink_reason:
|
||||
return await message.reply_text("Provide a userid/username along with message link and reason to list-ban")
|
||||
|
|
@ -284,7 +288,8 @@ async def list_ban_(c, message):
|
|||
# Unban users listed in a message
|
||||
@app.on_message(filters.user(SUDO) & filters.command("listunban", COMMAND_HANDLER) & filters.group)
|
||||
async def list_unban_(c, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
userid, msglink = await extract_user_and_reason(message)
|
||||
if not userid or not msglink:
|
||||
return await message.reply_text("Provide a userid/username along with message link to list-unban")
|
||||
|
|
@ -327,7 +332,8 @@ async def list_unban_(c, message):
|
|||
@app.on_message(filters.command("del", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_delete_messages")
|
||||
async def deleteFunc(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
if not message.reply_to_message:
|
||||
return await message.reply_text("Reply To A Message To Delete It")
|
||||
try:
|
||||
|
|
@ -341,7 +347,8 @@ async def deleteFunc(_, message):
|
|||
@app.on_message(filters.command(["promote", "fullpromote"], COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_promote_members")
|
||||
async def promoteFunc(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
try:
|
||||
user_id = await extract_user(message)
|
||||
umention = (await app.get_users(user_id)).mention
|
||||
|
|
@ -386,7 +393,8 @@ async def promoteFunc(client, message):
|
|||
@app.on_message(filters.command("demote", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_promote_members")
|
||||
async def demote(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
user_id = await extract_user(message)
|
||||
if not user_id:
|
||||
return await message.reply_text("I can't find that user.")
|
||||
|
|
@ -413,7 +421,8 @@ async def demote(client, message):
|
|||
@app.on_message(filters.command(["pin", "unpin"], COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_pin_messages")
|
||||
async def pin(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
if not message.reply_to_message:
|
||||
return await message.reply_text("Reply to a message to pin/unpin it.")
|
||||
r = message.reply_to_message
|
||||
|
|
@ -440,7 +449,8 @@ async def pin(_, message):
|
|||
@app.on_message(filters.command(["mute", "tmute"], COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def mute(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
try:
|
||||
user_id, reason = await extract_user_and_reason(message)
|
||||
except Exception as err:
|
||||
|
|
@ -487,7 +497,8 @@ async def mute(client, message):
|
|||
@app.on_message(filters.command("unmute", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def unmute(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
user_id = await extract_user(message)
|
||||
if not user_id:
|
||||
return await message.reply_text("I can't find that user.")
|
||||
|
|
@ -499,7 +510,8 @@ async def unmute(_, message):
|
|||
@app.on_message(filters.command(["warn", "dwarn"], COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def warn_user(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
user_id, reason = await extract_user_and_reason(message)
|
||||
chat_id = message.chat.id
|
||||
if not user_id:
|
||||
|
|
@ -602,7 +614,8 @@ async def unban_user(_, cq):
|
|||
@app.on_message(filters.command("rmwarn", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_restrict_members")
|
||||
async def remove_warnings(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
if not message.reply_to_message:
|
||||
return await message.reply_text("Reply to a message to remove a user's warnings.")
|
||||
user_id = message.reply_to_message.from_user.id
|
||||
|
|
@ -622,7 +635,8 @@ async def remove_warnings(_, message):
|
|||
@app.on_message(filters.command("warns", COMMAND_HANDLER) & filters.group)
|
||||
@capture_err
|
||||
async def check_warns(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
user_id = await extract_user(message)
|
||||
if not user_id:
|
||||
return await message.reply_text("I can't find that user.")
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ import time
|
|||
|
||||
from pyrogram import filters
|
||||
|
||||
from database.afk_db import (add_afk, cleanmode_off, cleanmode_on, is_afk,
|
||||
remove_afk)
|
||||
from database.afk_db import add_afk, cleanmode_off, cleanmode_on, is_afk, remove_afk
|
||||
from misskaty import app
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
from misskaty.core.decorator.permissions import adminsOnly
|
||||
|
|
@ -185,7 +184,8 @@ async def active_afk(_, message):
|
|||
@app.on_message(filters.command("afkdel", COMMAND_HANDLER) & filters.group)
|
||||
@adminsOnly("can_change_info")
|
||||
async def afk_state(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
usage = "**Usage:**\n/afkdel [ENABLE|DISABLE] to enable or disable auto delete message."
|
||||
if len(message.command) == 1:
|
||||
return await kirimPesan(message, usage)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ async def pling_bypass(url):
|
|||
|
||||
|
||||
def wetransfer_bypass(url: str) -> str:
|
||||
|
||||
if url.startswith("https://we.tl/"):
|
||||
r = requests.head(url, allow_redirects=True)
|
||||
url = r.url
|
||||
|
|
@ -115,8 +114,6 @@ async def bypass(_, message):
|
|||
reply_markup=markup,
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
elif "we.tl" or "wetransfer.com" in url:
|
||||
else:
|
||||
data = wetransfer_bypass(url)
|
||||
await editPesan(msg, f"{data}\n\n{mention}")
|
||||
else:
|
||||
await editPesan(msg, "Unsupported URL..")
|
||||
|
|
@ -16,7 +16,6 @@ from pyrogram import enums, filters
|
|||
|
||||
from database.afk_db import is_afk, remove_afk
|
||||
from misskaty import BOT_USERNAME, app
|
||||
from misskaty.core.message_utils import *
|
||||
from misskaty.helper.human_read import get_readable_time2
|
||||
from utils import put_cleanmode
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ __HELP__ = """
|
|||
/json - Send structure message Telegram in JSON using Pyrogram Style.
|
||||
"""
|
||||
|
||||
|
||||
async def edit_or_reply(msg, **kwargs):
|
||||
func = msg.edit_text if msg.from_user.is_self else msg.reply
|
||||
spec = getfullargspec(func.__wrapped__).args
|
||||
|
|
@ -167,6 +168,7 @@ async def evaluation_cmd_t(_, m):
|
|||
if not m.from_user.is_self:
|
||||
await status_message.delete()
|
||||
|
||||
|
||||
# Update and restart bot
|
||||
@app.on_message(filters.command(["update"], COMMAND_HANDLER) & filters.user(SUDO))
|
||||
async def update_restart(_, message):
|
||||
|
|
@ -177,11 +179,10 @@ async def update_restart(_, message):
|
|||
await message.reply_text(f"<code>{out}</code>")
|
||||
except Exception as e:
|
||||
return await message.reply_text(str(e))
|
||||
await message.reply_text(
|
||||
"<b>Updated with default branch, restarting now.</b>"
|
||||
)
|
||||
await message.reply_text("<b>Updated with default branch, restarting now.</b>")
|
||||
os.execvp(sys.executable, [sys.executable, "-m", "misskaty"])
|
||||
|
||||
|
||||
async def aexec(code, c, m):
|
||||
exec("async def __aexec(c, m): " + "\n p = print" + "\n replied = m.reply_to_message" + "".join(f"\n {l_}" for l_ in code.split("\n")))
|
||||
return await locals()["__aexec"](c, m)
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ import re
|
|||
|
||||
from pyrogram import filters
|
||||
|
||||
from database.filters_db import (delete_filter, get_filter, get_filters_names,
|
||||
save_filter)
|
||||
from database.filters_db import delete_filter, get_filter, get_filters_names, save_filter
|
||||
from misskaty import app
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
from misskaty.core.decorator.permissions import adminsOnly
|
||||
|
|
|
|||
|
|
@ -11,18 +11,16 @@ import time
|
|||
import traceback
|
||||
from asyncio import gather, sleep
|
||||
from logging import getLogger
|
||||
from shutil import rmtree
|
||||
|
||||
from pyrogram import enums, filters
|
||||
from pyrogram.errors import FloodWait
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from pyrogram.types import InlineKeyboardMarkup
|
||||
|
||||
from misskaty import BOT_USERNAME, app
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
from misskaty.core.decorator.pyro_cooldown import wait
|
||||
from misskaty.core.message_utils import *
|
||||
from misskaty.helper import (gen_ik_buttons, get_duration, is_url,
|
||||
progress_for_pyrogram, screenshot_flink, take_ss)
|
||||
from misskaty.helper import gen_ik_buttons, get_duration, is_url, progress_for_pyrogram, screenshot_flink, take_ss
|
||||
from misskaty.vars import COMMAND_HANDLER
|
||||
|
||||
LOGGER = getLogger(__name__)
|
||||
|
|
@ -37,7 +35,8 @@ __HELP__ = """"
|
|||
@app.on_message(filters.command(["genss"], COMMAND_HANDLER) & wait(30))
|
||||
@capture_err
|
||||
async def genss(client, m):
|
||||
if not m.from_user: return
|
||||
if not m.from_user:
|
||||
return
|
||||
replied = m.reply_to_message
|
||||
if len(m.command) == 2 and is_url(m.command[1]):
|
||||
snt = await kirimPesan(m, "Give me some time to process your request!! 😴", quote=True)
|
||||
|
|
@ -46,11 +45,7 @@ async def genss(client, m):
|
|||
if isinstance(duration, str):
|
||||
return await editPesan(snt, "😟 Sorry! I cannot open the file.")
|
||||
btns = gen_ik_buttons()
|
||||
await editPesan(
|
||||
snt,
|
||||
f"Now choose how many result for screenshot? 🥳.\n\nTotal duration: `{datetime.timedelta(seconds=duration)}` (`{duration}s`)",
|
||||
reply_markup=InlineKeyboardMarkup(btns)
|
||||
)
|
||||
await editPesan(snt, f"Now choose how many result for screenshot? 🥳.\n\nTotal duration: `{datetime.timedelta(seconds=duration)}` (`{duration}s`)", reply_markup=InlineKeyboardMarkup(btns))
|
||||
elif replied and replied.media:
|
||||
vid = [replied.video, replied.document]
|
||||
media = next((v for v in vid if v is not None), None)
|
||||
|
|
@ -87,7 +82,8 @@ async def genss(client, m):
|
|||
]
|
||||
)
|
||||
await kirimPesan(
|
||||
m, f"☑️ Uploaded [1] screenshoot.\n\n{m.from_user.first_name} (<code>{m.from_user.id}</code>)\n#️⃣ #ssgen #id{m.from_user.id}\n\nSS Generate by @{BOT_USERNAME}",
|
||||
m,
|
||||
f"☑️ Uploaded [1] screenshoot.\n\n{m.from_user.first_name} (<code>{m.from_user.id}</code>)\n#️⃣ #ssgen #id{m.from_user.id}\n\nSS Generate by @{BOT_USERNAME}",
|
||||
reply_to_message_id=m.id,
|
||||
)
|
||||
await process.delete()
|
||||
|
|
@ -107,6 +103,7 @@ async def genss(client, m):
|
|||
else:
|
||||
await kirimPesan(m, "Reply to a Telegram media to get screenshots from media..")
|
||||
|
||||
@app.on_callback_query(filters.regex(r'^scht'))
|
||||
|
||||
@app.on_callback_query(filters.regex(r"^scht"))
|
||||
async def _(c, m):
|
||||
asyncio.create_task(screenshot_flink(c, m))
|
||||
|
|
@ -6,12 +6,7 @@ from logging import getLogger
|
|||
|
||||
from PIL import Image, ImageChops, ImageDraw, ImageFont
|
||||
from pyrogram import enums, filters
|
||||
from pyrogram.errors import (
|
||||
ChatAdminRequired,
|
||||
ChatSendMediaForbidden,
|
||||
MessageTooLong,
|
||||
RPCError
|
||||
)
|
||||
from pyrogram.errors import ChatAdminRequired, MessageTooLong, RPCError
|
||||
from pyrogram.types import ChatMemberUpdated, InlineKeyboardButton, InlineKeyboardMarkup
|
||||
|
||||
from database.users_chats_db import db
|
||||
|
|
@ -89,7 +84,7 @@ async def member_has_joined(c: app, member: ChatMemberUpdated):
|
|||
else:
|
||||
if (temp.MELCOW).get(f"welcome-{member.chat.id}") is not None:
|
||||
try:
|
||||
await (temp.MELCOW[f"welcome-{member.chat.id}"]).delete()
|
||||
await temp.MELCOW[f"welcome-{member.chat.id}"].delete()
|
||||
except:
|
||||
pass
|
||||
mention = f"<a href='tg://user?id={user.id}'>{user.first_name}</a>"
|
||||
|
|
@ -186,7 +181,7 @@ async def save_group(bot, message):
|
|||
pic = "img/profilepic.png"
|
||||
if (temp.MELCOW).get(f"welcome-{message.chat.id}") is not None:
|
||||
try:
|
||||
await (temp.MELCOW[f"welcome-{message.chat.id}"]).delete()
|
||||
await temp.MELCOW[f"welcome-{message.chat.id}"].delete()
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -28,15 +28,13 @@ LOGGER = logging.getLogger(__name__)
|
|||
LIST_CARI = {}
|
||||
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10"}
|
||||
|
||||
|
||||
# IMDB Choose Language
|
||||
@app.on_message(filters.command(["imdb"], COMMAND_HANDLER))
|
||||
@capture_err
|
||||
async def imdb_choose(_, m):
|
||||
if len(m.command) == 1:
|
||||
return await kirimPesan(
|
||||
m,
|
||||
f"ℹ️ Please add query after CMD!\nEx: <code>/{m.command[0]} Jurassic World</code>"
|
||||
)
|
||||
return await kirimPesan(m, f"ℹ️ Please add query after CMD!\nEx: <code>/{m.command[0]} Jurassic World</code>")
|
||||
if m.sender_chat:
|
||||
return await kirimPesan(m, "This feature not supported for channel..")
|
||||
kuery = m.text.split(None, 1)[1]
|
||||
|
|
@ -268,14 +266,11 @@ async def imdb_id_callback(_, query):
|
|||
try:
|
||||
await query.message.edit_caption("⏳ Permintaan kamu sedang diproses.. ")
|
||||
url = f"https://www.imdb.com/title/tt{movie}/"
|
||||
resp = await http.get(
|
||||
url,
|
||||
headers=headers
|
||||
)
|
||||
resp = await http.get(url, headers=headers)
|
||||
sop = BeautifulSoup(resp, "lxml")
|
||||
r_json = json.loads(sop.find("script", attrs={"type": "application/ld+json"}).contents[0])
|
||||
ott = await search_jw(r_json.get("name"), "ID")
|
||||
typee = r_json.get('@type', '')
|
||||
typee = r_json.get("@type", "")
|
||||
res_str = ""
|
||||
if judul := r_json.get("name"):
|
||||
try:
|
||||
|
|
@ -303,17 +298,11 @@ async def imdb_id_callback(_, query):
|
|||
genre = genre[:-2]
|
||||
res_str += f"<b>Genre:</b> {genre}\n"
|
||||
if negara := sop.select('li[data-testid="title-details-origin"]'):
|
||||
country = "".join(
|
||||
f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, "
|
||||
for country in negara[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
||||
)
|
||||
country = "".join(f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, " for country in negara[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"))
|
||||
country = country[:-2]
|
||||
res_str += f"<b>Negara:</b> {country}\n"
|
||||
if bahasa := sop.select('li[data-testid="title-details-languages"]'):
|
||||
language = "".join(
|
||||
f"#{lang.text.replace(' ', '_').replace('-', '_')}, "
|
||||
for lang in bahasa[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
||||
)
|
||||
language = "".join(f"#{lang.text.replace(' ', '_').replace('-', '_')}, " for lang in bahasa[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"))
|
||||
language = language[:-2]
|
||||
res_str += f"<b>Bahasa:</b> {language}\n"
|
||||
res_str += "\n<b>🙎 Info Cast:</b>\n"
|
||||
|
|
@ -397,14 +386,11 @@ async def imdb_en_callback(bot, query):
|
|||
await query.message.edit_caption("<i>⏳ Getting IMDb source..</i>")
|
||||
try:
|
||||
url = f"https://www.imdb.com/title/tt{movie}/"
|
||||
resp = await http.get(
|
||||
url,
|
||||
headers=headers
|
||||
)
|
||||
resp = await http.get(url, headers=headers)
|
||||
sop = BeautifulSoup(resp, "lxml")
|
||||
r_json = json.loads(sop.find("script", attrs={"type": "application/ld+json"}).contents[0])
|
||||
ott = await search_jw(r_json.get("name"), "US")
|
||||
typee = r_json.get('@type', '')
|
||||
typee = r_json.get("@type", "")
|
||||
res_str = ""
|
||||
if judul := r_json.get("name"):
|
||||
try:
|
||||
|
|
@ -432,17 +418,11 @@ async def imdb_en_callback(bot, query):
|
|||
genre = genre[:-2]
|
||||
res_str += f"<b>Genre:</b> {genre}\n"
|
||||
if negara := sop.select('li[data-testid="title-details-origin"]'):
|
||||
country = "".join(
|
||||
f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, "
|
||||
for country in negara[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
||||
)
|
||||
country = "".join(f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, " for country in negara[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"))
|
||||
country = country[:-2]
|
||||
res_str += f"<b>Country:</b> {country}\n"
|
||||
if bahasa := sop.select('li[data-testid="title-details-languages"]'):
|
||||
language = "".join(
|
||||
f"#{lang.text.replace(' ', '_').replace('-', '_')}, "
|
||||
for lang in bahasa[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
||||
)
|
||||
language = "".join(f"#{lang.text.replace(' ', '_').replace('-', '_')}, " for lang in bahasa[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"))
|
||||
language = language[:-2]
|
||||
res_str += f"<b>Language:</b> {language}\n"
|
||||
res_str += "\n<b>🙎 Cast Info:</b>\n"
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@ import traceback
|
|||
from logging import getLogger
|
||||
from sys import platform
|
||||
from sys import version as pyver
|
||||
from unicodedata import name
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from deep_translator import GoogleTranslator
|
||||
from motor import version as mongover
|
||||
from misskaty.core.keyboard import keyboard
|
||||
from pykeyboard import InlineKeyboard, InlineButton
|
||||
from pyrogram import __version__ as pyrover
|
||||
from pyrogram import enums, filters
|
||||
|
|
@ -42,6 +40,7 @@ keywords_list = ["imdb", "pypi", "git", "google", "secretmsg", "info", "botapi"]
|
|||
PRVT_MSGS = {}
|
||||
LOGGER = getLogger()
|
||||
|
||||
|
||||
@app.on_inline_query()
|
||||
async def inline_menu(_, inline_query: InlineQuery):
|
||||
if inline_query.query.strip().lower().strip() == "":
|
||||
|
|
@ -98,7 +97,11 @@ async def inline_menu(_, inline_query: InlineQuery):
|
|||
)
|
||||
kueri = inline_query.query.split(None, 1)[1].strip()
|
||||
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/61.0.3163.100 Safari/537.36"}
|
||||
jsonapi = await http.get(f"https://github.com/yasirarism/telegram-bot-api-spec/raw/main/api.json", headers=headers, follow_redirects=True)
|
||||
jsonapi = await http.get(
|
||||
"https://github.com/yasirarism/telegram-bot-api-spec/raw/main/api.json",
|
||||
headers=headers,
|
||||
follow_redirects=True,
|
||||
)
|
||||
parsemethod = jsonapi.json().get("methods")
|
||||
parsetypes = jsonapi.json().get("types")
|
||||
datajson = []
|
||||
|
|
@ -542,7 +545,7 @@ async def imdb_inl(_, query):
|
|||
r_json = json.loads(sop.find("script", attrs={"type": "application/ld+json"}).contents[0])
|
||||
ott = await search_jw(r_json["name"], "en_ID")
|
||||
res_str = ""
|
||||
typee = r_json.get('@type', '')
|
||||
typee = r_json.get("@type", "")
|
||||
if r_json.get("name"):
|
||||
try:
|
||||
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find("span", class_="sc-8c396aa2-2 jwaBvf").text
|
||||
|
|
@ -569,17 +572,11 @@ async def imdb_inl(_, query):
|
|||
genre = genre[:-2]
|
||||
res_str += f"<b>Genre:</b> {genre}\n"
|
||||
if negara := sop.select('li[data-testid="title-details-origin"]'):
|
||||
country = "".join(
|
||||
f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, "
|
||||
for country in negara[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
||||
)
|
||||
country = "".join(f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, " for country in negara[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"))
|
||||
country = country[:-2]
|
||||
res_str += f"<b>Negara:</b> {country}\n"
|
||||
if bahasa := sop.select('li[data-testid="title-details-languages"]'):
|
||||
language = "".join(
|
||||
f"#{lang.text.replace(' ', '_').replace('-', '_')}, "
|
||||
for lang in bahasa[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
||||
)
|
||||
language = "".join(f"#{lang.text.replace(' ', '_').replace('-', '_')}, " for lang in bahasa[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"))
|
||||
language = language[:-2]
|
||||
res_str += f"<b>Bahasa:</b> {language}\n"
|
||||
res_str += "\n<b>🙎 Info Cast:</b>\n"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* @projectName MissKatyPyro
|
||||
* Copyright @YasirPedia All rights reserved
|
||||
"""
|
||||
import asyncio
|
||||
import io
|
||||
import subprocess
|
||||
import time
|
||||
|
|
@ -17,14 +16,15 @@ from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
|||
from misskaty import app
|
||||
from misskaty.core.message_utils import *
|
||||
from misskaty.core.decorator.pyro_cooldown import wait
|
||||
from misskaty.helper import post_to_telegraph, runcmd, progress_for_pyrogram, http
|
||||
from misskaty.helper import http, progress_for_pyrogram, runcmd
|
||||
from misskaty.vars import COMMAND_HANDLER
|
||||
from utils import get_file_id
|
||||
|
||||
|
||||
@app.on_message(filters.command(["mediainfo"], COMMAND_HANDLER) & wait(30))
|
||||
async def mediainfo(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
if message.reply_to_message and message.reply_to_message.media:
|
||||
process = await kirimPesan(message, "`Sedang memproses, lama waktu tergantung ukuran file kamu...`", quote=True)
|
||||
file_info = get_file_id(message.reply_to_message)
|
||||
|
|
@ -56,7 +56,7 @@ async def mediainfo(client, message):
|
|||
"expire_at": 0,
|
||||
"expire_in": 0,
|
||||
}
|
||||
response = await http.post('https://paste.yasir.eu.org/api/new', json=json_data)
|
||||
response = await http.post("https://paste.yasir.eu.org/api/new", json=json_data)
|
||||
link = f"https://paste.yasir.eu.org/{response.json()['id']}"
|
||||
except:
|
||||
link = None
|
||||
|
|
@ -88,7 +88,7 @@ async def mediainfo(client, message):
|
|||
"expire_at": 0,
|
||||
"expire_in": 0,
|
||||
}
|
||||
response = await http.post('https://paste.yasir.eu.org/api/new', json=json_data)
|
||||
response = await http.post("https://paste.yasir.eu.org/api/new", json=json_data)
|
||||
link = f"https://paste.yasir.eu.org/{response.json()['id']}"
|
||||
except:
|
||||
link = None
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ __HELP__ = """
|
|||
/temp_paste [Text/Reply To Message] - Post text to tempaste.com using html style.
|
||||
"""
|
||||
|
||||
|
||||
# Size Checker for Limit
|
||||
def humanbytes(size: int):
|
||||
"""Convert Bytes To Bytes So That Human Can Read It"""
|
||||
|
|
@ -64,6 +65,7 @@ def humanbytes(size: int):
|
|||
# Pattern if extension supported, PR if want to add more
|
||||
pattern = compiles(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$|x-subrip$")
|
||||
|
||||
|
||||
@app.on_message(filters.command(["tgraph"], COMMAND_HANDLER))
|
||||
async def telegraph_paste(_, message):
|
||||
reply = message.reply_to_message
|
||||
|
|
@ -134,6 +136,7 @@ async def telegraph_paste(_, message):
|
|||
pasted = f"**Successfully pasted your data to Telegraph<a href='{url}'>.</a>\n\nPaste by {uname}**"
|
||||
await editPesan(msg, pasted, reply_markup=InlineKeyboardMarkup(button))
|
||||
|
||||
|
||||
# Default Paste to Wastebin using Deta
|
||||
@app.on_message(filters.command(["paste"], COMMAND_HANDLER))
|
||||
async def wastepaste(_, message):
|
||||
|
|
@ -182,7 +185,7 @@ async def wastepaste(_, message):
|
|||
"expire_at": 0,
|
||||
"expire_in": 0,
|
||||
}
|
||||
response = await http.post('https://paste.yasir.eu.org/api/new', json=json_data)
|
||||
response = await http.post("https://paste.yasir.eu.org/api/new", json=json_data)
|
||||
url = f"https://paste.yasir.eu.org/{response.json()['id']}"
|
||||
except Exception as e:
|
||||
return await editPesan(msg, f"ERROR: {e}")
|
||||
|
|
@ -197,6 +200,7 @@ async def wastepaste(_, message):
|
|||
pasted = f"**Successfully pasted your data to YasirBin<a href='{url}'>.</a>\n\nPaste by {uname}**"
|
||||
await editPesan(msg, pasted, reply_markup=InlineKeyboardMarkup(button))
|
||||
|
||||
|
||||
# Nekobin Paste
|
||||
@app.on_message(filters.command(["neko"], COMMAND_HANDLER))
|
||||
async def nekopaste(_, message):
|
||||
|
|
@ -253,6 +257,7 @@ async def nekopaste(_, message):
|
|||
pasted = f"**Successfully pasted your data to Nekobin<a href='{url}'>.</a>\n\nPaste by {uname}**"
|
||||
await editPesan(msg, pasted, reply_markup=InlineKeyboardMarkup(button))
|
||||
|
||||
|
||||
# Paste as spacebin
|
||||
@app.on_message(filters.command(["sbin"], COMMAND_HANDLER))
|
||||
async def spacebinn(_, message):
|
||||
|
|
@ -295,9 +300,9 @@ async def spacebinn(_, message):
|
|||
|
||||
try:
|
||||
siteurl = "https://spaceb.in/api/v1/documents/"
|
||||
response = await http.post(siteurl, data={"content": data, "extension": 'txt'})
|
||||
response = await http.post(siteurl, data={"content": data, "extension": "txt"})
|
||||
response = response.json()
|
||||
url = "https://spaceb.in/"+response['payload']['id']
|
||||
url = "https://spaceb.in/" + response["payload"]["id"]
|
||||
except Exception as e:
|
||||
return await editPesan(msg, f"ERROR: {e}")
|
||||
|
||||
|
|
@ -311,6 +316,7 @@ async def spacebinn(_, message):
|
|||
pasted = f"**Successfully pasted your data to Spacebin<a href='{url}'>.</a>\n\nPaste by {uname}**"
|
||||
await editPesan(msg, pasted, reply_markup=InlineKeyboardMarkup(button))
|
||||
|
||||
|
||||
# Rentry paste
|
||||
@app.on_message(filters.command(["rentry"], COMMAND_HANDLER))
|
||||
async def rentrypaste(_, message):
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@ from misskaty.vars import COMMAND_HANDLER
|
|||
|
||||
PYPI_DICT = {}
|
||||
|
||||
|
||||
async def getDataPypi(msg, kueri, CurrentPage, user):
|
||||
if not PYPI_DICT.get(msg.id):
|
||||
pypijson = (await http.get(f'https://yasirapi.eu.org/pypi?q={kueri}')).json()
|
||||
pypijson = (await http.get(f"https://yasirapi.eu.org/pypi?q={kueri}")).json()
|
||||
if not pypijson.get("result"):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, 0, None
|
||||
|
|
@ -30,40 +31,38 @@ async def getDataPypi(msg, kueri, CurrentPage, user):
|
|||
pypiResult = f"<b>#Pypi Results For:</b> <code>{kueri}</code>\n\n"
|
||||
for c, i in enumerate(PYPI_DICT[msg.id][0][index], start=1):
|
||||
pypiResult += f"<b>{c}.</b> <a href='{i['url']}'>{i['name']} {i['version']}</a>\n<b>Created:</b> <code>{i['created']}</code>\n<b>Desc:</b> <code>{i['description']}</code>\n\n"
|
||||
extractbtn.append(
|
||||
InlineButton(c, f"pypidata#{CurrentPage}#{c}#{user}#{msg.id}")
|
||||
)
|
||||
IGNORE_CHAR = "[]"
|
||||
pypiResult = ''.join(i for i in pypiResult if not i in IGNORE_CHAR)
|
||||
extractbtn.append(InlineButton(c, f"pypidata#{CurrentPage}#{c}#{user}#{msg.id}"))
|
||||
pypiResult = "".join(i for i in pypiResult if i not in "[]")
|
||||
return pypiResult, PageLen, extractbtn
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, 0, None
|
||||
|
||||
@app.on_message(filters.command(['pypi'], COMMAND_HANDLER))
|
||||
|
||||
@app.on_message(filters.command(["pypi"], COMMAND_HANDLER))
|
||||
async def pypi_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
return await kirimPesan(message, "Please add query after command. Ex: <code>/pypi pyrogram</code>")
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, getting data from pypi..", quote=True)
|
||||
CurrentPage = 1
|
||||
pypires, PageLen, btn = await getDataPypi(pesan, kueri, CurrentPage, message.from_user.id)
|
||||
if not pypires: return
|
||||
if not pypires:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_pypi#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_pypi#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Get Info ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, pypires, reply_markup=keyboard)
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_pypi#' in query.data))
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_pypi#" in query.data))
|
||||
async def pypipage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = PYPI_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -75,31 +74,27 @@ async def pypipage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_pypi#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_pypi#{number}" + f"#{message_id}#{callback_query.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
await editPesan(callback_query.message, pypires, reply_markup=keyboard)
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'pypidata#' in query.data))
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "pypidata#" in query.data))
|
||||
async def pypi_getdata(_, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
if callback_query.from_user.id != int(callback_query.data.split("#")[3]):
|
||||
return await callback_query.answer("Not yours..", True)
|
||||
idlink = int(callback_query.data.split("#")[2])
|
||||
message_id = int(callback_query.data.split('#')[4])
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
message_id = int(callback_query.data.split("#")[4])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
pkgname = PYPI_DICT[message_id][0][CurrentPage - 1][idlink - 1].get("name")
|
||||
except KeyError:
|
||||
return await callback_query.answer("Invalid callback data, please send CMD again..")
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(
|
||||
InlineButton("↩️ Back", f"page_pypi#{CurrentPage}#{message_id}#{callback_query.from_user.id}"),
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("↩️ Back", f"page_pypi#{CurrentPage}#{message_id}#{callback_query.from_user.id}"), InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
try:
|
||||
html = await http.get(f"https://pypi.org/pypi/{pkgname}/json", headers=headers)
|
||||
res = html.json()
|
||||
|
|
@ -114,7 +109,7 @@ async def pypi_getdata(_, callback_query):
|
|||
msg += f"<b>Requires Python:</b> {res['info'].get('requires_python', 'Unknown')}\n"
|
||||
msg += f"<b>HomePage:</b> {res['info'].get('home_page', 'Unknown')}\n"
|
||||
msg += f"<b>Bug Track:</b> {res['info'].get('vulnerabilities', 'Unknown')}\n"
|
||||
if res['info'].get('project_urls'):
|
||||
if res["info"].get("project_urls"):
|
||||
msg += f"<b>Docs Url:</b> {res['info']['project_urls'].get('Documentation', 'Unknown')}\n"
|
||||
msg += f"<b>Description:</b> {res['info'].get('summary', 'Unknown')}\n"
|
||||
msg += f"<b>Pip Command:</b> pip3 install {res['info'].get('name', 'Unknown')}\n"
|
||||
|
|
|
|||
|
|
@ -12,13 +12,15 @@ This feature inspired from SangMata Bot. I'm created simple detection to check u
|
|||
/sangmata_set [on/off] - Enable/disable sangmata in groups.
|
||||
"""
|
||||
|
||||
|
||||
# Check user that change first_name, last_name and usernaname
|
||||
@app.on_message(
|
||||
filters.group & ~filters.bot & ~filters.via_bot,
|
||||
group=3,
|
||||
)
|
||||
async def cek_mataa(_, m):
|
||||
if not await is_sangmata_on(m.chat.id): return
|
||||
if not await is_sangmata_on(m.chat.id):
|
||||
return
|
||||
if not await cek_userdata(m.from_user.id):
|
||||
return await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
||||
username, first_name, last_name = await get_userdata(m.from_user.id)
|
||||
|
|
@ -37,9 +39,8 @@ async def cek_mataa(_, m):
|
|||
if msg != "":
|
||||
await kirimPesan(m, msg, quote=True)
|
||||
|
||||
@app.on_message(
|
||||
filters.group & filters.command("sangmata_set", COMMAND_HANDLER) & ~filters.bot & ~filters.via_bot
|
||||
)
|
||||
|
||||
@app.on_message(filters.group & filters.command("sangmata_set", COMMAND_HANDLER) & ~filters.bot & ~filters.via_bot)
|
||||
@adminsOnly("can_change_info")
|
||||
async def set_mataa(_, m):
|
||||
if len(m.command) == 1:
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
from ast import Delete
|
||||
import traceback
|
||||
from logging import getLogger
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.errors import (ApiIdInvalid, PasswordHashInvalid,
|
||||
PhoneCodeExpired, PhoneCodeInvalid,
|
||||
PhoneNumberInvalid, SessionPasswordNeeded)
|
||||
from pyrogram.errors import ApiIdInvalid, PasswordHashInvalid, PhoneCodeExpired, PhoneCodeInvalid, PhoneNumberInvalid, SessionPasswordNeeded
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from telethon import TelegramClient
|
||||
from telethon.errors import (ApiIdInvalidError, PasswordHashInvalidError,
|
||||
PhoneCodeExpiredError, PhoneCodeInvalidError,
|
||||
PhoneNumberInvalidError,
|
||||
SessionPasswordNeededError)
|
||||
from telethon.errors import ApiIdInvalidError, PasswordHashInvalidError, PhoneCodeExpiredError, PhoneCodeInvalidError, PhoneNumberInvalidError, SessionPasswordNeededError
|
||||
from telethon.sessions import StringSession
|
||||
|
||||
from misskaty import app
|
||||
|
|
@ -37,11 +31,8 @@ buttons_ques = [
|
|||
],
|
||||
]
|
||||
|
||||
gen_button = [
|
||||
[
|
||||
InlineKeyboardButton(text="🙄 Generate Session 🙄", callback_data="genstring")
|
||||
]
|
||||
]
|
||||
gen_button = [[InlineKeyboardButton(text="🙄 Generate Session 🙄", callback_data="genstring")]]
|
||||
|
||||
|
||||
async def is_batal(msg):
|
||||
if msg.text == "/cancel":
|
||||
|
|
@ -55,6 +46,7 @@ async def is_batal(msg):
|
|||
else:
|
||||
return False
|
||||
|
||||
|
||||
@app.on_callback_query(filters.regex(pattern=r"^(genstring|pyrogram|pyrogram_bot|telethon_bot|telethon)$"))
|
||||
async def callbackgenstring(bot, callback_query):
|
||||
query = callback_query.matches[0].group(1)
|
||||
|
|
@ -77,25 +69,21 @@ async def callbackgenstring(bot, callback_query):
|
|||
await generate_session(bot, callback_query.message, telethon=True)
|
||||
except Exception as e:
|
||||
LOGGER.error(traceback.format_exc())
|
||||
ERROR_MESSAGE = "Something went wrong. \n\n**ERROR** : {} " \
|
||||
"\n\n**Please forward this message to my Owner**, if this message " \
|
||||
"doesn't contain any sensitive data " \
|
||||
"because this error is **not logged by bot.** !"
|
||||
ERROR_MESSAGE = "Something went wrong. \n\n**ERROR** : {} " "\n\n**Please forward this message to my Owner**, if this message " "doesn't contain any sensitive data " "because this error is **not logged by bot.** !"
|
||||
await callback_query.message.reply(ERROR_MESSAGE.format(str(e)))
|
||||
|
||||
|
||||
@app.on_message(filters.private & ~filters.forwarded & filters.command("genstring", COMMAND_HANDLER))
|
||||
async def genstringg(_, msg):
|
||||
await msg.reply(ask_ques, reply_markup=InlineKeyboardMarkup(buttons_ques))
|
||||
|
||||
|
||||
async def generate_session(bot, msg, telethon=False, is_bot: bool = False):
|
||||
if telethon:
|
||||
ty = "Telethon"
|
||||
else:
|
||||
ty = "Pyrogram"
|
||||
ty = "Telethon" if telethon else "Pyrogram"
|
||||
if is_bot:
|
||||
ty += " Bot"
|
||||
await msg.reply(f"» Trying to start **{ty}** session generator...")
|
||||
user_id = msg.chat.id
|
||||
msg.chat.id
|
||||
api_id_msg = await msg.chat.ask("Please send your **API_ID** to proceed.\n\nClick on /skip for using bot's api.", filters=filters.text)
|
||||
if await is_batal(api_id_msg):
|
||||
return
|
||||
|
|
@ -114,10 +102,7 @@ async def generate_session(bot, msg, telethon=False, is_bot: bool = False):
|
|||
return
|
||||
api_hash = api_hash_msg.text
|
||||
await api_hash_msg.delete()
|
||||
if not is_bot:
|
||||
t = "» Please send your **PHONE_NUMBER** with country code for which you want generate session. \nᴇxᴀᴍᴩʟᴇ : `+6286356837789`'"
|
||||
else:
|
||||
t = "Please send your **BOT_TOKEN** to continue.\nExample : `5432198765:abcdanonymousterabaaplol`'"
|
||||
t = "Please send your **BOT_TOKEN** to continue.\nExample : `5432198765:abcdanonymousterabaaplol`'" if is_bot else "» Please send your **PHONE_NUMBER** with country code for which you want generate session. \nᴇxᴀᴍᴩʟᴇ : `+6286356837789`'"
|
||||
phone_number_msg = await msg.chat.ask(t, filters=filters.text)
|
||||
if await is_batal(phone_number_msg):
|
||||
return
|
||||
|
|
@ -127,9 +112,7 @@ async def generate_session(bot, msg, telethon=False, is_bot: bool = False):
|
|||
await msg.reply("» Trying to send OTP at the given number...")
|
||||
else:
|
||||
await msg.reply("» Trying to login using Bot Token...")
|
||||
if telethon and is_bot:
|
||||
client = TelegramClient(StringSession(), api_id, api_hash)
|
||||
elif telethon:
|
||||
if telethon and is_bot or telethon:
|
||||
client = TelegramClient(StringSession(), api_id, api_hash)
|
||||
elif is_bot:
|
||||
client = Client(name="bot", api_id=api_id, api_hash=api_hash, bot_token=phone_number, in_memory=True)
|
||||
|
|
@ -190,8 +173,7 @@ async def generate_session(bot, msg, telethon=False, is_bot: bool = False):
|
|||
except (PasswordHashInvalid, PasswordHashInvalidError):
|
||||
await two_step_msg.reply("» The password you've sent is wrong.\n\nPlease start generating session again.", quote=True, reply_markup=InlineKeyboardMarkup(gen_button))
|
||||
return
|
||||
else:
|
||||
if telethon:
|
||||
elif telethon:
|
||||
await client.start(bot_token=phone_number)
|
||||
else:
|
||||
await client.sign_in_bot(phone_number)
|
||||
|
|
@ -208,4 +190,7 @@ async def generate_session(bot, msg, telethon=False, is_bot: bool = False):
|
|||
except KeyError:
|
||||
pass
|
||||
await client.disconnect()
|
||||
await bot.send_message(msg.chat.id, "» Successfully generated your {} String Session.\n\nPlease check saved messages to get it ! \n\n**A String Generator bot by ** @IAmCuteCodes".format("Telethon" if telethon else "Pyrogram"))
|
||||
await bot.send_message(
|
||||
msg.chat.id,
|
||||
f'» Successfully generated your {"Telethon" if telethon else "Pyrogram"} String Session.\n\nPlease check saved messages to get it ! \n\n**A String Generator bot by ** @IAmCuteCodes',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,8 @@ from pyrogram import emoji, filters, enums
|
|||
from pyrogram.errors import BadRequest, PeerIdInvalid, StickersetInvalid
|
||||
from pyrogram.file_id import FileId
|
||||
from pyrogram.raw.functions.messages import GetStickerSet, SendMedia
|
||||
from pyrogram.raw.functions.stickers import (AddStickerToSet, CreateStickerSet,
|
||||
RemoveStickerFromSet)
|
||||
from pyrogram.raw.types import (DocumentAttributeFilename, InputDocument,
|
||||
InputMediaUploadedDocument,
|
||||
InputStickerSetItem, InputStickerSetShortName)
|
||||
from pyrogram.raw.functions.stickers import AddStickerToSet, CreateStickerSet, RemoveStickerFromSet
|
||||
from pyrogram.raw.types import DocumentAttributeFilename, InputDocument, InputMediaUploadedDocument, InputStickerSetItem, InputStickerSetShortName
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
|
||||
from misskaty import BOT_USERNAME, app
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
"""
|
||||
import json
|
||||
import os
|
||||
import traceback
|
||||
from logging import getLogger
|
||||
from re import I
|
||||
from re import split as ngesplit
|
||||
|
|
@ -157,7 +156,7 @@ async def stream_extract(bot, update):
|
|||
start_time = perf_counter()
|
||||
namafile = get_subname(lang, link, format)
|
||||
LOGGER.info(f"ExtractSub: {namafile} by {update.from_user.first_name} [{update.from_user.id}]")
|
||||
extract = (await shell_exec(f"mediaextract -i {link} -map {map} '{namafile}'"))[0]
|
||||
(await shell_exec(f"mediaextract -i {link} -map {map} '{namafile}'"))[0]
|
||||
end_time = perf_counter()
|
||||
timelog = "{:.2f}".format(end_time - start_time) + " second"
|
||||
c_time = time()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ from misskaty.vars import COMMAND_HANDLER
|
|||
|
||||
@app.on_message(filters.command(["session"], COMMAND_HANDLER))
|
||||
async def session(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
nama = await message.chat.ask("Ketik nama kamu:")
|
||||
umur = await message.chat.ask("Ketik umur kamu")
|
||||
alamat = await message.chat.ask("Ketik alamat kamu:")
|
||||
|
|
|
|||
|
|
@ -8,85 +8,54 @@ from misskaty.vars import COMMAND_HANDLER
|
|||
|
||||
|
||||
async def getData(chat_id, message_id, GetWord, CurrentPage):
|
||||
UDJson = (await http.get(
|
||||
f'https://api.urbandictionary.com/v0/define?term={GetWord}')).json()
|
||||
UDJson = (await http.get(f"https://api.urbandictionary.com/v0/define?term={GetWord}")).json()
|
||||
|
||||
if not 'list' in UDJson:
|
||||
CNMessage = await app.send_message(
|
||||
chat_id=chat_id,
|
||||
reply_to_message_id=message_id,
|
||||
text=(
|
||||
f"Word: {GetWord}\n"
|
||||
"Results: Sorry could not find any matching results!"
|
||||
)
|
||||
)
|
||||
if "list" not in UDJson:
|
||||
CNMessage = await app.send_message(chat_id=chat_id, reply_to_message_id=message_id, text=(f"Word: {GetWord}\n" "Results: Sorry could not find any matching results!"))
|
||||
await asyncio.sleep(5)
|
||||
await CNMessage.delete()
|
||||
return
|
||||
try:
|
||||
index = int(CurrentPage - 1)
|
||||
PageLen = len(UDJson['list'])
|
||||
PageLen = len(UDJson["list"])
|
||||
|
||||
UDReasult = (
|
||||
f"**Definition of {GetWord}**\n"
|
||||
f"{UDJson['list'][index]['definition']}\n\n"
|
||||
"**📌 Examples**\n"
|
||||
f"__{UDJson['list'][index]['example']}__"
|
||||
)
|
||||
UDReasult = f"**Definition of {GetWord}**\n" f"{UDJson['list'][index]['definition']}\n\n" "**📌 Examples**\n" f"__{UDJson['list'][index]['example']}__"
|
||||
|
||||
INGNORE_CHAR = "[]"
|
||||
UDFReasult = ''.join(i for i in UDReasult if not i in INGNORE_CHAR)
|
||||
UDFReasult = "".join(i for i in UDReasult if i not in "[]")
|
||||
|
||||
return (
|
||||
UDFReasult,
|
||||
PageLen
|
||||
)
|
||||
return (UDFReasult, PageLen)
|
||||
|
||||
except (
|
||||
IndexError
|
||||
or KeyError
|
||||
):
|
||||
CNMessage = await app.send_message(
|
||||
chat_id=chat_id,
|
||||
reply_to_message_id=message_id,
|
||||
text=(
|
||||
f"Word: {GetWord}\n"
|
||||
"Results: Sorry could not find any matching results!"
|
||||
)
|
||||
)
|
||||
except IndexError or KeyError:
|
||||
CNMessage = await app.send_message(chat_id=chat_id, reply_to_message_id=message_id, text=(f"Word: {GetWord}\n" "Results: Sorry could not find any matching results!"))
|
||||
await asyncio.sleep(5)
|
||||
await CNMessage.delete()
|
||||
|
||||
@app.on_message(filters.command(['ud'], COMMAND_HANDLER))
|
||||
|
||||
@app.on_message(filters.command(["ud"], COMMAND_HANDLER))
|
||||
async def urbanDictionary(client, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
message_id = message.id
|
||||
chat_id = message.chat.id
|
||||
GetWord = ' '.join(message.command[1:])
|
||||
GetWord = " ".join(message.command[1:])
|
||||
if not GetWord:
|
||||
message = await message.chat.ask(
|
||||
'Now give any word for query!',
|
||||
identifier=(message.from_user.id, message.from_user.id, None)
|
||||
)
|
||||
message = await message.chat.ask("Now give any word for query!", identifier=(message.from_user.id, message.from_user.id, None))
|
||||
GetWord = message.text
|
||||
|
||||
CurrentPage = 1
|
||||
UDReasult, PageLen = await getData(chat_id, message_id, GetWord, CurrentPage)
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'pagination_urban#{number}' + f'#{GetWord}')
|
||||
await message.reply(
|
||||
text=f"{UDReasult}",
|
||||
reply_markup=keyboard
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "pagination_urban#{number}" + f"#{GetWord}")
|
||||
await message.reply(text=f"{UDReasult}", reply_markup=keyboard)
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'pagination_urban#' in query.data))
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "pagination_urban#" in query.data))
|
||||
async def ud_callback(client, callback_query):
|
||||
|
||||
message_id = callback_query.message.id
|
||||
chat_id = callback_query.message.chat.id
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
GetWord = callback_query.data.split('#')[2]
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
GetWord = callback_query.data.split("#")[2]
|
||||
|
||||
try:
|
||||
UDReasult, PageLen = await getData(chat_id, message_id, GetWord, CurrentPage)
|
||||
|
|
@ -94,10 +63,5 @@ async def ud_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'pagination_urban#{number}' + f'#{GetWord}')
|
||||
await app.edit_message_text(
|
||||
chat_id=chat_id,
|
||||
message_id=message_id,
|
||||
text=UDReasult,
|
||||
reply_markup=keyboard
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "pagination_urban#{number}" + f"#{GetWord}")
|
||||
await app.edit_message_text(chat_id=chat_id, message_id=message_id, text=UDReasult, reply_markup=keyboard)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import logging
|
|||
from bs4 import BeautifulSoup
|
||||
from pykeyboard import InlineKeyboard, InlineButton
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from misskaty.helper.http import http
|
||||
from misskaty.helper.kuso_utils import Kusonime
|
||||
from misskaty import app
|
||||
|
|
@ -36,6 +35,7 @@ LOGGER = logging.getLogger(__name__)
|
|||
SCRAP_DICT = {}
|
||||
data_kuso = {}
|
||||
|
||||
|
||||
def split_arr(arr, size: 5):
|
||||
arrs = []
|
||||
while len(arr) > size:
|
||||
|
|
@ -45,13 +45,14 @@ def split_arr(arr, size: 5):
|
|||
arrs.append(arr)
|
||||
return arrs
|
||||
|
||||
|
||||
# Terbit21 GetData
|
||||
async def getDataTerbit21(msg, kueri, CurrentPage):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
if not kueri:
|
||||
terbitjson = (await http.get('https://yasirapi.eu.org/terbit21')).json()
|
||||
terbitjson = (await http.get("https://yasirapi.eu.org/terbit21")).json()
|
||||
else:
|
||||
terbitjson = (await http.get(f'https://yasirapi.eu.org/terbit21?q={kueri}')).json()
|
||||
terbitjson = (await http.get(f"https://yasirapi.eu.org/terbit21?q={kueri}")).json()
|
||||
if not terbitjson.get("result"):
|
||||
await editPesan(msg, "Sorry, could not find any results!")
|
||||
return None, None
|
||||
|
|
@ -68,19 +69,20 @@ async def getDataTerbit21(msg, kueri, CurrentPage):
|
|||
TerbitRes += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Category:</b> <code>{i['kategori']}</code>\n"
|
||||
TerbitRes += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"💠 <b><a href='{i['dl']}'>Download</a></b>\n\n"
|
||||
IGNORE_CHAR = "[]"
|
||||
TerbitRes = ''.join(i for i in TerbitRes if not i in IGNORE_CHAR)
|
||||
TerbitRes = "".join(i for i in TerbitRes if not i in IGNORE_CHAR)
|
||||
return TerbitRes, PageLen
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry, could not find any results!")
|
||||
return None, None
|
||||
|
||||
|
||||
# LK21 GetData
|
||||
async def getDatalk21(msg, kueri, CurrentPage):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
if not kueri:
|
||||
lk21json = (await http.get('https://yasirapi.eu.org/lk21')).json()
|
||||
lk21json = (await http.get("https://yasirapi.eu.org/lk21")).json()
|
||||
else:
|
||||
lk21json = (await http.get(f'https://yasirapi.eu.org/lk21?q={kueri}')).json()
|
||||
lk21json = (await http.get(f"https://yasirapi.eu.org/lk21?q={kueri}")).json()
|
||||
if not lk21json.get("result"):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, None
|
||||
|
|
@ -97,16 +99,17 @@ async def getDatalk21(msg, kueri, CurrentPage):
|
|||
lkResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Category:</b> <code>{i['kategori']}</code>\n"
|
||||
lkResult += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"💠 <b><a href='{i['dl']}'>Download</a></b>\n\n"
|
||||
IGNORE_CHAR = "[]"
|
||||
lkResult = ''.join(i for i in lkResult if not i in IGNORE_CHAR)
|
||||
lkResult = "".join(i for i in lkResult if not i in IGNORE_CHAR)
|
||||
return lkResult, PageLen
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, None
|
||||
|
||||
|
||||
# Pahe GetData
|
||||
async def getDataPahe(msg, kueri, CurrentPage):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
pahejson = (await http.get(f'https://yasirapi.eu.org/pahe?q={kueri}')).json()
|
||||
pahejson = (await http.get(f"https://yasirapi.eu.org/pahe?q={kueri}")).json()
|
||||
if not pahejson.get("result"):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, None
|
||||
|
|
@ -118,18 +121,18 @@ async def getDataPahe(msg, kueri, CurrentPage):
|
|||
paheResult = f"<b>#Pahe Results For:</b> <code>{kueri}</code>\n\n" if kueri else f"<b>#Pahe Latest:</b>\n🌀 Use /pahe [title] to start search with title.\n\n"
|
||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
paheResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n\n"
|
||||
IGNORE_CHAR = "[]"
|
||||
paheResult = ''.join(i for i in paheResult if not i in IGNORE_CHAR)
|
||||
paheResult = "".join(i for i in paheResult if i not in "[]")
|
||||
return paheResult, 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):
|
||||
kusodata = []
|
||||
data = await http.get(f'https://kusonime.com/?s={kueri}', headers=headers)
|
||||
data = await http.get(f"https://kusonime.com/?s={kueri}", headers=headers)
|
||||
res = BeautifulSoup(data.text, "lxml").find_all("h2", {"class": "episodeye"})
|
||||
for i in res:
|
||||
ress = i.find_all("a")[0]
|
||||
|
|
@ -150,25 +153,21 @@ async def getDataKuso(msg, kueri, CurrentPage, user):
|
|||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
kusoResult += f"<b>{c}</b>. {i['title']}\n{i['link']}\n\n"
|
||||
if c < 6:
|
||||
extractbtn1.append(
|
||||
InlineButton(c, f"kusoextract#{CurrentPage}#{c}#{user}#{msg.id}")
|
||||
)
|
||||
extractbtn1.append(InlineButton(c, f"kusoextract#{CurrentPage}#{c}#{user}#{msg.id}"))
|
||||
else:
|
||||
extractbtn2.append(
|
||||
InlineButton(c, f"kusoextract#{CurrentPage}#{c}#{user}#{msg.id}")
|
||||
)
|
||||
IGNORE_CHAR = "[]"
|
||||
kusoResult = ''.join(i for i in kusoResult if not i in IGNORE_CHAR)
|
||||
extractbtn2.append(InlineButton(c, f"kusoextract#{CurrentPage}#{c}#{user}#{msg.id}"))
|
||||
kusoResult = "".join(i for i in kusoResult if i not in "[]")
|
||||
return kusoResult, PageLen, extractbtn1, extractbtn2
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, 0, None, None
|
||||
|
||||
|
||||
# Movieku GetData
|
||||
async def getDataMovieku(msg, kueri, CurrentPage):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
moviekudata = []
|
||||
data = await http.get(f'https://107.152.37.223/?s={kueri}', headers=headers)
|
||||
data = await http.get(f"https://107.152.37.223/?s={kueri}", headers=headers)
|
||||
r = BeautifulSoup(data.text, "lxml")
|
||||
res = r.find_all(class_="bx")
|
||||
for i in res:
|
||||
|
|
@ -188,24 +187,23 @@ async def getDataMovieku(msg, kueri, CurrentPage):
|
|||
moviekuResult = f"<b>#Movieku Latest:</b>\n🌀 Use /movieku [title] to start search with title.\n\n" if kueri == "" else f"<b>#Movieku Results For:</b> <code>{kueri}</code>\n\n"
|
||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
moviekuResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Quality/Status:</b> {i['type']}\n<b>Extract:</b> <code>/movieku_scrap {i['link']}</code>\n\n"
|
||||
IGNORE_CHAR = "[]"
|
||||
moviekuResult = ''.join(i for i in moviekuResult if not i in IGNORE_CHAR)
|
||||
moviekuResult = "".join(i for i in moviekuResult if i not in "[]")
|
||||
return moviekuResult, PageLen
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, None
|
||||
|
||||
|
||||
# Savefilm21 GetData
|
||||
async def getDataSavefilm21(msg, kueri, CurrentPage, user):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
sfdata = []
|
||||
data = await http.get(f'https://185.99.135.215/?s={kueri}', headers=headers)
|
||||
data = await http.get(f"https://185.99.135.215/?s={kueri}", headers=headers)
|
||||
text = BeautifulSoup(data.text, "lxml")
|
||||
entry = text.find_all(class_="entry-header")
|
||||
if "Tidak Ditemukan" in entry[0].text:
|
||||
if not kueri:
|
||||
await editPesan(msg, "Sorry, could not find any result")
|
||||
return None, 0, None
|
||||
else:
|
||||
await editPesan(msg, f"Sorry, could not find any result for: {kueri}")
|
||||
return None, 0, None
|
||||
|
|
@ -223,20 +221,18 @@ async def getDataSavefilm21(msg, kueri, CurrentPage, user):
|
|||
sfResult = f"<b>#SaveFilm21 Latest:</b>\n🌀 Use /savefilm21 [title] to start search with title.\n\n" if kueri == "" else f"<b>#Savefilm21 Results For:</b> <code>{kueri}</code>\n\n"
|
||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
sfResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Genre:</b> {i['genre']}\n\n"
|
||||
extractbtn.append(
|
||||
InlineButton(c, f"sf21extract#{CurrentPage}#{c}#{user}#{msg.id}")
|
||||
)
|
||||
IGNORE_CHAR = "[]"
|
||||
sfResult = ''.join(i for i in sfResult if not i in IGNORE_CHAR)
|
||||
extractbtn.append(InlineButton(c, f"sf21extract#{CurrentPage}#{c}#{user}#{msg.id}"))
|
||||
sfResult = "".join(i for i in sfResult if i not in "[]")
|
||||
return sfResult, PageLen, extractbtn
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, 0, None
|
||||
|
||||
|
||||
# Lendrive GetData
|
||||
async def getDataLendrive(msg, kueri, CurrentPage, user):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
data = await http.get(f'https://lendrive.web.id/?s={kueri}', headers=headers)
|
||||
data = await http.get(f"https://lendrive.web.id/?s={kueri}", headers=headers)
|
||||
soup = BeautifulSoup(data.text, "lxml")
|
||||
lenddata = []
|
||||
for o in soup.find_all(class_="bsx"):
|
||||
|
|
@ -257,20 +253,18 @@ async def getDataLendrive(msg, kueri, CurrentPage, user):
|
|||
lenddataResult = f"<b>#LenDrive Latest:</b>\n🌀 Use /lendrive [title] to start search with title.\n\n" if kueri == "" else f"<b>#LenDrive Results For:</b> <code>{kueri}</code>\n\n"
|
||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
lenddataResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Quality:</b> {i['quality']}\n<b>Status:</b> {i['status']}\n\n"
|
||||
extractbtn.append(
|
||||
InlineButton(c, f"lendriveextract#{CurrentPage}#{c}#{user}#{msg.id}")
|
||||
)
|
||||
IGNORE_CHAR = "[]"
|
||||
lenddataResult = ''.join(i for i in lenddataResult if not i in IGNORE_CHAR)
|
||||
extractbtn.append(InlineButton(c, f"lendriveextract#{CurrentPage}#{c}#{user}#{msg.id}"))
|
||||
lenddataResult = "".join(i for i in lenddataResult if i not in "[]")
|
||||
return lenddataResult, PageLen, extractbtn
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, 0, None
|
||||
|
||||
|
||||
# MelongMovie GetData
|
||||
async def getDataMelong(msg, kueri, CurrentPage, user):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
data = await http.get(f'http://167.99.31.48/?s={kueri}', headers=headers)
|
||||
data = await http.get(f"http://167.99.31.48/?s={kueri}", headers=headers)
|
||||
bs4 = BeautifulSoup(data.text, "lxml")
|
||||
melongdata = []
|
||||
for res in bs4.select(".box"):
|
||||
|
|
@ -294,26 +288,23 @@ async def getDataMelong(msg, kueri, CurrentPage, user):
|
|||
melongResult = f"<b>#MelongMovie Latest:</b>\n🌀 Use /melongmovie [title] to start search with title.\n\n" if kueri == "" else f"<b>#MelongMovie Results For:</b> <code>{kueri}</code>\n\n"
|
||||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
melongResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Quality:</b> {i['quality']}\n\n"
|
||||
extractbtn.append(
|
||||
InlineButton(c, f"melongextract#{CurrentPage}#{c}#{user}#{msg.id}")
|
||||
)
|
||||
IGNORE_CHAR = "[]"
|
||||
melongResult = ''.join(i for i in melongResult if not i in IGNORE_CHAR)
|
||||
extractbtn.append(InlineButton(c, f"melongextract#{CurrentPage}#{c}#{user}#{msg.id}"))
|
||||
melongResult = "".join(i for i in melongResult if i not in "[]")
|
||||
return melongResult, PageLen, extractbtn
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, 0, None
|
||||
|
||||
|
||||
# GoMov GetData
|
||||
async def getDataGomov(msg, kueri, CurrentPage, user):
|
||||
if not SCRAP_DICT.get(msg.id):
|
||||
gomovv = await http.get(f'https://185.173.38.216/?s={kueri}', headers=headers)
|
||||
gomovv = await http.get(f"https://185.173.38.216/?s={kueri}", headers=headers)
|
||||
text = BeautifulSoup(gomovv.text, "lxml")
|
||||
entry = text.find_all(class_="entry-header")
|
||||
if entry[0].text.strip() == "Nothing Found":
|
||||
if not kueri:
|
||||
await editPesan(msg, "Sorry, i could not find anything.")
|
||||
return None, 0, None
|
||||
else:
|
||||
await editPesan(msg, f"Sorry, i could not find query: {kueri}")
|
||||
return None, 0, None
|
||||
|
|
@ -334,191 +325,189 @@ async def getDataGomov(msg, kueri, CurrentPage, user):
|
|||
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||
gomovResult += f"<b>{c}. <a href='{i['link']}'>{i['judul']}</a></b>\n<b>Genre:</b> <code>{i['genre']}</code>\n\n"
|
||||
if not re.search(r"Series", i["genre"]):
|
||||
extractbtn.append(
|
||||
InlineButton(c, f"gomovextract#{CurrentPage}#{c}#{user}#{msg.id}")
|
||||
)
|
||||
extractbtn.append(InlineButton(c, f"gomovextract#{CurrentPage}#{c}#{user}#{msg.id}"))
|
||||
gomovResult += "Some result will not appear in extract button because unsupported link."
|
||||
IGNORE_CHAR = "[]"
|
||||
gomovResult = ''.join(i for i in gomovResult if not i in IGNORE_CHAR)
|
||||
gomovResult = "".join(i for i in gomovResult if i not in "[]")
|
||||
return gomovResult, PageLen, extractbtn
|
||||
except (IndexError, KeyError):
|
||||
await editPesan(msg, "Sorry could not find any matching results!")
|
||||
return None, 0, None
|
||||
|
||||
|
||||
# Terbit21 CMD
|
||||
@app.on_message(filters.command(['terbit21'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["terbit21"], COMMAND_HANDLER))
|
||||
async def terbit21_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = None
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Terbit21..", quote=True)
|
||||
CurrentPage = 1
|
||||
terbitres, PageLen = await getDataTerbit21(pesan, kueri, CurrentPage)
|
||||
if not terbitres: return
|
||||
if not terbitres:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_terbit21#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_terbit21#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, terbitres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# LK21 CMD
|
||||
@app.on_message(filters.command(['lk21'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["lk21"], COMMAND_HANDLER))
|
||||
async def lk21_s(client, message):
|
||||
chat_id = message.chat.id
|
||||
kueri = ' '.join(message.command[1:])
|
||||
message.chat.id
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = None
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from LK21..", quote=True)
|
||||
CurrentPage = 1
|
||||
lkres, PageLen = await getDatalk21(pesan, kueri, CurrentPage)
|
||||
if not lkres: return
|
||||
if not lkres:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_lk21#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_lk21#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, lkres, disable_web_page_preview=True, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Pahe CMD
|
||||
@app.on_message(filters.command(['pahe'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["pahe"], COMMAND_HANDLER))
|
||||
async def pahe_s(client, message):
|
||||
chat_id = message.chat.id
|
||||
kueri = ' '.join(message.command[1:])
|
||||
message.chat.id
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Pahe Web..", quote=True)
|
||||
CurrentPage = 1
|
||||
paheres, PageLen = await getDataPahe(pesan, kueri, CurrentPage)
|
||||
if not paheres: return
|
||||
if not paheres:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_pahe#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_pahe#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, paheres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Gomov CMD
|
||||
@app.on_message(filters.command(['gomov'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["gomov"], COMMAND_HANDLER))
|
||||
async def gomov_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data Gomov Web..", quote=True)
|
||||
CurrentPage = 1
|
||||
gomovres, PageLen, btn = await getDataGomov(pesan, kueri, CurrentPage, message.from_user.id)
|
||||
if not gomovres: return
|
||||
if not gomovres:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_gomov#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_gomov#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, gomovres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# MelongMovie CMD
|
||||
@app.on_message(filters.command(['melongmovie'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["melongmovie"], COMMAND_HANDLER))
|
||||
async def melong_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Melongmovie..", quote=True)
|
||||
CurrentPage = 1
|
||||
melongres, PageLen, btn = await getDataMelong(pesan, kueri, CurrentPage, message.from_user.id)
|
||||
if not melongres: return
|
||||
if not melongres:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_melong#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_melong#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, melongres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Savefilm21 CMD
|
||||
@app.on_message(filters.command(['savefilm21'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["savefilm21"], COMMAND_HANDLER))
|
||||
async def savefilm_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Savefilm21..", quote=True)
|
||||
CurrentPage = 1
|
||||
savefilmres, PageLen, btn = await getDataSavefilm21(pesan, kueri, CurrentPage, message.from_user.id)
|
||||
if not savefilmres: return
|
||||
if not savefilmres:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_savefilm#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_savefilm#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, savefilmres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Kusonime CMD
|
||||
@app.on_message(filters.command(['kusonime'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["kusonime"], COMMAND_HANDLER))
|
||||
async def kusonime_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Kusonime..", quote=True)
|
||||
CurrentPage = 1
|
||||
kusores, PageLen, btn1, btn2 = await getDataKuso(pesan, kueri, CurrentPage, message.from_user.id)
|
||||
if not kusores: return
|
||||
if not kusores:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_kuso#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_kuso#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn1)
|
||||
if btn2:
|
||||
keyboard.row(*btn2)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, kusores, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Lendrive CMD
|
||||
@app.on_message(filters.command(['lendrive'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["lendrive"], COMMAND_HANDLER))
|
||||
async def lendrive_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Lendrive..", quote=True)
|
||||
CurrentPage = 1
|
||||
lendres, PageLen, btn = await getDataLendrive(pesan, kueri, CurrentPage, message.from_user.id)
|
||||
if not lendres: return
|
||||
if not lendres:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_lendrive#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_lendrive#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, lendres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Movieku CMD
|
||||
@app.on_message(filters.command(['movieku'], COMMAND_HANDLER))
|
||||
@app.on_message(filters.command(["movieku"], COMMAND_HANDLER))
|
||||
async def movieku_s(client, message):
|
||||
kueri = ' '.join(message.command[1:])
|
||||
kueri = " ".join(message.command[1:])
|
||||
if not kueri:
|
||||
kueri = ""
|
||||
pesan = await kirimPesan(message, "⏳ Please wait, scraping data from Movieku..", quote=True)
|
||||
CurrentPage = 1
|
||||
moviekures, PageLen = await getDataMovieku(pesan, kueri, CurrentPage)
|
||||
if not moviekures: return
|
||||
if not moviekures:
|
||||
return
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_movieku#{number}' + f'#{pesan.id}#{message.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{message.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_movieku#{number}" + f"#{pesan.id}#{message.from_user.id}")
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{message.from_user.id}"))
|
||||
await editPesan(pesan, moviekures, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Savefillm21 Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_savefilm#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_savefilm#" in query.data))
|
||||
async def savefilmpage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -530,21 +519,20 @@ async def savefilmpage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_savefilm#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_savefilm#{number}" + f"#{message_id}#{callback_query.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
await editPesan(callback_query.message, savefilmres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Kuso Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_kuso#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_kuso#" in query.data))
|
||||
async def kusopage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -556,23 +544,22 @@ async def kusopage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_kuso#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_kuso#{number}" + f"#{message_id}#{callback_query.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn1)
|
||||
if btn2:
|
||||
keyboard.row(*btn2)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
await editPesan(callback_query.message, kusores, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Lendrive Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_lendrive#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_lendrive#" in query.data))
|
||||
async def moviekupage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -584,21 +571,20 @@ async def moviekupage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_lendrive#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_lendrive#{number}" + f"#{message_id}#{callback_query.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
await editPesan(callback_query.message, lendres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Movieku Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_movieku#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_movieku#" in query.data))
|
||||
async def moviekupage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -610,19 +596,18 @@ async def moviekupage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_movieku#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_movieku#{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, moviekures, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Terbit21 Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_terbit21#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_terbit21#" in query.data))
|
||||
async def terbit21page_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -634,19 +619,18 @@ async def terbit21page_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_terbit21#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_terbit21#{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, terbitres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Page Callback Melong
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_melong#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_melong#" in query.data))
|
||||
async def melongpage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -658,21 +642,20 @@ async def melongpage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_melong#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_melong#{number}" + f"#{message_id}#{callback_query.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
await editPesan(callback_query.message, terbitres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Lk21 Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_lk21#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_lk21#" in query.data))
|
||||
async def lk21page_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -684,19 +667,18 @@ async def lk21page_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_lk21#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_lk21#{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, lkres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Pahe Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_pahe#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_pahe#" in query.data))
|
||||
async def pahepage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -708,19 +690,18 @@ async def pahepage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_pahe#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_pahe#{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, lkres, reply_markup=keyboard)
|
||||
|
||||
|
||||
# Gomov Page Callback
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'page_gomov#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "page_gomov#" in query.data))
|
||||
async def gomovpage_callback(client, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
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])
|
||||
message_id = int(callback_query.data.split("#")[2])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
kueri = SCRAP_DICT[message_id][1]
|
||||
except KeyError:
|
||||
|
|
@ -732,23 +713,22 @@ async def gomovpage_callback(client, callback_query):
|
|||
return
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(PageLen, CurrentPage, 'page_gomov#{number}' + f'#{message_id}#{callback_query.from_user.id}')
|
||||
keyboard.paginate(PageLen, CurrentPage, "page_gomov#{number}" + f"#{message_id}#{callback_query.from_user.id}")
|
||||
keyboard.row(InlineButton("👇 Extract Data ", "Hmmm"))
|
||||
keyboard.row(*btn)
|
||||
keyboard.row(
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
await editPesan(callback_query.message, gomovres, reply_markup=keyboard)
|
||||
|
||||
|
||||
### Scrape DDL Link From Web ###
|
||||
# Kusonime DDL
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'kusoextract#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "kusoextract#" in query.data))
|
||||
async def kusonime_scrap(_, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
if callback_query.from_user.id != int(callback_query.data.split("#")[3]):
|
||||
return await callback_query.answer("Not yours..", True)
|
||||
idlink = int(callback_query.data.split("#")[2])
|
||||
message_id = int(callback_query.data.split('#')[4])
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
message_id = int(callback_query.data.split("#")[4])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
link = SCRAP_DICT[message_id][0][CurrentPage - 1][idlink - 1].get("link")
|
||||
except KeyError:
|
||||
|
|
@ -756,13 +736,9 @@ async def kusonime_scrap(_, callback_query):
|
|||
|
||||
kuso = Kusonime()
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(
|
||||
InlineButton("↩️ Back", f"page_kuso#{CurrentPage}#{message_id}#{callback_query.from_user.id}"),
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("↩️ Back", f"page_kuso#{CurrentPage}#{message_id}#{callback_query.from_user.id}"), InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
try:
|
||||
init_url = data_kuso.get(link, None)
|
||||
if init_url:
|
||||
if init_url := data_kuso.get(link, None):
|
||||
ph = init_url.get("ph_url")
|
||||
await editPesan(callback_query.message, f"<b>Scrape result from {link}</b>:\n\n{ph}", reply_markup=keyboard, disable_web_page_preview=False)
|
||||
return
|
||||
|
|
@ -776,24 +752,22 @@ async def kusonime_scrap(_, callback_query):
|
|||
data_kuso[link] = {"ph_url": tgh["url"]}
|
||||
await editPesan(callback_query.message, f"<b>Scrape result from</b> <code>{link}</code>:\n\n{tgh['url']}", reply_markup=keyboard, disable_web_page_preview=False)
|
||||
|
||||
|
||||
# Savefilm21 DDL
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'sf21extract#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "sf21extract#" in query.data))
|
||||
async def savefilm21_scrap(_, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
if callback_query.from_user.id != int(callback_query.data.split("#")[3]):
|
||||
return await callback_query.answer("Not yours..", True)
|
||||
idlink = int(callback_query.data.split("#")[2])
|
||||
message_id = int(callback_query.data.split('#')[4])
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
message_id = int(callback_query.data.split("#")[4])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
link = SCRAP_DICT[message_id][0][CurrentPage - 1][idlink - 1].get("link")
|
||||
except KeyError:
|
||||
return await callback_query.answer("Invalid callback data, please send CMD again..")
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(
|
||||
InlineButton("↩️ Back", f"page_savefilm#{CurrentPage}#{message_id}#{callback_query.from_user.id}"),
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("↩️ Back", f"page_savefilm#{CurrentPage}#{message_id}#{callback_query.from_user.id}"), InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
try:
|
||||
html = await http.get(link, headers=headers)
|
||||
soup = BeautifulSoup(html.text, "lxml")
|
||||
|
|
@ -829,24 +803,22 @@ async def muviku_scrap(_, message):
|
|||
except Exception as e:
|
||||
await message.reply(f"ERROR: {str(e)}")
|
||||
|
||||
|
||||
# Scrape DDL Link Melongmovie
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'melongextract#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "melongextract#" in query.data))
|
||||
async def melong_scrap(_, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
if callback_query.from_user.id != int(callback_query.data.split("#")[3]):
|
||||
return await callback_query.answer("Not yours..", True)
|
||||
idlink = int(callback_query.data.split("#")[2])
|
||||
message_id = int(callback_query.data.split('#')[4])
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
message_id = int(callback_query.data.split("#")[4])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
link = SCRAP_DICT[message_id][0][CurrentPage - 1][idlink - 1].get("link")
|
||||
except KeyError:
|
||||
return await callback_query.answer("Invalid callback data, please send CMD again..")
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(
|
||||
InlineButton("↩️ Back", f"page_melong#{CurrentPage}#{message_id}#{callback_query.from_user.id}"),
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("↩️ Back", f"page_melong#{CurrentPage}#{message_id}#{callback_query.from_user.id}"), InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
try:
|
||||
html = await http.get(link, headers=headers)
|
||||
soup = BeautifulSoup(html.text, "lxml")
|
||||
|
|
@ -860,24 +832,22 @@ async def melong_scrap(_, callback_query):
|
|||
return
|
||||
await editPesan(callback_query.message, f"<b>Scrape result from</b> <code>{link}</code>:\n\n{rep}", reply_markup=keyboard)
|
||||
|
||||
|
||||
# Scrape DDL Link Gomov
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'gomovextract#' in query.data))
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "gomovextract#" in query.data))
|
||||
async def gomov_dl(_, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
if callback_query.from_user.id != int(callback_query.data.split("#")[3]):
|
||||
return await callback_query.answer("Not yours..", True)
|
||||
idlink = int(callback_query.data.split("#")[2])
|
||||
message_id = int(callback_query.data.split('#')[4])
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
message_id = int(callback_query.data.split("#")[4])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
link = SCRAP_DICT[message_id][0][CurrentPage - 1][idlink - 1].get("link")
|
||||
except KeyError:
|
||||
return await callback_query.answer("Invalid callback data, please send CMD again..")
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(
|
||||
InlineButton("↩️ Back", f"page_gomov#{CurrentPage}#{message_id}#{callback_query.from_user.id}"),
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("↩️ Back", f"page_gomov#{CurrentPage}#{message_id}#{callback_query.from_user.id}"), InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
try:
|
||||
html = await http.get(link, headers=headers)
|
||||
soup = BeautifulSoup(html.text, "lxml")
|
||||
|
|
@ -892,23 +862,21 @@ async def gomov_dl(_, callback_query):
|
|||
return
|
||||
await editPesan(callback_query.message, f"<b>Scrape result from</b> <code>{link}</code>:\n\n{hasil}", reply_markup=keyboard)
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: 'lendriveextract#' in query.data))
|
||||
|
||||
@app.on_callback_query(filters.create(lambda _, __, query: "lendriveextract#" in query.data))
|
||||
async def lendrive_dl(_, callback_query):
|
||||
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
|
||||
if callback_query.from_user.id != int(callback_query.data.split("#")[3]):
|
||||
return await callback_query.answer("Not yours..", True)
|
||||
idlink = int(callback_query.data.split("#")[2])
|
||||
message_id = int(callback_query.data.split('#')[4])
|
||||
CurrentPage = int(callback_query.data.split('#')[1])
|
||||
message_id = int(callback_query.data.split("#")[4])
|
||||
CurrentPage = int(callback_query.data.split("#")[1])
|
||||
try:
|
||||
link = SCRAP_DICT[message_id][0][CurrentPage - 1][idlink - 1].get("link")
|
||||
except KeyError:
|
||||
return await callback_query.answer("Invalid callback data, please send CMD again..")
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(
|
||||
InlineButton("↩️ Back", f"page_lendrive#{CurrentPage}#{message_id}#{callback_query.from_user.id}"),
|
||||
InlineButton("❌ Close", f"close#{callback_query.from_user.id}")
|
||||
)
|
||||
keyboard.row(InlineButton("↩️ Back", f"page_lendrive#{CurrentPage}#{message_id}#{callback_query.from_user.id}"), InlineButton("❌ Close", f"close#{callback_query.from_user.id}"))
|
||||
try:
|
||||
hmm = await http.get(link, headers=headers)
|
||||
q = BeautifulSoup(hmm.text, "lxml")
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ from uuid import uuid4
|
|||
|
||||
from iytdl import iYTDL, main
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
|
||||
InlineKeyboardMarkup, InputMediaPhoto)
|
||||
from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, InputMediaPhoto
|
||||
|
||||
from misskaty import app
|
||||
from misskaty.core.message_utils import *
|
||||
|
|
@ -62,7 +61,8 @@ async def ytsearch(_, message):
|
|||
@app.on_message(filters.command(["ytdown"], COMMAND_HANDLER))
|
||||
@capture_err
|
||||
async def ytdownv2(_, message):
|
||||
if not message.from_user: return
|
||||
if not message.from_user:
|
||||
return
|
||||
if len(message.command) == 1:
|
||||
return await message.reply("Please input a valid YT-DLP Supported URL")
|
||||
url = message.text.split(" ", maxsplit=1)[1]
|
||||
|
|
|
|||
1
utils.py
1
utils.py
|
|
@ -131,7 +131,6 @@ def extract_user(message: Message) -> Union[int, str]:
|
|||
|
||||
elif len(message.command) > 1:
|
||||
if len(message.entities) > 1 and message.entities[1].type == "text_mention":
|
||||
|
||||
required_entity = message.entities[1]
|
||||
user_id = required_entity.user.id
|
||||
user_first_name = required_entity.user.first_name
|
||||
|
|
|
|||
Loading…
Reference in a new issue