
    i                         d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlZ ej        e          Zdedej        fd	Zdedej        fd
Zdedej        fdZdedej        fdZdedej        fdZdedej        fdZdedej        fdZdS )z$
Basic command handlers for the bot
    )UpdateInlineKeyboardButtonInlineKeyboardMarkup)ContextTypes)db)ConfigNupdatecontextc                 P  K   | j         }t          j        |j        |j        |j                   d{V  d|j         d}t          dd          t          dd          gt          d	d
          gg}t          |          }| j        	                    ||d           d{V  dS )zHandle /start commandNu9   
🎬 **Welcome to All-in-One Video Editor Bot!**

Hello u  ! 👋

I'm your complete video toolkit on Telegram. I can help you with:

🎞️ **Video Operations**
• Merge multiple videos
• Trim videos to perfect length
• Compress videos (HEVC/Fast)
• Rename video files
• Encode to different formats

🎨 **Advanced Editing**
• Generate screenshots
• Add watermarks
• Extract/Add subtitles
• Extract/Add audio
• Set permanent thumbnails

📦 **File Management**
• Create archives (zip, tar, rar)
• Extract archives
• View metadata
• Track storage usage

🌐 **Download/Upload**
• URL uploader (streaming platforms)
• Direct link generator

**Get Started:**
Use /help to see all available commands!
u	   📖 Helphelp)callback_datau   ℹ️ Aboutaboutu   📊 My StatsstatsMarkdown)reply_markup
parse_mode)
effective_userr   add_useridusername
first_namer   r   message
reply_text)r	   r
   userwelcome_textkeyboardr   s         /app/handlers/basic_handlers.pystart_handlerr      s       D
+dgt}do
>
>>>>>>>>! ! ! !LH 
k	@	@	@	nG	D	D	D	F	oW	E	E	EFH
 (11L
.
#
#! $               c                 R   K   d}| j                             |d           d{V  dS )zHandle /help commandu-  
📚 **Available Commands:**

**Video Operations:**
/merge - Merge multiple videos
/trim - Trim video (start_time end_time)
/compress - Compress video (hevc/fast)
/rename - Rename video file
/encode - Encode video to different format

**Media Extraction:**
/screenshot - Generate screenshot from video
/extract_audio - Extract audio from video
/extract_subs - Extract subtitles from video
/add_audio - Add audio to video
/add_subs - Add subtitles to video

**Watermark & Thumbnail:**
/add_watermark - Add watermark to video
/set_thumbnail - Set permanent thumbnail
/show_thumbnail - Show your thumbnail
/delete_thumbnail - Delete your thumbnail

**Archives:**
/archive - Create archive (zip/tar/rar)
/extract - Extract archive

**Info & Settings:**
/metadata - View video metadata
/storage - Check storage usage
/stats - View your statistics

**Download/Upload:**
/download - Download from URL
/generate_link - Generate direct download link

**Admin Only:**
/broadcast - Send message to all users
/stats_all - View bot statistics

Use these commands with video files!
r   r   Nr   r   )r	   r
   	help_texts      r   help_handlerr$   A   sC      )IV .
#
#I*
#
E
EEEEEEEEEEr   c                    K   | j         j        }t          j        |           d{V }ddlm} |                    |          }d| d| d}| j                            |d           d{V  dS )	zHandle /stats commandNr   )VideoProcessoru/   
📊 **Your Statistics:**

💾 Storage Used: u   
👤 User ID: `z2`

Use /storage for detailed storage information.
r   r!   )	r   r   r   get_storageutils.video_utilsr&   format_sizer   r   )r	   r
   user_idstorager&   storage_formatted
stats_texts          r   stats_handlerr.   p   s      #&GN7++++++++G000000&227;; &  	  J .
#
#J:
#
F
FFFFFFFFFFr   c                 R   K   d}| j                             |d           d{V  dS )zHandle /about commandu  
🎬 **All-in-One Video Editor Bot**

Version: 1.0.0
Powered by FFmpeg & Python

**Features:**
✅ 15+ Video Processing Tools
✅ MongoDB Integration
✅ Broadcast Support
✅ Permanent Thumbnail Support
✅ Storage Tracking
✅ Multiple Format Support

**Developer:**
Made with ❤️ for Telegram users

**Support:**
For issues or suggestions, contact the admin.

*Transform videos like a pro!* 🎥✨
r   r!   Nr"   )r	   r
   
about_texts      r   about_handlerr1      sB      J. .
#
#J:
#
F
FFFFFFFFFFr   c                   K   | j         j        }|t          j        vr"| j                            d           d{V  dS |j        s"| j                            d           d{V  dS d                    |j                  }t          j	                     d{V }d}d}| j                            d           d{V }|D ]s}	 |j
                            |d         |d	           d{V  |d
z  }2# t          $ r5}	|d
z  }t                              d|d          d|	            Y d}	~	ld}	~	ww xY w|                    d| d|            d{V  dS )z&Handle /broadcast command (admin only)$   ⛔ This command is only for admins.NzCUsage: /broadcast <message>

The message will be sent to all users. r   u   📢 Broadcasting message...r*   r   )chat_idtextr      zFailed to send to z: u"   ✅ Broadcast Complete!

Success: z	
Failed: )r   r   r   	ADMIN_IDSr   r   argsjoinr   get_all_usersbotsend_message	Exceptionloggererror	edit_text)
r	   r
   r*   r   userssuccessfailed
status_msgr   es
             r   broadcast_handlerrG      s1     #&Gf&&&n''(NOOOOOOOOO< n''5
 
 	
 	
 	
 	
 	
 	
 	
 	hhw|$$G"$$$$$$$$EGF~001OPPPPPPPPJ 
F 
F		F+**Y% +         
 qLGG 	F 	F 	FaKFLLDd9oDDDDEEEEEEEE	F 

		 		 	          s   .C33
D2=+D--D2c                   K   | j         j        }|t          j        vr"| j                            d           d{V  dS t          j                     d{V }d| d}| j                            |d           d{V  dS )z&Handle /stats_all command (admin only)r3   Nu-   
📊 **Bot Statistics:**

👥 Total Users: u'   

Database: MongoDB
Status: ✅ Active
r   r!   )r   r   r   r8   r   r   r   get_users_count)r	   r
   r*   total_usersr-   s        r   stats_all_handlerrK      s      #&Gf&&&n''(NOOOOOOOOO*,,,,,,,,K   J .
#
#J:
#
F
FFFFFFFFFFr   c                   K   | j         }|                                 d{V  |j        dk    rt          | |           d{V  dS |j        dk    rt	          | |           d{V  dS |j        dk    rt          | |           d{V  dS dS )zHandle inline button callbacksNr   r   r   )callback_queryanswerdatar$   r1   r.   )r	   r
   querys      r   button_handlerrQ      s      !E
,,..zV67+++++++++++	w		FG,,,,,,,,,,,	w		FG,,,,,,,,,,, 
	r   )__doc__telegramr   r   r   telegram.extr   databaser   configr   logging	getLogger__name__r?   DEFAULT_TYPEr   r$   r.   r1   rG   rK   rQ    r   r   <module>r\      s    H G G G G G G G G G % % % % % %             		8	$	$3 31J 3 3 3 3j-Fv -F0I -F -F -F -F^G G1J G G G G&G G1J G G G G6'F '\5N ' ' ' 'RGF G\5N G G G G*
- 
-,2K 
- 
- 
- 
- 
- 
-r   