Tes auto exp callback

This commit is contained in:
yasirarism 2023-04-24 20:42:15 +07:00 committed by GitHub
parent 39277846db
commit f5be851180
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 7 deletions

View file

@ -1,5 +1,6 @@
import openai
import asyncio
import html
from aiohttp import ClientSession
from pyrogram import filters, Client
from pyrogram.types import Message
@ -42,7 +43,7 @@ async def chatbot(self: Client, ctx: Message, strings):
await msg.edit_msg(answer)
await openai.aiosession.get().close()
except MessageTooLong:
answerlink = await post_to_telegraph(False, "MissKaty ChatBot ", answer)
answerlink = await post_to_telegraph(False, "MissKaty ChatBot ", html.escape(answer))
await msg.edit_msg(strings("answers_too_long").format(answerlink=answerlink), disable_web_page_preview=True)
except Exception as err:
await msg.edit_msg(f"ERROR: {str(err)}")

View file

@ -304,7 +304,7 @@ async def update_restart(self: Client, ctx: Message, strings) -> "Message":
async def updtebot(client, update, users, chats):
if isinstance(update, UpdateBotStopped):
user = users[update.user_id]
await client.send_msg(LOG_CHANNEL, f"{user.first_name} ({user.id}) " f"{'BLOCKED' if update.stopped else 'UNBLOCKED'} the bot at " f"{datetime.fromtimestamp(update.date)}")
await client.send_msg(LOG_CHANNEL, f"<a href='tg://user?id={user.id}'>{user.first_name}</a> ({user.id}) " f"{'BLOCKED' if update.stopped else 'UNBLOCKED'} the bot at " f"{datetime.fromtimestamp(update.date)}")
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")))

View file

@ -23,10 +23,10 @@ __HELP__ = """
/download [url] - Download file from URL (Sudo Only)
/download [reply_to_TG_File] - Download TG File
/tgraph_up [reply_to_TG_File] - Download TG File
/tiktokdl [link] - Download TikTok Video
/fbdl [link] - Download Facebook Video
/anon [link] - Upload files to Anonfiles
/ytdown [link] - Download YouTube dengan YT-DLP
/tiktokdl [link] - Download TikTok Video, try use ytdown command if error.
/fbdl [link] - Download Facebook Video.
/anon [link] - Upload files to Anonfiles.
/ytdown [YT-DLP Supported URL] - Downloading YT-DLP Supported Video and Audio.
"""

View file

@ -16,6 +16,7 @@ from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, InputMedi
from database.imdb_db import *
from misskaty import BOT_USERNAME, app
from misskaty.core.decorator.errors import capture_err
from misskaty.core.misskaty_patch.listen.listen import ListenerTimeout
from misskaty.core.decorator.ratelimiter import ratelimiter
from misskaty.helper import http, get_random_string, search_jw, GENRES_EMOJI
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL
@ -50,12 +51,17 @@ async def imdb_choose(self: Client, ctx: Message):
)
buttons.row(InlineButton("🚩 Set Default Language", f"imdbset#{ctx.from_user.id}"))
buttons.row(InlineButton("❌ Close", f"close#{ctx.from_user.id}"))
await ctx.reply_photo(
msg = await ctx.reply_photo(
"https://telegra.ph/file/270955ef0d1a8a16831a9.jpg",
caption=f"Hi {ctx.from_user.mention}, Please select the language you want to use on IMDB Search. If you want use default lang for every user, click third button. So no need click select lang if use CMD.",
reply_markup=buttons,
quote=True,
)
try:
await msg.wait_for_click(from_user_id=ctx.from_user.id, timeout=30)
except ListenerTimeout:
del LIST_CARI[ranval]
await msg.edit_caption("😶‍🌫️ Callback Query Timeout. Task Has Been Canceled!")
@app.on_callback_query(filters.regex("^imdbset"))