Hello everyone, I'm a beginner and I can't convert this userbot into a regular one, you can help
from youtube_search import YoutubeSearch
logger = logging.getLogger(__name__)
def register(cb):
cb(YTsearchod())
@loader.tds
class YTsearchMod(loader.Module):
"""Поиск видео на ютубе"""
strings = {
"name": "YTsearch"
}
async def client_ready(self, client, db):
self.client = client
@loader.sudo
async def ytcmd(self, message):
"""текст или реплай"""
text = utils.get_args_raw(message)
if not text:
reply = await message.get_reply_message()
if not reply:
await message.delete()
return
text = reply.raw_text
results = YoutubeSearch(text, max_results=10).to_dict()
out = f'Найдено по запросу: {text}'
for r in results:
out += f'\n\n<a href="
https://www.youtube.com/{r["link"]}">{r["title"]}</a>'
await message.edit(out)