+ Fix wrong sleep using

This commit is contained in:
Wong Yiek Heng 2025-10-05 20:09:03 +08:00
parent f2a69e58d5
commit 706c5ee896

View File

@ -1,4 +1,4 @@
import threading, logging, time
import threading, logging, time, asyncio
from telegram import ForceReply, Update
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters
@ -24,9 +24,10 @@ async def menu_cmd_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -
await update.message.reply_text('\n'.join(menu))
async def get_acc_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
global creating_acc_now
while creating_acc_now == True:
await update.message.reply_text('CM account creation is running, queuing ...')
time.sleep(1)
await asyncio.sleep(1)
creating_acc_now = True
await update.message.reply_text('Start Getting CM Account ...')
try:
@ -82,6 +83,7 @@ def monitor_amount_of_available_acc():
available_size = len(bot.get_all_available_acc())
if available_size <= max_available:
global creating_acc_now
creating_acc_now = True
for i in range(available_size, max_available):
bot.create_new_acc()
@ -89,8 +91,6 @@ def monitor_amount_of_available_acc():
time.sleep(10 * 60)
del bot
def main() -> None:
"""Start the bot."""
# application = Application.builder().token("5327571437:AAFlowwnAysTEMx6LtYQNTevGCboKDZoYzY").build()