genstava789 commited on
Commit
ebe6c1f
·
1 Parent(s): e36b54c
Files changed (1) hide show
  1. bot.py +12 -16
bot.py CHANGED
@@ -361,6 +361,10 @@ async def yt(client: Client, message: Message):
361
  await message.reply("Please provide a valid URL.")
362
  return
363
 
 
 
 
 
364
  url = message.text.split(maxsplit=1)[1]
365
  load = await message.reply('Downloading video please wait...')
366
  try:
@@ -373,22 +377,14 @@ async def yt(client: Client, message: Message):
373
  finally:
374
  await load.delete()
375
 
376
- @bot.on_message(filters.command("hi") & filters.reply)
377
- async def reply_hi(client: Client, message: Message):
378
- # Check if the message is a reply
379
- if message.reply_to_message:
380
- # Extract the text of the message being replied to
381
- original_text = message.reply_to_message.text or "[No text found]"
382
- response_text = f"Your message is: {original_text}"
383
-
384
- # Send the response as a reply to the original message
385
- await bot.send_message(
386
- chat_id=message.chat.id,
387
- text=response_text,
388
- reply_to_message_id=message.reply_to_message.id
389
- )
390
- else:
391
- await message.reply_text("Please reply to a message with /hi to use this command.")
392
 
393
  @bot.on_message(filters.document | filters.video | filters.photo)
394
  async def handle_media(client: Client, message: Message):
 
361
  await message.reply("Please provide a valid URL.")
362
  return
363
 
364
+ if not cookies_file:
365
+ await message.reply("Cookies file not set. Please send the cookies file using the /cookies command.")
366
+ return
367
+
368
  url = message.text.split(maxsplit=1)[1]
369
  load = await message.reply('Downloading video please wait...')
370
  try:
 
377
  finally:
378
  await load.delete()
379
 
380
+ @bot.on_message(filters.command("cookies") & filters.document)
381
+ async def set_cookies(client: Client, message: Message):
382
+ global cookies_file
383
+
384
+ # Download the cookies file
385
+ cookies_file = await message.download()
386
+ await message.reply(f"Cookies file has been set: {cookies_file}")
387
+
 
 
 
 
 
 
 
 
388
 
389
  @bot.on_message(filters.document | filters.video | filters.photo)
390
  async def handle_media(client: Client, message: Message):