Skip to content

Commit

Permalink
[MissKaty] Tes IMDb Callback Timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Yasir Aris M <[email protected]>
  • Loading branch information
yasirarism authored Dec 26, 2023
1 parent bb266ee commit dadeeb6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions misskaty/plugins/imdb_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pykeyboard import InlineButton, InlineKeyboard
from pyrogram import Client, enums
from pyrogram.errors import (
ListenerTimeout,
MediaCaptionTooLong,
MediaEmpty,
MessageIdInvalid,
Expand Down Expand Up @@ -61,19 +62,25 @@ async def imdb_choose(_, ctx: Message):
return await imdb_search_id(kuery, ctx)
buttons = InlineKeyboard()
ranval = get_random_string(4)
LIST_CARI.add(ranval, kuery, timeout=30)
LIST_CARI.add(ranval, kuery, timeout=15)
buttons.row(
InlineButton("🇺🇸 English", f"imdbcari#eng#{ranval}#{ctx.from_user.id}"),
InlineButton("🇮🇩 Indonesia", f"imdbcari#ind#{ranval}#{ctx.from_user.id}"),
)
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(
"https://img.yasirweb.eu.org/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,
)
while 1:
cl = await ctx.reply_photo(
"https://img.yasirweb.eu.org/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.\n\nTimeout: 10s",
reply_markup=buttons,
quote=True,
)
try:
await cl.wait_for_click(ctx.from_user.id, timeout=10)
except ListenerTimeout:
await cl.message.edit("Task Timeout")
break


@app.on_cb("imdbset")
Expand Down

0 comments on commit dadeeb6

Please sign in to comment.