@jsorganization · Post #456 · 2024/07/07 09:32
Set Bed Time / Restrictions For Command Use Between 12 AM To 6 AM Bangladesh Time 🗓 TBC PYTHON CODE🤖 Command Name : YOUR COMMAND NAME Code : JS_Organizations = libs.dateandtime.now('Asia/Dhaka') hours = int(JS_Organizations['time'].split(':')[0]) minutes = int(JS_Organizations['time'].split(':')[1]) seconds = int(JS_Organizations['time'].split(':')[2]) bed_time_start = 0 # 12 AM in 24-hour format bed_time_end = 6 # 6 AM in 24-hour format if hours >= bed_time_start and hours < bed_time_end: remaining_hours = bed_time_end - hours - 1 remaining_minutes = 60 - minutes remaining_seconds = 60 - seconds ampm = 'AM' if hours < 12 else 'PM' hours12 = hours % 12 if hours12 == 0: hours12 = 12 remaining_time = f"<b>{remaining_hours} hours, {remaining_minutes} minutes, {remaining_seconds} seconds</b>" user_first_name = message.from_user.first_name message = ( f"<b>👋 Hey {user_first_name}</b>\n" f"<b>━━━━━━━━•❅•°•❈•°•❅•━━━━━━━━\n" f"It is Bed Time 🛏️\n" f"So You Cannot Use This Button From 12:00 AM To 6:00 AM in Bangladesh Time\n" f"Current Time: {hours12}:{minutes:02} {ampm}</b>\n" f"<b>━━━━━━━━•❅•°•❈•°•❅•━━━━━━━━\n" f"Come Back After: {remaining_time}</b>\n" f"<b>━━━━━━━━•❅•°•❈•°•❅•━━━━━━━━</b>" ) bot.sendMessage(chat_id=message.chat.id, text=message, parse_mode="HTML") else: #YOUR COMMAND Main CODE IS HERE, Or bot.sendMessage("Now Up Time") Paste this code above the code of your command! And enter your code below! You Can Change Your Timezone And Bed Time ⏱ If You Post This In Your Channel. please Mention Our Channel Name For Credit #BedTime#RestrictionTime#Time#TBC#JSOrganization © Copyright : @JSOrganization ❓ Question/Error : @itsSowrov