This commit is contained in:
levina 2021-10-25 18:55:09 +07:00 committed by GitHub
parent aa5a961369
commit 07a0b2f237
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))