mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-04 19:24:51 +00:00
Updated to latest layer
Fix split msg using latest layer Fix donate cmd Add blockquote in imdb and some text Minor fix ytdl And other fix.. Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
parent
930a53e4d1
commit
f2f6f240eb
8 changed files with 56 additions and 25 deletions
|
|
@ -42,7 +42,7 @@ MOD_NOLOAD = ["subscene_dl"]
|
||||||
HELPABLE = {}
|
HELPABLE = {}
|
||||||
cleanmode = {}
|
cleanmode = {}
|
||||||
botStartTime = time.time()
|
botStartTime = time.time()
|
||||||
misskaty_version = "v2.11.4 - Stable"
|
misskaty_version = "v2.12.1 - Stable"
|
||||||
|
|
||||||
uvloop.install()
|
uvloop.install()
|
||||||
faulthandler_enable()
|
faulthandler_enable()
|
||||||
|
|
|
||||||
|
|
@ -85,14 +85,13 @@ if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
get_event_loop().run_until_complete(start_bot())
|
get_event_loop().run_until_complete(start_bot())
|
||||||
app.loop.run_forever()
|
app.loop.run_forever()
|
||||||
# loop.run_until_complete(start_bot())
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
except Exception:
|
except Exception:
|
||||||
err = traceback.format_exc()
|
err = traceback.format_exc()
|
||||||
LOGGER.info(err)
|
LOGGER.info(err)
|
||||||
finally:
|
finally:
|
||||||
loop.stop()
|
app.loop.stop()
|
||||||
LOGGER.info(
|
LOGGER.info(
|
||||||
"------------------------ Stopped Services ------------------------"
|
"------------------------ Stopped Services ------------------------"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ from pyrogram.types import Message
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
||||||
Message.input = property(
|
@property
|
||||||
lambda m: m.text[m.text.find(m.command[0]) + len(m.command[0]) + 1 :]
|
def parse_cmd(m):
|
||||||
if len(m.command) > 1
|
msg = m.caption if m.web_page_preview else m.text
|
||||||
else None
|
if len(m.command) > 1:
|
||||||
)
|
return msg.split(None, 1)[1]
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def reply_text(
|
async def reply_text(
|
||||||
|
|
@ -323,3 +324,4 @@ Message.edit_or_send_as_file = edit_or_send_as_file
|
||||||
Message.reply_or_send_as_file = reply_or_send_as_file
|
Message.reply_or_send_as_file = reply_or_send_as_file
|
||||||
Message.reply_as_file = reply_as_file
|
Message.reply_as_file = reply_as_file
|
||||||
Message.delete_msg = delete
|
Message.delete_msg = delete
|
||||||
|
Message.input = parse_cmd
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
|
|
@ -151,3 +152,27 @@ async def search_jw(movie_name: str, locale: Union[str, None] = "ID"):
|
||||||
m_t_ = m_t_[:-2].strip()
|
m_t_ = m_t_[:-2].strip()
|
||||||
break
|
break
|
||||||
return m_t_
|
return m_t_
|
||||||
|
|
||||||
|
|
||||||
|
def isValidURL(str):
|
||||||
|
# Regex to check valid URL
|
||||||
|
regex = ("((http|https)://)(www.)?" +
|
||||||
|
"[a-zA-Z0-9@:%._\\+~#?&//=]" +
|
||||||
|
"{2,256}\\.[a-z]" +
|
||||||
|
"{2,6}\\b([-a-zA-Z0-9@:%" +
|
||||||
|
"._\\+~#?&//=]*)")
|
||||||
|
|
||||||
|
# Compile the ReGex
|
||||||
|
p = re.compile(regex)
|
||||||
|
|
||||||
|
# If the string is empty
|
||||||
|
# return false
|
||||||
|
if (str == None):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Return if the string
|
||||||
|
# matched the ReGex
|
||||||
|
if(re.search(p, str)):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
@ -125,11 +125,12 @@ async def log_file(_, ctx: Message, strings):
|
||||||
|
|
||||||
@app.on_message(filters.command(["donate"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["donate"], COMMAND_HANDLER))
|
||||||
async def donate(self: Client, ctx: Message):
|
async def donate(self: Client, ctx: Message):
|
||||||
with contextlib.suppress(ChatSendPlainForbidden, ChatSendPhotosForbidden):
|
try:
|
||||||
await ctx.reply_photo(
|
await ctx.reply_photo(
|
||||||
"https://img.yasirweb.eu.org/file/9427d61d6968b8ee4fb2f.jpg",
|
"https://img.yasirweb.eu.org/file/9427d61d6968b8ee4fb2f.jpg",
|
||||||
caption=f"Hi {ctx.from_user.mention}, If you find this bot useful, you can make a donation to the account below. Because this bot server uses VPS and is not free. Thank You..\n\n<b>Indonesian Payment:</b>\n<b>QRIS:</b> https://img.yasirweb.eu.org/file/b1c86973ae4e55721983a.jpg (Yasir Store)\n<b>Mayar:</b> https://yasirarism.mayar.link/payme\n<b>Bank Jago:</b> 109641845083 (Yasir Aris M)\n\nFor international people can use PayPal to support me or via GitHub Sponsor:\nhttps://paypal.me/yasirarism\nhttps://github.com/sponsors/yasirarism\n\n<b>Source:</b> @BeriKopi",
|
caption=f"Hi {ctx.from_user.mention}, If you find this bot useful, you can make a donation to the account below. Because this bot server uses VPS and is not free. Thank You..\n\n<b>Indonesian Payment:</b>\n<b>QRIS:</b> https://img.yasirweb.eu.org/file/b1c86973ae4e55721983a.jpg (Yasir Store)\n<b>Mayar:</b> https://yasirarism.mayar.link/payme\n<b>Bank Jago:</b> 109641845083 (Yasir Aris M)\n\nFor international people can use PayPal to support me or via GitHub Sponsor:\nhttps://paypal.me/yasirarism\nhttps://github.com/sponsors/yasirarism\n\n<b>Source:</b> @BeriKopi",
|
||||||
)
|
)
|
||||||
|
except (ChatSendPlainForbidden, ChatSendPhotosForbidden):
|
||||||
await self.send_message(LOG_CHANNEL, f"❗️ <b>WARNING</b>\nI'm leaving from {ctx.chat.id} since i didn't have sufficient admin permissions.")
|
await self.send_message(LOG_CHANNEL, f"❗️ <b>WARNING</b>\nI'm leaving from {ctx.chat.id} since i didn't have sufficient admin permissions.")
|
||||||
await ctx.chat.leave()
|
await ctx.chat.leave()
|
||||||
|
|
||||||
|
|
@ -400,8 +401,9 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
||||||
if ctx.from_user.is_self
|
if ctx.from_user.is_self
|
||||||
else await ctx.reply_msg(strings("run_eval"), quote=True)
|
else await ctx.reply_msg(strings("run_eval"), quote=True)
|
||||||
)
|
)
|
||||||
|
msg = ctx.caption if ctx.web_page_preview else ctx.text
|
||||||
code = (
|
code = (
|
||||||
ctx.text.split(maxsplit=1)[1] if ctx.command else ctx.text.split("\napp.run()")[0]
|
msg.split(maxsplit=1)[1] if ctx.command else msg.split("\napp.run()")[0]
|
||||||
)
|
)
|
||||||
out_buf = io.StringIO()
|
out_buf = io.StringIO()
|
||||||
out = ""
|
out = ""
|
||||||
|
|
@ -435,15 +437,15 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
||||||
"cloudscraper": cloudscraper,
|
"cloudscraper": cloudscraper,
|
||||||
"json": json,
|
"json": json,
|
||||||
"aiohttp": aiohttp,
|
"aiohttp": aiohttp,
|
||||||
"print": _print,
|
"p": _print,
|
||||||
"send": send,
|
"send": send,
|
||||||
"stdout": out_buf,
|
"stdout": out_buf,
|
||||||
"traceback": traceback,
|
"traceback": traceback,
|
||||||
"fetch": fetch,
|
"fetch": fetch,
|
||||||
"replied": ctx.reply_to_message,
|
"r": ctx.reply_to_message,
|
||||||
"requests": requests,
|
"requests": requests,
|
||||||
"soup": BeautifulSoup,
|
"soup": BeautifulSoup,
|
||||||
"help": _help,
|
"h": _help,
|
||||||
}
|
}
|
||||||
eval_vars.update(var)
|
eval_vars.update(var)
|
||||||
eval_vars.update(teskode)
|
eval_vars.update(teskode)
|
||||||
|
|
|
||||||
|
|
@ -470,17 +470,17 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
|
||||||
res_str += f"<b>Pemeran:</b> {actor[:-2]}\n\n"
|
res_str += f"<b>Pemeran:</b> {actor[:-2]}\n\n"
|
||||||
if deskripsi := r_json.get("description"):
|
if deskripsi := r_json.get("description"):
|
||||||
summary = GoogleTranslator("auto", "id").translate(deskripsi)
|
summary = GoogleTranslator("auto", "id").translate(deskripsi)
|
||||||
res_str += f"<b>📜 Plot: </b> <code>{summary}</code>\n\n"
|
res_str += f"<b>📜 Plot:</b>\n<blockquote><code>{summary}</code></blockquote>\n\n"
|
||||||
if keywd := r_json.get("keywords"):
|
if keywd := r_json.get("keywords"):
|
||||||
key_ = "".join(
|
key_ = "".join(
|
||||||
f"#{i.replace(' ', '_').replace('-', '_')}, " for i in keywd.split(",")
|
f"#{i.replace(' ', '_').replace('-', '_')}, " for i in keywd.split(",")
|
||||||
)
|
)
|
||||||
res_str += f"<b>🔥 Kata Kunci:</b> {key_[:-2]} \n"
|
res_str += f"<b>🔥 Kata Kunci:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
||||||
if award := sop.select('li[data-testid="award_information"]'):
|
if award := sop.select('li[data-testid="award_information"]'):
|
||||||
awards = (
|
awards = (
|
||||||
award[0].find(class_="ipc-metadata-list-item__list-content-item").text
|
award[0].find(class_="ipc-metadata-list-item__list-content-item").text
|
||||||
)
|
)
|
||||||
res_str += f"<b>🏆 Penghargaan:</b> <code>{GoogleTranslator('auto', 'id').translate(awards)}</code>\n"
|
res_str += f"<b>🏆 Penghargaan:</b>\n<blockquote><code>{GoogleTranslator('auto', 'id').translate(awards)}</code></blockquote>\n"
|
||||||
else:
|
else:
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
if ott != "":
|
if ott != "":
|
||||||
|
|
@ -633,18 +633,18 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
|
||||||
)
|
)
|
||||||
res_str += f"<b>Stars:</b> {actors[:-2]}\n\n"
|
res_str += f"<b>Stars:</b> {actors[:-2]}\n\n"
|
||||||
if description := r_json.get("description"):
|
if description := r_json.get("description"):
|
||||||
res_str += f"<b>📜 Summary: </b> <code>{description}</code>\n\n"
|
res_str += f"<b>📜 Summary:</b>\n<blockquote><code>{description}</code></blockquote>\n\n"
|
||||||
if r_json.get("keywords"):
|
if r_json.get("keywords"):
|
||||||
key_ = "".join(
|
key_ = "".join(
|
||||||
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
||||||
for i in r_json["keywords"].split(",")
|
for i in r_json["keywords"].split(",")
|
||||||
)
|
)
|
||||||
res_str += f"<b>🔥 Keywords:</b> {key_[:-2]} \n"
|
res_str += f"<b>🔥 Keywords:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
||||||
if award := sop.select('li[data-testid="award_information"]'):
|
if award := sop.select('li[data-testid="award_information"]'):
|
||||||
awards = (
|
awards = (
|
||||||
award[0].find(class_="ipc-metadata-list-item__list-content-item").text
|
award[0].find(class_="ipc-metadata-list-item__list-content-item").text
|
||||||
)
|
)
|
||||||
res_str += f"<b>🏆 Awards:</b> <code>{awards}</code>\n"
|
res_str += f"<b>🏆 Awards:</b>\n<blockquote><code>{awards}</code></blockquote>\n"
|
||||||
else:
|
else:
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
if ott != "":
|
if ott != "":
|
||||||
|
|
|
||||||
|
|
@ -725,20 +725,20 @@ async def imdb_inl(_, query):
|
||||||
summary = GoogleTranslator("auto", "id").translate(
|
summary = GoogleTranslator("auto", "id").translate(
|
||||||
r_json.get("description")
|
r_json.get("description")
|
||||||
)
|
)
|
||||||
res_str += f"<b>📜 Plot: </b> <code>{summary}</code>\n\n"
|
res_str += f"<b>📜 Plot:</b>\n<blockquote><code>{summary}</code></blockquote>\n\n"
|
||||||
if r_json.get("keywords"):
|
if r_json.get("keywords"):
|
||||||
key_ = "".join(
|
key_ = "".join(
|
||||||
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
f"#{i.replace(' ', '_').replace('-', '_')}, "
|
||||||
for i in r_json["keywords"].split(",")
|
for i in r_json["keywords"].split(",")
|
||||||
)
|
)
|
||||||
res_str += f"<b>🔥 Kata Kunci:</b> {key_[:-2]} \n"
|
res_str += f"<b>🔥 Kata Kunci:</b>\n<blockquote>{key_[:-2]}</blockquote>\n"
|
||||||
if award := sop.select('li[data-testid="award_information"]'):
|
if award := sop.select('li[data-testid="award_information"]'):
|
||||||
awards = (
|
awards = (
|
||||||
award[0]
|
award[0]
|
||||||
.find(class_="ipc-metadata-list-item__list-content-item")
|
.find(class_="ipc-metadata-list-item__list-content-item")
|
||||||
.text
|
.text
|
||||||
)
|
)
|
||||||
res_str += f"<b>🏆 Penghargaan:</b> <code>{GoogleTranslator('auto', 'id').translate(awards)}</code>\n"
|
res_str += f"<b>🏆 Penghargaan:</b>\n<blockquote><code>{GoogleTranslator('auto', 'id').translate(awards)}</code></blockquote>\n"
|
||||||
else:
|
else:
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
if ott != "":
|
if ott != "":
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ from pyrogram.types import (
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core import pyro_cooldown
|
from misskaty.core import pyro_cooldown
|
||||||
from misskaty.core.decorator import capture_err, new_task
|
from misskaty.core.decorator import capture_err, new_task
|
||||||
from misskaty.helper import fetch, use_chat_lang
|
from misskaty.helper import fetch, use_chat_lang, isValidURL
|
||||||
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO
|
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO
|
||||||
|
|
||||||
LOGGER = getLogger("MissKaty")
|
LOGGER = getLogger("MissKaty")
|
||||||
|
|
@ -91,12 +91,15 @@ async def ytsearch(_, ctx: Message, strings):
|
||||||
)
|
)
|
||||||
@capture_err
|
@capture_err
|
||||||
@use_chat_lang()
|
@use_chat_lang()
|
||||||
async def ytdownv2(_, ctx: Message, strings):
|
async def ytdownv2(self, ctx: Message, strings):
|
||||||
if not ctx.from_user:
|
if not ctx.from_user:
|
||||||
return await ctx.reply_msg(strings("no_channel"))
|
return await ctx.reply_msg(strings("no_channel"))
|
||||||
if ctx.command and len(ctx.command) == 1:
|
if ctx.command and len(ctx.command) == 1:
|
||||||
return await ctx.reply_msg(strings("invalid_link"))
|
return await ctx.reply_msg(strings("invalid_link"))
|
||||||
url = ctx.input if ctx.command and len(ctx.command) > 1 else ctx.text
|
msg = ctx.caption if ctx.web_page_preview else ctx.text
|
||||||
|
url = msg.split()[1]
|
||||||
|
if not isValidURL(url):
|
||||||
|
return await ctx.reply_msg(strings("invalid_link"))
|
||||||
async with iYTDL(log_group_id=0, cache_path="cache", silent=True) as ytdl:
|
async with iYTDL(log_group_id=0, cache_path="cache", silent=True) as ytdl:
|
||||||
try:
|
try:
|
||||||
x = await ytdl.parse(url, extract=True)
|
x = await ytdl.parse(url, extract=True)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue