mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-06 20:04:51 +00:00
Fix
This commit is contained in:
parent
2c92818935
commit
6f84d981e1
11 changed files with 79 additions and 73 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
from pyrogram.errors import ChatWriteForbidden, FloodWait, MessageNotModified, ChatAdminRequired, MessageIdInvalid
|
from pyrogram.errors import ChatWriteForbidden, FloodWait, MessageNotModified, ChatAdminRequired, MessageDeleteForbidden, MessageIdInvalid
|
||||||
|
|
||||||
LOGGER = getLogger(__name__)
|
LOGGER = getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -41,6 +41,8 @@ async def editPesan(msg, text, **kwargs):
|
||||||
async def hapusPesan(msg):
|
async def hapusPesan(msg):
|
||||||
try:
|
try:
|
||||||
return await msg.delete()
|
return await msg.delete()
|
||||||
|
except (MessageDeleteForbidden, ChatAdminRequired):
|
||||||
|
return
|
||||||
except FloodWait as e:
|
except FloodWait as e:
|
||||||
LOGGER.warning(str(e))
|
LOGGER.warning(str(e))
|
||||||
await asyncio.sleep(e.value)
|
await asyncio.sleep(e.value)
|
||||||
|
|
|
||||||
|
|
@ -72,16 +72,18 @@ def wetransfer_bypass(url: str) -> str:
|
||||||
|
|
||||||
if recipient_id:
|
if recipient_id:
|
||||||
j["recipient_id"] = recipient_id
|
j["recipient_id"] = recipient_id
|
||||||
|
try:
|
||||||
|
s = requests.Session()
|
||||||
|
r = s.get("https://wetransfer.com/")
|
||||||
|
m = re.search('name="csrf-token" content="([^"]+)"', r.text)
|
||||||
|
s.headers.update({"x-csrf-token": m[1], "x-requested-with": "XMLHttpRequest"})
|
||||||
|
r = s.post(f"https://wetransfer.com/api/v4/transfers/{transfer_id}/download", json=j)
|
||||||
|
j = r.json()
|
||||||
|
dl_url = j["direct_link"]
|
||||||
|
|
||||||
s = requests.Session()
|
return f"\n**Source Link** :\n`{url}`\n**Direct Link :**\n{dl_url}"
|
||||||
r = s.get("https://wetransfer.com/")
|
except Exception as er:
|
||||||
m = re.search('name="csrf-token" content="([^"]+)"', r.text)
|
return er
|
||||||
s.headers.update({"x-csrf-token": m[1], "x-requested-with": "XMLHttpRequest"})
|
|
||||||
r = s.post(f"https://wetransfer.com/api/v4/transfers/{transfer_id}/download", json=j)
|
|
||||||
j = r.json()
|
|
||||||
dl_url = j["direct_link"]
|
|
||||||
|
|
||||||
return f"\n**Source Link** :\n`{url}`\n**Direct Link :**\n{dl_url}"
|
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["directurl"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["directurl"], COMMAND_HANDLER))
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,10 @@ async def evaluation_cmd_t(_, m):
|
||||||
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]),
|
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]),
|
||||||
)
|
)
|
||||||
os.remove("MissKatyEval.txt")
|
os.remove("MissKatyEval.txt")
|
||||||
await m.delete() if m.from_user.is_self else await status_message.delete()
|
if m.from_user.is_self:
|
||||||
|
await m.delete()
|
||||||
|
else:
|
||||||
|
await status_message.delete()
|
||||||
else:
|
else:
|
||||||
await edit_or_reply(
|
await edit_or_reply(
|
||||||
m,
|
m,
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ LOGGER = getLogger(__name__)
|
||||||
|
|
||||||
__MODULE__ = "MediaTool"
|
__MODULE__ = "MediaTool"
|
||||||
__HELP__ = """"
|
__HELP__ = """"
|
||||||
/genss [reply to video] - Generate Screenshot From Video.
|
/genss [reply to video] - Generate Screenshot From Video. (Support TG Media and Direct URL)
|
||||||
/genss_link [link] - Generate Screenshot Video From URL. (Unstable)
|
|
||||||
/mediainfo [link/reply to TG Video] - Get Mediainfo From File.
|
/mediainfo [link/reply to TG Video] - Get Mediainfo From File.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -38,6 +37,7 @@ __HELP__ = """"
|
||||||
@app.on_message(filters.command(["genss"], COMMAND_HANDLER) & wait(30))
|
@app.on_message(filters.command(["genss"], COMMAND_HANDLER) & wait(30))
|
||||||
@capture_err
|
@capture_err
|
||||||
async def genss(client, m):
|
async def genss(client, m):
|
||||||
|
if not m.from_user: return
|
||||||
replied = m.reply_to_message
|
replied = m.reply_to_message
|
||||||
if len(m.command) == 2 and is_url(m.command[1]):
|
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)
|
snt = await kirimPesan(m, "Give me some time to process your request!! 😴", quote=True)
|
||||||
|
|
@ -55,8 +55,8 @@ async def genss(client, m):
|
||||||
vid = [replied.video, replied.document]
|
vid = [replied.video, replied.document]
|
||||||
media = next((v for v in vid if v is not None), None)
|
media = next((v for v in vid if v is not None), None)
|
||||||
if media is None:
|
if media is None:
|
||||||
return await kirimPesan(m, "Reply to a Telegram Video or document as video to generate screenshoot!")
|
return await kirimPesan(m, "Reply to a Telegram Video or document as video to generate screenshoot!", quote=True)
|
||||||
process = await kirimPesan(m, "`Processing, please wait..`")
|
process = await kirimPesan(m, "<code>Processing, please wait..</code>", quote=True)
|
||||||
|
|
||||||
c_time = time.time()
|
c_time = time.time()
|
||||||
the_real_download_location = await replied.download(
|
the_real_download_location = await replied.download(
|
||||||
|
|
@ -107,27 +107,6 @@ async def genss(client, m):
|
||||||
else:
|
else:
|
||||||
await kirimPesan(m, "Reply to a Telegram media to get screenshots from media..")
|
await kirimPesan(m, "Reply to a Telegram media to get screenshots from media..")
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["genss_link"], COMMAND_HANDLER))
|
|
||||||
@capture_err
|
|
||||||
async def genss_link(client, m):
|
|
||||||
if len(m.command) == 1:
|
|
||||||
return await kirimPesan(m, f"Use <code>/{m.command[0]} link</code> to generate screenshot from URL.")
|
|
||||||
if not is_url(m.command[1]):
|
|
||||||
return await kirimPesan(m, "Please use valid URL.")
|
|
||||||
snt = await m.reply_text("Give me some time to process your request!! 😴", quote=True)
|
|
||||||
|
|
||||||
duration = await get_duration(m.command[1])
|
|
||||||
if isinstance(duration, str):
|
|
||||||
return await snt.edit_text("😟 Sorry! (╥﹏╥) I cannot open the file.")
|
|
||||||
|
|
||||||
btns = gen_ik_buttons()
|
|
||||||
|
|
||||||
await snt.edit_text(
|
|
||||||
text=f"Now choose how many result for screenshot? 🥳.\n\nTotal duration: `{datetime.timedelta(seconds=duration)}` (`{duration}s`)",
|
|
||||||
reply_markup=InlineKeyboardMarkup(btns)
|
|
||||||
)
|
|
||||||
|
|
||||||
@app.on_callback_query(filters.regex(r'^scht'))
|
@app.on_callback_query(filters.regex(r'^scht'))
|
||||||
async def _(c, m):
|
async def _(c, m):
|
||||||
asyncio.create_task(screenshot_flink(c, m))
|
asyncio.create_task(screenshot_flink(c, m))
|
||||||
|
|
@ -11,7 +11,7 @@ from pyrogram.errors import (
|
||||||
ChatSendMediaForbidden,
|
ChatSendMediaForbidden,
|
||||||
MessageTooLong,
|
MessageTooLong,
|
||||||
RPCError,
|
RPCError,
|
||||||
SlowmodeWait,
|
TopicClosed,
|
||||||
)
|
)
|
||||||
from pyrogram.types import ChatMemberUpdated, InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import ChatMemberUpdated, InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
@ -194,8 +194,28 @@ async def save_group(bot, message):
|
||||||
photo=welcomeimg,
|
photo=welcomeimg,
|
||||||
caption=f"Hai {u.mention}, Selamat datang digrup {message.chat.title}.",
|
caption=f"Hai {u.mention}, Selamat datang digrup {message.chat.title}.",
|
||||||
)
|
)
|
||||||
except (ChatSendMediaForbidden, SlowmodeWait):
|
userspammer = ""
|
||||||
await app.leave_chat(message.chat.id)
|
# Spamwatch Detection
|
||||||
|
try:
|
||||||
|
headers = {"Authorization": "Bearer XvfzE4AUNXkzCy0DnIVpFDlxZi79lt6EnwKgBj8Quuzms0OSdHvf1k6zSeyzZ_lz"}
|
||||||
|
apispamwatch = (await http.get(f"https://api.spamwat.ch/banlist/{u.id}", headers=headers)).json()
|
||||||
|
if not apispamwatch.get("error"):
|
||||||
|
await app.ban_chat_member(message.chat.id, u.id, datetime.now() + timedelta(seconds=30))
|
||||||
|
userspammer += f"<b>#SpamWatch Federation Ban</b>\nUser {u.mention} [<code>{u.id}</code>] has been kicked because <code>{apispamwatch.get('reason')}</code>.\n"
|
||||||
|
except Exception as err:
|
||||||
|
LOGGER.error(f"ERROR in Spamwatch Detection. {err}")
|
||||||
|
# Combot API Detection
|
||||||
|
try:
|
||||||
|
apicombot = (await http.get(f"https://api.cas.chat/check?user_id={u.id}")).json()
|
||||||
|
if apicombot.get("ok") == "true":
|
||||||
|
await app.ban_chat_member(message.chat.id, u.id, datetime.now() + timedelta(seconds=30))
|
||||||
|
userspammer += f"<b>#CAS Federation Ban</b>\nUser {u.mention} [<code>{u.id}</code>] detected as spambot and has been kicked. Powered by <a href='https://api.cas.chat/check?user_id={u.id}'>Combot AntiSpam.</a>"
|
||||||
|
except Exception as err:
|
||||||
|
LOGGER.error(f"ERROR in Combot API Detection. {err}")
|
||||||
|
if userspammer != "":
|
||||||
|
await bot.send_message(message.chat.id, userspammer)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
os.remove(f"downloads/welcome#{u.id}.png")
|
os.remove(f"downloads/welcome#{u.id}.png")
|
||||||
os.remove(f"downloads/pp{u.id}.png")
|
os.remove(f"downloads/pp{u.id}.png")
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ from utils import get_file_id
|
||||||
|
|
||||||
@app.on_message(filters.command(["mediainfo"], COMMAND_HANDLER) & wait(30))
|
@app.on_message(filters.command(["mediainfo"], COMMAND_HANDLER) & wait(30))
|
||||||
async def mediainfo(client, message):
|
async def mediainfo(client, message):
|
||||||
|
if not m.from_user: return
|
||||||
if message.reply_to_message and message.reply_to_message.media:
|
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)
|
process = await kirimPesan(message, "`Sedang memproses, lama waktu tergantung ukuran file kamu...`", quote=True)
|
||||||
file_info = get_file_id(message.reply_to_message)
|
file_info = get_file_id(message.reply_to_message)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMa
|
||||||
|
|
||||||
from misskaty import BOT_USERNAME, app
|
from misskaty import BOT_USERNAME, app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.core.message_utils import kirimPesan
|
from misskaty.core.message_utils import hapusPesan, kirimPesan
|
||||||
from misskaty.helper.http import http
|
from misskaty.helper.http import http
|
||||||
from misskaty.helper.tools import rentry
|
from misskaty.helper.tools import rentry
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
|
@ -308,11 +308,8 @@ async def close_callback(bot: Client, query: CallbackQuery):
|
||||||
return await query.answer("⚠️ Access Denied!", True)
|
return await query.answer("⚠️ Access Denied!", True)
|
||||||
await query.answer("Deleting this message in 5 seconds.")
|
await query.answer("Deleting this message in 5 seconds.")
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
await query.message.delete()
|
await hapusPesan(query.message)
|
||||||
try:
|
await hapusPesan(query.message.reply_to_message)
|
||||||
await query.message.reply_to_message.delete()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
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"}
|
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"}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ __HELP__ = """/notes To Get All The Notes In The Chat.
|
||||||
async def save_notee(_, message):
|
async def save_notee(_, message):
|
||||||
if len(message.command) < 2 or not message.reply_to_message:
|
if len(message.command) < 2 or not message.reply_to_message:
|
||||||
await message.reply(
|
await message.reply(
|
||||||
text="**Usage:**\nReply to a text or sticker with /save [NOTE_NAME] to save it.",
|
text="**Usage:**\nReply to a text or sticker with /addnote [NOTE_NAME] to save it.",
|
||||||
)
|
)
|
||||||
|
|
||||||
elif not message.reply_to_message.text and not message.reply_to_message.sticker:
|
elif not message.reply_to_message.text and not message.reply_to_message.sticker:
|
||||||
|
|
@ -113,10 +113,10 @@ async def get_one_note(_, message):
|
||||||
@adminsOnly("can_change_info")
|
@adminsOnly("can_change_info")
|
||||||
async def del_note(_, message):
|
async def del_note(_, message):
|
||||||
if len(message.command) == 1:
|
if len(message.command) == 1:
|
||||||
return await message.reply("**Usage**\n__/delete [NOTE_NAME]__")
|
return await message.reply("**Usage**\n__/delnote [NOTE_NAME]__")
|
||||||
name = message.text.split(None, 1)[1].strip()
|
name = message.text.split(None, 1)[1].strip()
|
||||||
if not name:
|
if not name:
|
||||||
return await message.reply("**Usage**\n__/delete [NOTE_NAME]__")
|
return await message.reply("**Usage**\n__/delnote [NOTE_NAME]__")
|
||||||
|
|
||||||
message.text.split()[0][0]
|
message.text.split()[0][0]
|
||||||
chat_id = message.chat.id
|
chat_id = message.chat.id
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ from pyrogram import filters
|
||||||
from database.sangmata_db import *
|
from database.sangmata_db import *
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core.decorator.permissions import adminsOnly
|
from misskaty.core.decorator.permissions import adminsOnly
|
||||||
|
from misskaty.core.message_utils import kirimPesan
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
|
||||||
__MODULE__ = "SangMata"
|
__MODULE__ = "SangMata"
|
||||||
|
|
@ -25,16 +26,16 @@ async def cek_mataa(_, m):
|
||||||
if username != m.from_user.username or first_name != m.from_user.first_name or last_name != m.from_user.last_name:
|
if username != m.from_user.username or first_name != m.from_user.first_name or last_name != m.from_user.last_name:
|
||||||
msg += "👀 <b>Mata MissKaty</b>\n\n"
|
msg += "👀 <b>Mata MissKaty</b>\n\n"
|
||||||
if username != m.from_user.username:
|
if username != m.from_user.username:
|
||||||
msg += f"{m.from_user.mention} [{m.from_user.id}] changed username from @{username} to @{m.from_user.username}.\n"
|
msg += f"{m.from_user.mention} [<code>{m.from_user.id}</code>] changed username from @{username} to @{m.from_user.username}.\n"
|
||||||
await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
||||||
if first_name != m.from_user.first_name:
|
if first_name != m.from_user.first_name:
|
||||||
msg += f"{m.from_user.mention} [{m.from_user.id}] changed first_name from {first_name} to {m.from_user.first_name}.\n"
|
msg += f"{m.from_user.mention} [<code>{m.from_user.id}</code>] changed first_name from {first_name} to {m.from_user.first_name}.\n"
|
||||||
await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
||||||
if last_name != m.from_user.last_name:
|
if last_name != m.from_user.last_name:
|
||||||
msg += f"{m.from_user.mention} [{m.from_user.id}] changed last_name from {last_name} to {m.from_user.last_name}."
|
msg += f"{m.from_user.mention} [<code>{m.from_user.id}</code>] changed last_name from {last_name} to {m.from_user.last_name}."
|
||||||
await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
await add_userdata(m.from_user.id, m.from_user.username, m.from_user.first_name, m.from_user.last_name)
|
||||||
if msg != "":
|
if msg != "":
|
||||||
await m.reply(msg, quote=True)
|
await kirimPesan(m, msg, quote=True)
|
||||||
|
|
||||||
@app.on_message(
|
@app.on_message(
|
||||||
filters.group & filters.command("sangmata_set", COMMAND_HANDLER) & ~filters.bot & ~filters.via_bot
|
filters.group & filters.command("sangmata_set", COMMAND_HANDLER) & ~filters.bot & ~filters.via_bot
|
||||||
|
|
@ -42,20 +43,20 @@ async def cek_mataa(_, m):
|
||||||
@adminsOnly("can_change_info")
|
@adminsOnly("can_change_info")
|
||||||
async def set_mataa(_, m):
|
async def set_mataa(_, m):
|
||||||
if len(m.command) == 1:
|
if len(m.command) == 1:
|
||||||
return await m.reply(f"Use <code>/{m.command[0]} on</code>, to enable sangmata. If you want disable, you can use off parameter.")
|
return await kirimPesan(m, f"Use <code>/{m.command[0]} on</code>, to enable sangmata. If you want disable, you can use off parameter.")
|
||||||
if m.command[1] == "on":
|
if m.command[1] == "on":
|
||||||
cekset = await is_sangmata_on(m.chat.id)
|
cekset = await is_sangmata_on(m.chat.id)
|
||||||
if cekset:
|
if cekset:
|
||||||
await m.reply("SangMata already enabled in your groups.")
|
await kirimPesan(m, "SangMata already enabled in your groups.")
|
||||||
else:
|
else:
|
||||||
await sangmata_on(m.chat.id)
|
await sangmata_on(m.chat.id)
|
||||||
await m.reply("Sangmata enabled in your groups.")
|
await kirimPesan(m, "Sangmata enabled in your groups.")
|
||||||
elif m.command[1] == "off":
|
elif m.command[1] == "off":
|
||||||
cekset = await is_sangmata_on(m.chat.id)
|
cekset = await is_sangmata_on(m.chat.id)
|
||||||
if cekset:
|
if cekset:
|
||||||
await m.reply("SangMata already enabled in your groups.")
|
await kirimPesan(m, "SangMata already enabled in your groups.")
|
||||||
else:
|
else:
|
||||||
await sangmata_off(m.chat.id)
|
await sangmata_off(m.chat.id)
|
||||||
await m.reply("Sangmata enabled in your groups.")
|
await kirimPesan(m, "Sangmata enabled in your groups.")
|
||||||
else:
|
else:
|
||||||
await m.reply("Unknown parameter, use only on/off parameter.")
|
await kirimPesan(m, "Unknown parameter, use only on/off parameter.")
|
||||||
|
|
@ -17,6 +17,7 @@ from pyrogram import filters
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
|
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
|
from misskaty.core.message_utils import *
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.helper.pyro_progress import progress_for_pyrogram
|
from misskaty.helper.pyro_progress import progress_for_pyrogram
|
||||||
from misskaty.helper.tools import get_random_string
|
from misskaty.helper.tools import get_random_string
|
||||||
|
|
@ -64,10 +65,10 @@ def get_subname(lang, url, format):
|
||||||
async def ceksub(_, m):
|
async def ceksub(_, m):
|
||||||
cmd = m.text.split(" ", 1)
|
cmd = m.text.split(" ", 1)
|
||||||
if len(cmd) == 1:
|
if len(cmd) == 1:
|
||||||
return await m.reply(f"Gunakan command /{m.command[0]} [link] untuk mengecek subtitle dan audio didalam video.")
|
return await kirimPesan(m, f"Please use command /{m.command[0]} [link] to check subtitles or audio in video file.", quote=True)
|
||||||
link = cmd[1]
|
link = cmd[1]
|
||||||
start_time = perf_counter()
|
start_time = perf_counter()
|
||||||
pesan = await m.reply("Sedang memproses perintah..", quote=True)
|
pesan = await kirimPesan(m, "Processing your request..", quote=True)
|
||||||
try:
|
try:
|
||||||
res = (await shell_exec(f"ffprobe -loglevel 0 -print_format json -show_format -show_streams {link}"))[0]
|
res = (await shell_exec(f"ffprobe -loglevel 0 -print_format json -show_format -show_streams {link}"))[0]
|
||||||
details = json.loads(res)
|
details = json.loads(res)
|
||||||
|
|
@ -96,13 +97,13 @@ async def ceksub(_, m):
|
||||||
end_time = perf_counter()
|
end_time = perf_counter()
|
||||||
timelog = "{:.2f}".format(end_time - start_time) + " second"
|
timelog = "{:.2f}".format(end_time - start_time) + " second"
|
||||||
buttons.append([InlineKeyboardButton("❌ Cancel", f"close#{m.from_user.id}")])
|
buttons.append([InlineKeyboardButton("❌ Cancel", f"close#{m.from_user.id}")])
|
||||||
await pesan.edit(
|
await editPesan(
|
||||||
|
pesan,
|
||||||
f"Press the button below to extract subtitles/audio. Only support direct link at this time.\nProcessed in {timelog}",
|
f"Press the button below to extract subtitles/audio. Only support direct link at this time.\nProcessed in {timelog}",
|
||||||
reply_markup=InlineKeyboardMarkup(buttons),
|
reply_markup=InlineKeyboardMarkup(buttons),
|
||||||
)
|
)
|
||||||
except Exception:
|
except:
|
||||||
traceback.format_exc()
|
await editPesan(pesan, "Failed extract media, make sure your link is not protected by WAF or maybe inaccessible for bot.")
|
||||||
await pesan.edit("Failed extract media, make sure your link is not protected by WAF or maybe inaccessible for bot.")
|
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["converttosrt"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["converttosrt"], COMMAND_HANDLER))
|
||||||
|
|
@ -110,8 +111,8 @@ async def ceksub(_, m):
|
||||||
async def convertsrt(c, m):
|
async def convertsrt(c, m):
|
||||||
reply = m.reply_to_message
|
reply = m.reply_to_message
|
||||||
if not reply and reply.document and (reply.document.file_name.endswith(".vtt") or reply.document.file_name.endswith(".ass")):
|
if not reply and reply.document and (reply.document.file_name.endswith(".vtt") or reply.document.file_name.endswith(".ass")):
|
||||||
return await m.reply(f"Use command /{m.command[0]} by reply to .ass or .vtt file, to convert subtitle from .ass or .vtt to srt.")
|
return await kirimPesan(m, f"Use command /{m.command[0]} by reply to .ass or .vtt file, to convert subtitle from .ass or .vtt to srt.")
|
||||||
msg = await m.reply("⏳ Converting...")
|
msg = await kirimPesan(m, "⏳ Converting...", quote=True)
|
||||||
dl = await reply.download()
|
dl = await reply.download()
|
||||||
filename = dl.split("/", 3)[3]
|
filename = dl.split("/", 3)[3]
|
||||||
LOGGER.info(f"ConvertSub: {filename} by {m.from_user.first_name} [{m.from_user.id}]")
|
LOGGER.info(f"ConvertSub: {filename} by {m.from_user.first_name} [{m.from_user.id}]")
|
||||||
|
|
@ -124,7 +125,7 @@ async def convertsrt(c, m):
|
||||||
progress=progress_for_pyrogram,
|
progress=progress_for_pyrogram,
|
||||||
progress_args=("Uploading files..", msg, c_time),
|
progress_args=("Uploading files..", msg, c_time),
|
||||||
)
|
)
|
||||||
await msg.delete()
|
await hapusPesan(msg)
|
||||||
try:
|
try:
|
||||||
os.remove(dl)
|
os.remove(dl)
|
||||||
os.remove(f"{filename}.srt")
|
os.remove(f"{filename}.srt")
|
||||||
|
|
@ -143,7 +144,7 @@ async def stream_extract(bot, update):
|
||||||
link = update.message.reply_to_message.command[1]
|
link = update.message.reply_to_message.command[1]
|
||||||
except:
|
except:
|
||||||
return await update.answer("⚠️ DONT DELETE YOUR MESSAGE!", True)
|
return await update.answer("⚠️ DONT DELETE YOUR MESSAGE!", True)
|
||||||
await update.message.edit("⏳ Processing...")
|
await editPesan(update.message, "⏳ Processing...")
|
||||||
try:
|
try:
|
||||||
if codec == "aac":
|
if codec == "aac":
|
||||||
format = "aac"
|
format = "aac"
|
||||||
|
|
@ -168,10 +169,10 @@ async def stream_extract(bot, update):
|
||||||
progress=progress_for_pyrogram,
|
progress=progress_for_pyrogram,
|
||||||
progress_args=("Uploading files..", update.message, c_time),
|
progress_args=("Uploading files..", update.message, c_time),
|
||||||
)
|
)
|
||||||
await update.message.delete()
|
await hapusPesan(update.message)
|
||||||
try:
|
try:
|
||||||
os.remove(namafile)
|
os.remove(namafile)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await update.message.edit(f"Failed extract sub, Maybe unsupported format..\n\nLink: {link}\nERR: {e}")
|
await editPesan(update.message, f"Failed extract sub, Maybe unsupported format..\n\nLink: {link}\nERR: {e}")
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ async def getDataPahe(msg, kueri, CurrentPage):
|
||||||
async def getDataKuso(msg, kueri, CurrentPage, user):
|
async def getDataKuso(msg, kueri, CurrentPage, user):
|
||||||
if not SCRAP_DICT.get(msg.id):
|
if not SCRAP_DICT.get(msg.id):
|
||||||
kusodata = []
|
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, verify=False)
|
||||||
res = BeautifulSoup(data.text, "lxml").find_all("h2", {"class": "episodeye"})
|
res = BeautifulSoup(data.text, "lxml").find_all("h2", {"class": "episodeye"})
|
||||||
for i in res:
|
for i in res:
|
||||||
ress = i.find_all("a")[0]
|
ress = i.find_all("a")[0]
|
||||||
|
|
@ -168,7 +168,7 @@ async def getDataKuso(msg, kueri, CurrentPage, user):
|
||||||
async def getDataMovieku(msg, kueri, CurrentPage):
|
async def getDataMovieku(msg, kueri, CurrentPage):
|
||||||
if not SCRAP_DICT.get(msg.id):
|
if not SCRAP_DICT.get(msg.id):
|
||||||
moviekudata = []
|
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, verify=False)
|
||||||
r = BeautifulSoup(data.text, "lxml")
|
r = BeautifulSoup(data.text, "lxml")
|
||||||
res = r.find_all(class_="bx")
|
res = r.find_all(class_="bx")
|
||||||
for i in res:
|
for i in res:
|
||||||
|
|
@ -199,7 +199,7 @@ async def getDataMovieku(msg, kueri, CurrentPage):
|
||||||
async def getDataSavefilm21(msg, kueri, CurrentPage, user):
|
async def getDataSavefilm21(msg, kueri, CurrentPage, user):
|
||||||
if not SCRAP_DICT.get(msg.id):
|
if not SCRAP_DICT.get(msg.id):
|
||||||
sfdata = []
|
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, verify=False)
|
||||||
text = BeautifulSoup(data.text, "lxml")
|
text = BeautifulSoup(data.text, "lxml")
|
||||||
entry = text.find_all(class_="entry-header")
|
entry = text.find_all(class_="entry-header")
|
||||||
if "Tidak Ditemukan" in entry[0].text:
|
if "Tidak Ditemukan" in entry[0].text:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue