mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Fix
This commit is contained in:
parent
2fdc57acb0
commit
c1a27f1f42
5 changed files with 42 additions and 19 deletions
|
|
@ -180,8 +180,7 @@ async def commands_callbacc(_, CallbackQuery):
|
|||
text=text,
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
|
||||
await CallbackQuery.message.delete()
|
||||
await hapusPesan(CallbackQuery.message)
|
||||
|
||||
|
||||
@app.on_callback_query(filters.regex("stats_callback"))
|
||||
|
|
@ -308,7 +307,7 @@ General command are:
|
|||
text=home_text_pm,
|
||||
reply_markup=home_keyboard_pm,
|
||||
)
|
||||
await query.message.delete()
|
||||
await hapusPesan(query.message)
|
||||
elif prev_match:
|
||||
curr_page = int(prev_match[1])
|
||||
await editPesan(
|
||||
|
|
@ -351,9 +350,6 @@ General command are:
|
|||
return await client.answer_callback_query(query.id)
|
||||
|
||||
|
||||
async def cleanup():
|
||||
await app.stop()
|
||||
await user.stop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
@ -365,6 +361,5 @@ if __name__ == "__main__":
|
|||
err = traceback.format_exc()
|
||||
LOGGER.error(err)
|
||||
finally:
|
||||
loop.run_until_complete(cleanup())
|
||||
loop.stop()
|
||||
print("------------------------ Stopped Services ------------------------")
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ async def byPassPh(url: str, msg_id: int):
|
|||
telegraph = Telegraph()
|
||||
if telegraph.get_access_token() is None:
|
||||
await telegraph.create_account(short_name=BOT_USERNAME)
|
||||
LOGGER.info("Create TGH Account ..")
|
||||
page = await telegraph.create_page(f"{kusonime.get('title')}-{msg_id}", html_content=html)
|
||||
LOGGER.info(page)
|
||||
results |= {"error": False, "url": f'https://telegra.ph/{page["path"]}'}
|
||||
del results["error_message"]
|
||||
return results
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ async def imdb_search_id(kueri, message):
|
|||
elif year := movie.get("y"):
|
||||
year = f"({year})"
|
||||
else:
|
||||
year = "N/A"
|
||||
year = "(N/A)"
|
||||
typee = movie.get("q", "N/A").replace("feature", "movie").title()
|
||||
movieID = re.findall(r"tt(\d+)", movie.get("id"))[0]
|
||||
msg += f"{num}. {title} {year} - {typee}\n"
|
||||
|
|
@ -166,7 +166,7 @@ async def imdb_search_en(kueri, message):
|
|||
elif year := movie.get("y"):
|
||||
year = f"({year})"
|
||||
else:
|
||||
year = "N/A"
|
||||
year = "(N/A)"
|
||||
typee = movie.get("q", "N/A").replace("feature", "movie").title()
|
||||
movieID = re.findall(r"tt(\d+)", movie.get("id"))[0]
|
||||
msg += f"{num}. {title} {year} - {typee}\n"
|
||||
|
|
@ -222,7 +222,7 @@ async def imdbcari(client, query):
|
|||
elif year := movie.get("y"):
|
||||
year = f"({year})"
|
||||
else:
|
||||
year = "N/A"
|
||||
year = "(N/A)"
|
||||
typee = movie.get("q", "N/A").replace("feature", "movie").title()
|
||||
movieID = re.findall(r"tt(\d+)", movie.get("id"))[0]
|
||||
msg += f"{num}. {title} {year} - {typee}\n"
|
||||
|
|
@ -261,7 +261,7 @@ async def imdbcari(client, query):
|
|||
elif year := movie.get("y"):
|
||||
year = f"({year})"
|
||||
else:
|
||||
year = "N/A"
|
||||
year = "(N/A)"
|
||||
typee = movie.get("q", "N/A").replace("feature", "movie").title()
|
||||
movieID = re.findall(r"tt(\d+)", movie.get("id"))[0]
|
||||
msg += f"{num}. {title} {year} - {typee}\n"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ 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 http, progress_for_pyrogram, runcmd
|
||||
from misskaty.helper import http, progress_for_pyrogram, runcmd, post_to_telegraph
|
||||
from misskaty.vars import COMMAND_HANDLER
|
||||
from utils import get_file_id
|
||||
|
||||
|
|
@ -47,7 +47,6 @@ async def mediainfo(client, message):
|
|||
{out or 'Not Supported'}
|
||||
"""
|
||||
text_ = file_info.message_type
|
||||
# link = await post_to_telegraph(False, title, body_text)
|
||||
try:
|
||||
json_data = {
|
||||
"content": body_text,
|
||||
|
|
@ -59,8 +58,11 @@ async def mediainfo(client, message):
|
|||
response = await http.post("https://paste.yasir.eu.org/api/new", json=json_data)
|
||||
link = f"https://paste.yasir.eu.org/{response.json()['id']}"
|
||||
markup = InlineKeyboardMarkup([[InlineKeyboardButton(text="💬 View in Web", url=link)]])
|
||||
except Exception as e:
|
||||
markup = None
|
||||
except:
|
||||
try:
|
||||
link = await post_to_telegraph(False, "MissKaty MediaInfo", body_text)
|
||||
except:
|
||||
markup = None
|
||||
with io.BytesIO(str.encode(body_text)) as out_file:
|
||||
out_file.name = "MissKaty_Mediainfo.txt"
|
||||
await message.reply_document(
|
||||
|
|
@ -99,7 +101,10 @@ async def mediainfo(client, message):
|
|||
link = f"https://paste.yasir.eu.org/{response.json()['id']}"
|
||||
markup = InlineKeyboardMarkup([[InlineKeyboardButton(text="💬 View in Web", url=link)]])
|
||||
except:
|
||||
markup = None
|
||||
try:
|
||||
link = await post_to_telegraph(False, "MissKaty MediaInfo", body_text)
|
||||
except:
|
||||
markup = None
|
||||
with io.BytesIO(str.encode(output)) as out_file:
|
||||
out_file.name = "MissKaty_Mediainfo.txt"
|
||||
await message.reply_document(
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import json
|
||||
import os
|
||||
from select import KQ_FILTER_TIMER
|
||||
import time
|
||||
import asyncio
|
||||
import traceback
|
||||
|
|
@ -39,6 +40,8 @@ __HELP__ = """
|
|||
(/tr, /trans, /translate) [lang code] - Translate text using Google Translate.
|
||||
/tts - Convert Text to Voice.
|
||||
/imdb [query] - Find Movie Details From IMDB.com (Available in English and Indonesia version).
|
||||
/readqr [reply to photo] - Read QR Code From Photo.
|
||||
/makeqr [text] - Convert Text to QR Code.
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -50,6 +53,29 @@ def remove_html_tags(text):
|
|||
return re.sub(clean, "", text)
|
||||
|
||||
|
||||
@app.on_message(filter.command("readqr", COMMAND_HANDLER))
|
||||
async def readqr(c, m):
|
||||
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')}
|
||||
url = 'http://api.qrserver.com/v1/read-qr-code/'
|
||||
r = await http.post(url, files=myfile)
|
||||
os.remove(foto)
|
||||
if res := r.json()[0]['symbol'][0]['data'] is None:
|
||||
return await kirimPesan(m, res)
|
||||
await kirimPesan(m, r.json()[0]['symbol'][0]['data'])
|
||||
|
||||
|
||||
@app.on_message(filter.command("makeqr", COMMAND_HANDLER))
|
||||
async def makeqr(c, m):
|
||||
if len(m.command) == 1:
|
||||
return await m.reply("Please add text after command to convert text -> QR Code.")
|
||||
teks = m.text.split(None, 1)[1]
|
||||
url = f"https://api.qrserver.com/v1/create-qr-code/?data={teks}&size=300x300"
|
||||
await m.reply_photo(url)
|
||||
|
||||
|
||||
@app.on_message(filters.command(["sof"], COMMAND_HANDLER))
|
||||
@capture_err
|
||||
async def stackoverflow(client, message):
|
||||
|
|
@ -356,7 +382,6 @@ async def mdlsearch(client, message):
|
|||
|
||||
|
||||
@app.on_callback_query(filters.regex("^mdls"))
|
||||
@capture_err
|
||||
async def mdl_callback(bot: Client, query: CallbackQuery):
|
||||
i, user, msg_id, slug = query.data.split("#")
|
||||
if user == f"{query.from_user.id}":
|
||||
|
|
|
|||
Loading…
Reference in a new issue