diff --git a/program/ytsearch.py b/program/ytsearch.py index bc11124..02980fb 100644 --- a/program/ytsearch.py +++ b/program/ytsearch.py @@ -1,20 +1,34 @@ import logging -from pyrogram import Client from config import BOT_USERNAME -from pyrogram.types import Message -from helpers.filters import command +from driver.filters import command +from pyrogram import Client +from pyrogram.types import ( + InlineKeyboardButton, + InlineKeyboardMarkup, + Message, +) from youtube_search import YoutubeSearch - logging.basicConfig( - level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" -) + level=logging.DEBUG, + format="%(asctime)s - %(name)s - %(levelname)s - %(message)s") logger = logging.getLogger(__name__) logging.getLogger("pyrogram").setLevel(logging.WARNING) @Client.on_message(command(["search", f"search@{BOT_USERNAME}"])) async def ytsearch(_, message: Message): + + keyboard = InlineKeyboardMarkup( + [ + [ + InlineKeyboardButton( + "🗑 Close", callback_data="cls", + ) + ] + ] + ) + try: if len(message.command) < 2: await message.reply_text("/search **needs an argument !**") @@ -31,6 +45,6 @@ async def ytsearch(_, message: Message): text += f"📣 **Channel:** {results[i]['channel']}\n" text += f"🔗: https://www.youtube.com{results[i]['url_suffix']}\n\n" i += 1 - await m.edit(text, disable_web_page_preview=True) + await m.edit(text, reply_markup=keyboard, disable_web_page_preview=True) except Exception as e: await m.edit(str(e))