async def Process_Checker2(number_complect=' ', komment=' '): Onl = True print(number_complect, komment) Set_Koment(number_complect, komment) cft = Check_From_Table(number_complect) cft_print = "@{11} \n \u2705 Комплект {0} в сети \n \ \u26a0\ufe0f Коментарий: {12} \ \n Клиент: {1} \ \n Тарифы: \n {2} | {3} \n {4} | {5} \n {6} | {7}\n {8} | {9}\n \ Был в сети: {10}".format(number_complect, cft[0], cft[1], cft[5], cft[2], cft[6], cft[3], cft[7], cft[4], cft[8], cft[9], '@beligor', cft[10]) while Onl: try: Online = await asyncio.wait_for(Active_Complekt(number_complect), 15) if Online == True: print(" ONLINE = True", ctime()) await bot.send_message('-391405470', cft_print) Set_Koment_Null(number_complect) pc = shelve.open('pull_complects') del pc[number_complect] print("Delete !") await asyncio.sleep(1) Onl = False else: print("ONLINE = False", ctime()) Onl = True await asyncio.sleep(60) except Exception as e: print("Exception raising at : ", ctime(), e) pass
async def check(message: types.Message): print ("Message: ", message) print (message.from_user.username, message.from_user.id) number_complect = message.text.split(" ")[1] print ("Запущена конвертация номера комплекта") number_complect = await Number_Complect_Converter(message) Online = await Active_Complekt(number_complect) cft = Check_From_Table(number_complect) cft_print = "@{11} \n \u2705 Комплект {0} в сети \n Клиент: {1} \n Тарифы: \n {2} | {3} \n {4} | {5} \n {6} | {7}\n {8} | {9}\n Был в сети: {10}".format(number_complect ,cft[0],cft[1],cft[5],cft[2],cft[6],cft[3],cft[7],cft[4],cft[8],cft[9],message.from_user.username) cft_print2 = "@{11} \n \u274c Комплект {0} не в сети \n Клиент: {1} \n Тарифы: \n {2} | {3} \n {4} | {5} \n {6} | {7}\n {8} | {9}\n Был в сети: {10}".format(number_complect ,cft[0],cft[1],cft[5],cft[2],cft[6],cft[3],cft[7],cft[4],cft[8],cft[9],message.from_user.username) if Online == True: await bot.send_message(message.chat.id, cft_print) else: await bot.send_message(message.chat.id, cft_print2)
async def Send_Message(bus, result_status): Klient = Check_From_Table(bus)[0] print("KLIENT : ",Klient) print ("STATUS: ", result_status) if result_status == 0: print ("Null") elif result_status == 1: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, "@beligor \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 10 GB".format(Klient ,bus, result_status)) elif result_status == 2: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 15 GB".format(Klient ,bus, result_status)) elif result_status == 3: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 18 GB".format(Klient ,bus, result_status)) elif result_status == 4: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, "\u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f\n \ \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 20 GB".format(Klient ,bus, result_status)) elif result_status == 5: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 30 GB".format(Klient ,bus, result_status)) elif result_status == 6: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 35 GB".format(Klient ,bus, result_status)) elif result_status == 7: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 38 GB".format(Klient ,bus, result_status)) elif result_status == 8: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, "\u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f\n \ \nКлиент: {0} \nКомплект: {1} \nСтатус: {2} \nРасходы: 40 GB ".format(Klient ,bus, result_status)) elif result_status == 9: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 50 GB".format(Klient ,bus, result_status)) elif result_status == 10: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 55 GB".format(Klient ,bus, result_status)) elif result_status == 11: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, " \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 58 GB".format(Klient ,bus, result_status)) elif result_status == 12: print("PECHAT: ", Klient, bus, result_status) await bot.send_message(386869436, "\u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f \u26a0\ufe0f\n \ \nКлиент: {0} \n Комплект: {1} \n Статус: {2} \n Расходы: 60 GB".format(Klient ,bus, result_status)) else: print ("Null")
async def Process_Checker(number_complect=' ', komment=' ', message=" "): Onl = True pc = shelve.open('pull_complects') if number_complect not in list(pc.keys()): print("Pull_Complects: ", list(pc.keys()), ':', list(pc.values())) print(number_complect, komment, pc) pc[number_complect] = komment print("Pull_complects: ", pc) pc.close() Set_Koment(number_complect, komment) cft = Check_From_Table(number_complect) cft_print = "@{11} \n \u2705 Комплект {0} в сети \n \ \u26a0\ufe0f Коментарий: {12} \ \n Клиент: {1} \ \n Тарифы: \n {2} | {3} \n {4} | {5} \n {6} | {7}\n {8} | {9}\n \ Был в сети: {10}".format(number_complect, cft[0], cft[1], cft[5], cft[2], cft[6], cft[3], cft[7], cft[4], cft[8], cft[9], message.from_user.username, cft[10]) while Onl: try: Online = await asyncio.wait_for( Active_Complekt(number_complect), 15) if Online == True: print(" ONLINE = True", ctime()) await bot.send_message(message.chat.id, cft_print) Set_Koment_Null(number_complect) pc = shelve.open('pull_complects') del pc[number_complect] print("Delete !") await asyncio.sleep(1) Onl = False else: print("ONLINE = False", ctime()) Onl = True await asyncio.sleep(60) except Exception as e: print("Exception raising at : ", ctime(), e) pass else: await bot.send_message(message.chat.id, "\u26a0\ufe0f Checked already running")
async def online(message: types.Message): Onl = True print (message) await bot.send_message(message.chat.id, "Start") komment = message.text.split(" ")[2:] komment = ' '.join(komment) print("Коментарий :", komment,'\n') number_complect = await Number_Complect_Converter(message) if number_complect not in pull_complects: pull_complects.append(number_complect) print ("Pull_complects: ", pull_complects) Set_Koment(number_complect, komment) cft = Check_From_Table(number_complect) cft_print = "@{11} \n \u2705 Комплект {0} в сети \n \ \u26a0\ufe0f Коментарий: {12} \ \n Клиент: {1} \ \n Тарифы: \n {2} | {3} \n {4} | {5} \n {6} | {7}\n {8} | {9}\n \ Был в сети: {10}".format(number_complect ,cft[0],cft[1],cft[5],cft[2],cft[6],cft[3],cft[7],cft[4],cft[8],cft[9], message.from_user.username, cft[10]) while Onl: try: #cft_print = "@{11} \n \u2705 Комплект {0} в сети \n \u26a0\ufe0f Коментарий: {12} \n Клиент: {1} \n Тарифы: \n {2} | {3} \n {4} | {5} \n {6} | {7}\n {8} | {9}\n Был в сети: {10}".format(number_complect ,cft[0],cft[1],cft[5],cft[2],cft[6],cft[3],cft[7],cft[4],cft[8],cft[9], message.from_user.username, cft[10]) Online = await asyncio.wait_for(Active_Complekt(number_complect), 15) #print ("Number: ", number_complect, '\n',"Online: ",Online, '\n',"Time: ",ctime(), '\n',) if Online == True: print (" ONLINE = True", ctime()) #Online = False await bot.send_message(message.chat.id, cft_print) Set_Koment_Null(number_complect) pull_complects.remove(number_complect) await asyncio.sleep(1) Onl = False else: print ("ONLINE = False", ctime()) Onl = True await asyncio.sleep(60) except Exception as e: print("Exception raising at : ", ctime(), e) pass else: await bot.send_message(message.chat.id, "\u26a0\ufe0f Checked already running")