| 95 | tb = TechifyBots() |
| 96 | |
| 97 | def main(): |
| 98 | async def start_services(): |
| 99 | if Config.STRING_SESSION: |
| 100 | await asyncio.gather(app.start(), tb.start()) |
| 101 | else: |
| 102 | await asyncio.gather(tb.start()) |
| 103 | |
| 104 | # Idle mode start karo |
| 105 | await idle() |
| 106 | |
| 107 | # Bot stop karo |
| 108 | if Config.STRING_SESSION: |
| 109 | await asyncio.gather(app.stop(), tb.stop()) |
| 110 | else: |
| 111 | await asyncio.gather(tb.stop()) |
| 112 | |
| 113 | loop = asyncio.get_event_loop() |
| 114 | try: |
| 115 | loop.run_until_complete(start_services()) |
| 116 | except KeyboardInterrupt: |
| 117 | print("\n🛑 Bot stopped by user!") |
| 118 | finally: |
| 119 | loop.close() |
| 120 | |
| 121 | if __name__ == "__main__": |
| 122 | warnings.filterwarnings("ignore", message="There is no current event loop") |