diff --git a/misskaty/plugins/imdb_search.py b/misskaty/plugins/imdb_search.py index 29686c5c83..02ed9a484e 100644 --- a/misskaty/plugins/imdb_search.py +++ b/misskaty/plugins/imdb_search.py @@ -15,6 +15,7 @@ from pykeyboard import InlineButton, InlineKeyboard from pyrogram import Client, enums from pyrogram.errors import ( + ListenerTimeout, MediaCaptionTooLong, MediaEmpty, MessageIdInvalid, @@ -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")