mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Some fix
This commit is contained in:
parent
1a4f779443
commit
e6aa2d475d
7 changed files with 35 additions and 30 deletions
|
|
@ -5,14 +5,12 @@ from typing import Tuple
|
|||
|
||||
from misskaty import BOT_USERNAME
|
||||
from telegraph.aio import Telegraph
|
||||
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() is None:
|
||||
await telegraph.create_account(short_name=BOT_USERNAME)
|
||||
LOGGER.info("Create TGH Account ..")
|
||||
if is_media:
|
||||
"""Create a Telegram Post Foto/Video"""
|
||||
response = await telegraph.upload_file(media)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import asyncio
|
|||
import math
|
||||
import time
|
||||
|
||||
from pyrogram.errors import FloodWait, MessageNotModified
|
||||
from pyrogram.errors import FloodWait, MessageNotModified, MessageIdInvalid
|
||||
|
||||
|
||||
async def progress_for_pyrogram(current, total, ud_type, message, start):
|
||||
|
|
@ -43,7 +43,7 @@ async def progress_for_pyrogram(current, total, ud_type, message, start):
|
|||
except FloodWait as e:
|
||||
await asyncio.sleep(e.value)
|
||||
await message.edit(f"{ud_type}\n {tmp}")
|
||||
except MessageNotModified:
|
||||
except (MessageNotModified, MessageIdInvalid):
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -139,13 +139,13 @@ async def shell(_, m):
|
|||
await m.reply("No Reply")
|
||||
|
||||
|
||||
@app.on_message(filters.command(["ev", "run"], COMMAND_HANDLER) & filters.user(SUDO))
|
||||
@app.on_edited_message(filters.command(["ev", "run"]) & filters.user(SUDO))
|
||||
@app.on_message((filters.command(["ev", "run"], COMMAND_HANDLER) | filters.regex(r"app.run\(\)$")) & filters.user(SUDO))
|
||||
@app.on_edited_message((filters.command(["ev", "run"]) | filters.regex(r"app.run\(\)$")) & filters.user(SUDO))
|
||||
@user.on_message(filters.command(["ev", "run"], ".") & filters.me)
|
||||
async def evaluation_cmd_t(_, m):
|
||||
cmd = m.text.split(" ", 1)
|
||||
if len(m.command) == 1:
|
||||
if len(m.command) == 1 and m.command:
|
||||
return await edit_or_reply(m, text="__No evaluate message!__")
|
||||
cmd = m.text.split(" ", 1)[1] if m.command else m.text.split("app.run()")[0]
|
||||
status_message = await editPesan(m, "<i>Processing eval pyrogram..</i>") if m.from_user.is_self else await kirimPesan(m, "<i>Processing eval pyrogram..</i>")
|
||||
|
||||
old_stderr = sys.stderr
|
||||
|
|
@ -155,7 +155,7 @@ async def evaluation_cmd_t(_, m):
|
|||
stdout, stderr, exc = None, None, None
|
||||
|
||||
try:
|
||||
await aexec(cmd[1], _, m)
|
||||
await aexec(cmd, _, m)
|
||||
except Exception:
|
||||
exc = traceback.format_exc()
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ async def evaluation_cmd_t(_, m):
|
|||
else:
|
||||
evaluation = "Success"
|
||||
|
||||
final_output = f"**EVAL**:\n`{cmd[1]}`\n\n**OUTPUT**:\n`{evaluation.strip()}`\n"
|
||||
final_output = f"**EVAL**:\n`{cmd}`\n\n**OUTPUT**:\n`{evaluation.strip()}`\n"
|
||||
|
||||
if len(final_output) > 4096:
|
||||
with open("MissKatyEval.txt", "w+", encoding="utf8") as out_file:
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ def welcomepic(pic, user, chat, count, id):
|
|||
return f"downloads/welcome#{id}.png"
|
||||
|
||||
|
||||
@app.on_chat_member_updated(filters.group & filters.chat(-1001128045651))
|
||||
@app.on_chat_member_updated(filters.group & filters.chat([-1001128045651, -1001777794636]))
|
||||
async def member_has_joined(c: app, member: ChatMemberUpdated):
|
||||
if not member.new_chat_member or member.new_chat_member.status in {"banned", "left", "restricted"} or member.old_chat_member:
|
||||
return
|
||||
|
|
@ -105,8 +105,8 @@ async def member_has_joined(c: app, member: ChatMemberUpdated):
|
|||
photo=welcomeimg,
|
||||
caption=f"Hai {mention}, Selamat datang digrup {member.chat.title} harap baca rules di pinned message terlebih dahulu.\n\n<b>Nama :<b> <code>{first_name}</code>\n<b>ID :<b> <code>{id}</code>\n<b>DC ID :<b> <code>{dc}</code>\n<b>Tanggal Join :<b> <code>{joined_date}</code>",
|
||||
)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
LOGGER.info(e)
|
||||
userspammer = ""
|
||||
# Spamwatch Detection
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ DETAILS
|
|||
except:
|
||||
try:
|
||||
link = await post_to_telegraph(False, "MissKaty MediaInfo", body_text)
|
||||
markup = InlineKeyboardMarkup([[InlineKeyboardButton(text="💬 View in Web", url=link)]])
|
||||
except:
|
||||
markup = None
|
||||
with io.BytesIO(str.encode(body_text)) as out_file:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMa
|
|||
from misskaty import BOT_USERNAME, app
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||
from misskaty.core.message_utils import hapusPesan, kirimPesan
|
||||
from misskaty.core.message_utils import editPesan, hapusPesan, kirimPesan
|
||||
from misskaty.helper.http import http
|
||||
from misskaty.helper.tools import rentry
|
||||
from misskaty.vars import COMMAND_HANDLER
|
||||
|
|
@ -58,7 +58,7 @@ def remove_html_tags(text):
|
|||
@app.on_message(filters.command("readqr", COMMAND_HANDLER))
|
||||
@ratelimiter
|
||||
async def readqr(c, m):
|
||||
if not m.reply and not m.reply.media and not m.reply.photo:
|
||||
if not m.reply and (not m.reply.media and not m.reply.photo):
|
||||
return await m.reply("Please reply photo that contain valid QR Code.")
|
||||
foto = await m.reply_to_message.download()
|
||||
myfile = {'file': (foto, open(foto, 'rb'),'application/octet-stream')}
|
||||
|
|
@ -171,12 +171,12 @@ async def translate(client, message):
|
|||
try:
|
||||
my_translator = GoogleTranslator(source="auto", target=target_lang)
|
||||
result = my_translator.translate(text=text)
|
||||
await msg.edit(f"Translation using source = {my_translator.source} and target = {my_translator.target}\n\n-> {result}")
|
||||
await editPesan(msg, f"Translation using source = {my_translator.source} and target = {my_translator.target}\n\n-> {result}")
|
||||
except MessageTooLong:
|
||||
url = await rentry(result)
|
||||
await msg.edit(f"Your translated text pasted to rentry because has long text:\n{url}")
|
||||
await editPesan(msg, f"Your translated text pasted to rentry because has long text:\n{url}")
|
||||
except Exception as err:
|
||||
await msg.edit(f"Error: <code>{str(err)}</code>")
|
||||
await editPesan(msg, f"Oppss, Error: <code>{str(err)}</code>")
|
||||
|
||||
|
||||
@app.on_message(filters.command(["tts"], COMMAND_HANDLER))
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ async def ytdownv2(_, message):
|
|||
markup = x.buttons
|
||||
await message.reply_photo(img, caption=caption, reply_markup=markup, quote=True)
|
||||
except Exception as err:
|
||||
await kirimPesan(message, str(err))
|
||||
await kirimPesan(message, f"Opps, ERROR: {str(err)}")
|
||||
|
||||
|
||||
@app.on_callback_query(filters.regex(r"^yt_listall"))
|
||||
|
|
@ -139,8 +139,11 @@ async def ytdl_gendl_callback(_, cq: CallbackQuery):
|
|||
ffmpeg_location="/usr/bin/mediaextract",
|
||||
delete_media=True,
|
||||
) as ytdl:
|
||||
upload_key = await ytdl.download(cq.message.reply_to_message.command[1], uid, format_, cq, True, 3)
|
||||
await ytdl.upload(app, upload_key[0], format_, cq, True)
|
||||
try:
|
||||
upload_key = await ytdl.download(cq.message.reply_to_message.command[1], uid, format_, cq, True, 3)
|
||||
await ytdl.upload(app, upload_key[0], format_, cq, True)
|
||||
except Exception as err:
|
||||
await cq.edit_message_caption(err)
|
||||
else:
|
||||
uid = callback[2]
|
||||
type_ = callback[3]
|
||||
|
|
@ -151,15 +154,18 @@ async def ytdl_gendl_callback(_, cq: CallbackQuery):
|
|||
ffmpeg_location="/usr/bin/mediaextract",
|
||||
delete_media=True,
|
||||
) as ytdl:
|
||||
upload_key = await ytdl.download(
|
||||
f"https://www.youtube.com/watch?v={key}",
|
||||
uid,
|
||||
format_,
|
||||
cq,
|
||||
True,
|
||||
3,
|
||||
)
|
||||
await ytdl.upload(app, upload_key[0], format_, cq, True)
|
||||
try:
|
||||
upload_key = await ytdl.download(
|
||||
f"https://www.youtube.com/watch?v={key}",
|
||||
uid,
|
||||
format_,
|
||||
cq,
|
||||
True,
|
||||
3,
|
||||
)
|
||||
await ytdl.upload(app, upload_key[0], format_, cq, True)
|
||||
except Exception as err:
|
||||
await cq.edit_message_caption(err)
|
||||
|
||||
|
||||
@app.on_callback_query(filters.regex(r"^ytdl_scroll"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue