import random
import re, asyncio, time, shutil, psutil, os, sys
from pyrogram import Client, filters, enums
from pyrogram.types import *
from info import BOT_START_TIME, ADMINS
from utils import humanbytes  

CMD = ["/", "."]

@Client.on_message(filters.command("alive", CMD))
async def check_alive(_, message):
    await message.reply_text("ğ�–¡ğ�—�ğ�–½ğ�–½ğ�—’ ğ�–¨ğ�–ºğ�—† ğ�– ğ�—…ğ�—‚ğ�—�ğ�–¾ :) ğ�–§ğ�—‚ğ�—� /start \n\nğ�–§ğ�—‚ğ�—� /help ğ�–¥ğ�—ˆğ�—‹ ğ�–§ğ�–¾ğ�—…ğ�—‰ ;)\n\n\nğ�–§ğ�—‚ğ�—� /ping ğ�–³ğ�—ˆ ğ�–¢ğ�—�ğ�–¾ğ�–¼ğ�—„ ğ�–¡ğ�—ˆğ�—� ğ�–¯ğ�—‚ğ�—‡ğ�—€ ğŸ˜�")

@Client.on_message(filters.command("help", CMD))
async def help(_, message):
    await message.reply_text("ğ�–§ğ�—‚ğ�—� /movie ğ�–¥ğ�—ˆğ�—‹ ğ�–¬ğ�—ˆğ�—�ğ�—‚ğ�–¾ ğ�–²ğ�–¾ğ�–ºğ�—‹ğ�–¼ğ�—� ğ�–±ğ�—�ğ�—…ğ�–¾ğ�—Œ ğŸ“ƒ\n\nğ�–§ğ�—‚ğ�—� /series ğ�–¥ğ�—ˆğ�—‹ ğ�–²ğ�–¾ğ�—‹ğ�—‚ğ�–¾ğ�—Œ ğ�–²ğ�–¾ğ�–ºğ�—‹ğ�–¼ğ�—� ğ�–±ğ�—�ğ�—…ğ�–¾ğ�—Œ ğŸ“ƒ\n\n\nğ�–§ğ�—‚ğ�—� /tutorial ğ�–¥ğ�—ˆğ�—‹ ğ�–¯ğ�—‹ğ�—ˆğ�—‰ğ�–¾ğ�—‹ ğ�–³ğ�—�ğ�—�ğ�—ˆğ�—‹ğ�—‚ğ�–ºğ�—… ğ�–µğ�—‚ğ�–½ğ�–¾ğ�—ˆğ�—Œ ğŸ¤—")


@Client.on_message(filters.command("movie", CMD))
async def movie(_, message):
    await message.reply_text("âš ï¸�â�—ï¸� ğ�— ğ�—¼ğ�˜ƒğ�—¶ğ�—² ğ�—¥ğ�—²ğ�—¾ğ�˜‚ğ�—²ğ�˜€ğ�˜� ğ�—™ğ�—¼ğ�—¿ğ�—ºğ�—®ğ�˜� â�—ï¸�âš ï¸�\n\nğŸ“� ğ�–¬ğ�—ˆğ�—�ğ�—‚ğ�–¾ ğ�–­ğ�–ºğ�—†ğ�–¾, ğ�–¸ğ�–¾ğ�–ºğ�—‹,(ğ�–¨ğ�–¿ ğ�—’ğ�—ˆğ�—� ğ�–ªğ�—‡ğ�—ˆğ�—�) ğ�–¶ğ�—‚ğ�—�ğ�—� ğ�–¢ğ�—ˆğ�—‹ğ�—‹ğ�–¾ğ�–¼ğ�—� ğ�–²ğ�—‰ğ�–¾ğ�—…ğ�—…ğ�—‚ğ�—‡ğ�—€ ğŸ“š\n\nğŸ—£ ğ�–¨ğ�–¿ ğ�–¨ğ�—� ğ�—‚ğ�—Œ ğ�–º ğ�–¥ğ�—‚ğ�—…ğ�—† ğ�–²ğ�–¾ğ�—‹ğ�—‚ğ�–¾ğ�—Œ. ğ�–±ğ�–¾ğ�—Šğ�—�ğ�–¾ğ�—Œğ�—� ğ�–®ğ�—‡ğ�–¾ ğ�–¡ğ�—’ ğ�–®ğ�—‡ğ�–¾ ğ�–¶ğ�—‚ğ�—�ğ�—� ğ�–¯ğ�—‹ğ�—ˆğ�—‰ğ�–¾ğ�—‹ ğ�–­ğ�–ºğ�—†ğ�–¾ ğŸ§ \n\nğŸ–‡ğ��„ğ��±ğ��šğ��¦ğ��©ğ��¥ğ���:\n\nâ€¢ Robin Hood âœ…\nâ€¢ Robin Hood 2010âœ…\nâ€¢ Kurup 2021 Kanâœ… \nâ€¢ Harry Potter and the Philosophers Stoneâœ…\nâ€¢ Harry Potter and the Prisoner of Azkabanâœ…\n\nğŸ¥± ğ�–¥ğ�—ˆğ�—‹ ğ�–«ğ�–ºğ�—‡ğ�—€ğ�—�ğ�–ºğ�—€ğ�–¾ ğ�– ğ�—�ğ�–½ğ�—‚ğ�—ˆğ�—Œ - ğ�–ªğ�–ºğ�—‡ ğ�–¿ğ�—ˆğ�—‹ ğ�–ªğ�–ºğ�—‡ğ�—‡ğ�–ºğ�–½ğ�–º, ğ�–¬ğ�–ºğ�—… - ğ�–¬ğ�–ºğ�—…ğ�–ºğ�—’ğ�–ºğ�—…ğ�–ºğ�—†, ğ�–³ğ�–ºğ�—† - ğ�–³ğ�–ºğ�—†ğ�—‚ğ�—…\n\nğŸ”� ğ�–´ğ�—Œğ�–¾ ğ�–¥ğ�—‚ğ�—‹ğ�—Œğ�—� 3 ğ�–«ğ�–¾ğ�—�ğ�—�ğ�–¾ğ�—‹ğ�—Œ ğ�–®ğ�–¿ ğ�–«ğ�–ºğ�—‡ğ�—€ğ�—�ğ�–ºğ�—€ğ�–¾ ğ�–¥ğ�—ˆğ�—‹ ğ�– ğ�—�ğ�–½ğ�—‚ğ�—ˆğ�—Œ [ğ�–ªğ�–ºğ�—‡ ğ�–³ğ�–ºğ�—† ğ�–³ğ�–¾ğ�—… ğ�–¬ğ�–ºğ�—… ğ�–§ğ�—‚ğ�—‡ ğ�–²ğ�—‰ğ�–º ğ�–¤ğ�—‡ğ�—€ ğ�–ªğ�—ˆğ�—‹ ğ�–¾ğ�—�ğ�–¼...]\n\nâ�Œ [ğ�——ğ�—¼ğ�—»ğ�˜� ğ�—¨ğ�˜€ğ�—² ğ�˜„ğ�—¼ğ�—¿ğ�—±ğ�˜€ ğ�—Ÿğ�—¶ğ�—¸ğ�—² ğ�——ğ�˜‚ğ�—¯ğ�—¯ğ�—²ğ�—±/ğ�— ğ�—¼ğ�˜ƒğ�—¶ğ�—²ğ�˜€/ğ�—¦ğ�—²ğ�—»ğ�—±/ğ�—›ğ�—— , . : - ğ�—²ğ�˜�ğ�—°] â�Œ")

@Client.on_message(filters.command("series", CMD))
async def series(_, message):
    await message.reply_text("âš ï¸�â�—ï¸� ğ�—¦ğ�—²ğ�—¿ğ�—¶ğ�—²ğ�˜€ ğ�—¥ğ�—²ğ�—¾ğ�˜‚ğ�—²ğ�˜€ğ�˜� ğ�—™ğ�—¼ğ�—¿ğ�—ºğ�—®ğ�˜� â�—ï¸�âš ï¸�\n\nğŸ—£ ğ�–²ğ�–¾ğ�—‹ğ�—‚ğ�–¾ğ�—Œ ğ�–­ğ�–ºğ�—†ğ�–¾,ğ�–²ğ�–¾ğ�–ºğ�—Œğ�—ˆğ�—‡ (ğ�–¶ğ�—�ğ�—‚ğ�–¼ğ�—� ğ�–²ğ�–¾ğ�–ºğ�—Œğ�—ˆğ�—‡ ğ�—’ğ�—ˆğ�—� ğ�—�ğ�–ºğ�—‡ğ�—�) ğŸ§ \n\nğŸ–‡ğ��„ğ��±ğ��šğ��¦ğ��©ğ��¥ğ���: \n\nâ€¢ Game Of Thrones S03ğ�–¤02 720ğ�—‰âœ…\nâ€¢ Sex Education S02 720pâœ… \nâ€¢ Breaking Bad S01E05âœ… \nâ€¢ Prison Break 1080pâœ… \nâ€¢ Witcher S02âœ…\n\nğŸ¥± ğ�–¥ğ�—ˆğ�—‹ ğ�–²ğ�–¾ğ�–ºğ�—Œğ�—ˆğ�—‡ ğ�–¬ğ�–¾ğ�—‡ğ�—�ğ�—‚ğ�—ˆğ�—‡ ğ�– ğ�—Œ ğ�–²01 ğ�–¥ğ�—ˆğ�—‹ ğ�–²ğ�–¾ğ�–ºğ�—Œğ�—ˆğ�—‡ 1, ğ�–²02 ğ�–¥ğ�—ˆğ�—‹ ğ�–²ğ�–¾ğ�–ºğ�—Œğ�—ˆğ�—‡ 2 ğ�–¾ğ�—�ğ�–¼ [ğ�–²03,ğ�–²04 ,ğ�–²06,ğ�–²10,ğ�–²17] ğ�–¦ğ�—ˆğ�–¾ğ�—Œ ğ�–«ğ�—‚ğ�—„ğ�–¾ ğ�–³ğ�—�ğ�–ºğ�—�\n\nğŸ”� ğ�–¥ğ�—ˆğ�—‹ ğ�–¤ğ�—‰ğ�—‚ğ�—Œğ�—ˆğ�–½ğ�–¾ ğ�–¬ğ�–¾ğ�—‡ğ�—�ğ�—‚ğ�—ˆğ�—‡ ğ�– ğ�—Œ ğ�–¤ğ�—‰01 ğ�–¥ğ�—ˆğ�—‹ ğ�–¤ğ�—‰ğ�—‚ğ�—Œğ�—ˆğ�–½ğ�–¾ 1, ğ�–¤ğ�—‰02 ğ�–¥ğ�—ˆğ�—‹ ğ�–¤ğ�—‰ğ�—‚ğ�—Œğ�—ˆğ�–½ğ�–¾ 2 ğ�–¾ğ�—�ğ�–¼ [ğ�–¤ğ�—‰03,ğ�–¤ğ�—‰07,ğ�–¤ğ�—‰17,ğ�–¤ğ�—‰21] ğ�–¦ğ�—ˆ'ğ�—Œ ğ�–«ğ�—‚ğ�—„ğ�–¾ ğ�–³ğ�—�ğ�–ºğ�—� \n\nâ�Œ [ğ�——ğ�—¼ğ�—»ğ�˜� ğ�—¨ğ�˜€ğ�—² ğ�˜„ğ�—¼ğ�—¿ğ�—±ğ�˜€ ğ�—Ÿğ�—¶ğ�—¸ğ�—² ğ�—¦ğ�—²ğ�—®ğ�˜€ğ�—¼ğ�—»/ğ�—˜ğ�—½ğ�—¶ğ�˜€ğ�—¼ğ�—±ğ�—²/ğ�—¦ğ�—²ğ�—¿ğ�—¶ğ�—²ğ�˜€ , . : - ğ�—²ğ�˜�ğ�—°] â�Œ")

@Client.on_message(filters.command("tutorial", CMD))
async def tutorial(_, message):
    await message.reply_text("ğ�–¢ğ�—�ğ�–¾ğ�–¼ğ�—„ğ�—ˆğ�—�ğ�—� @piro_tuts ğ�–¥ğ�—ˆğ�—‹ ğ�–³ğ�—�ğ�—�ğ�—ˆğ�—‹ğ�—‚ğ�–ºğ�—…ğ�—Œ ğŸ˜�")

@Client.on_message(filters.command("ping", CMD))
async def ping(_, message):
    start_t = time.time()
    rm = await message.reply_text("...........")
    end_t = time.time()
    time_taken_s = (end_t - start_t) * 1000
    await rm.edit(f"ğ�–¯ğ�—‚ğ�—‡ğ�—€!\n{time_taken_s:.3f} ms")

@Client.on_message(filters.command("status"))          
async def stats(bot, update):
    currentTime = time.strftime("%Hh%Mm%Ss", time.gmtime(time.time() - BOT_START_TIME))
    total, used, free = shutil.disk_usage(".")
    total = humanbytes(total)
    used = humanbytes(used)
    free = humanbytes(free)
    cpu_usage = psutil.cpu_percent()
    ram_usage = psutil.virtual_memory().percent
    disk_usage = psutil.disk_usage('/').percent

    ms_g = f"""<b>âš™ï¸� ğ�–¡ğ�—ˆğ�—� ğ�–²ğ�—�ğ�–ºğ�—�ğ�—�ğ�—Œ</b>

ğŸ•” ğ�–´ğ�—‰ğ�—�ğ�—‚ğ�—†ğ�–¾: <code>{currentTime}</code>
ğŸ›  ğ�–¢ğ�–¯ğ�–´ ğ�–´ğ�—Œğ�–ºğ�—€ğ�–¾: <code>{cpu_usage}%</code>
ğŸ—œ ğ�–±ğ�– ğ�–¬ ğ�–´ğ�—Œğ�–ºğ�—€ğ�–¾: <code>{ram_usage}%</code>
ğŸ—‚ ğ�–³ğ�—ˆğ�—�ğ�–ºğ�—… ğ�–£ğ�—‚ğ�—Œğ�—„ ğ�–²ğ�—‰ğ�–ºğ�–¼ğ�–¾: <code>{total}</code>
ğŸ—³ ğ�–´ğ�—Œğ�–¾ğ�–½ ğ�–²ğ�—‰ğ�–ºğ�–¼ğ�–¾: <code>{used} ({disk_usage}%)</code>
ğŸ“� ğ�–¥ğ�—‹ğ�–¾ğ�–¾ ğ�–²ğ�—‰ğ�–ºğ�–¼ğ�–¾: <code>{free}</code> """

    msg = await bot.send_message(chat_id=update.chat.id, text="__ğ�–¯ğ�—‹ğ�—ˆğ�–¼ğ�–¾ğ�—Œğ�—Œğ�—‚ğ�—‡ğ�—€...__", parse_mode=enums.ParseMode.MARKDOWN)         
    await msg.edit_text(text=ms_g, parse_mode=enums.ParseMode.HTML)

@Client.on_message(filters.command("restart") & filters.user(ADMINS))
async def stop_button(bot, message):
    msg = await bot.send_message(text="**ğ�–¡ğ�—ˆğ�—� ğ�–¨ğ�—Œ ğ�–±ğ�–¾ğ�—Œğ�—�ğ�–ºğ�—‹ğ�—�ğ�—‚ğ�—‡ğ�—€...ğŸª„**", chat_id=message.chat.id)       
    await asyncio.sleep(3)
    await msg.edit("**ğ�–¡ğ�—ˆğ�—� ğ�–±ğ�–¾ğ�—Œğ�—�ğ�–ºğ�—‹ğ�—�ğ�–¾ğ�–½ ğ�–²ğ�—�ğ�–¼ğ�–¼ğ�–¾ğ�—Œğ�—Œğ�–¿ğ�—�ğ�—…ğ�—…ğ�—’ ! ğ�–±ğ�–¾ğ�–ºğ�–½ğ�—’ ğ�–³ğ�—ˆ ğ�–¬ğ�—ˆğ�—�ğ�–¾ ğ�–®ğ�—‡ ğŸ’¯**")
    os.execl(sys.executable, sys.executable, *sys.argv)