From 07a0b2f2373b04eaf3aecd588fe8d3e9c78e8bbb Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 25 Oct 2021 18:55:09 +0700 Subject: [PATCH] none --- program/ytsearch.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) 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))