The command exited with code 0. Output: 849: async def _handle_bot_message(self, client: Client, message) -> None: 850- try: 851- if not message or not message.text or not message.from_user: 852- return 853- if message.chat.type != ChatType.PRIVATE: 854- return 855- 856- user_id = str(message.from_user.id) 857- ws = self.load_workspace(user_id) 858- text = message.text.strip() 859- 860- if text in ("/start", "/menu", "šŸ”™ Back to Menu"): 861- ws.state = None 862- self.save_workspace(ws) 863- await self.send_menu(ws, fmt_msg("Control Center", "Welcome to **MayaX Auto Sender**.\nSelect an operation from the menu below to manage your sessions.", success=True)) 864- return 865- 866- if ws.state: 867- handled = await self._handle_state(ws, text) 868- if handled: 869- return 870- 871- await self._handle_menu_action(ws, text) 872- 873- except Exception as exc: 874- log(f"[bot handler] {exc}") 875- if message and message.from_user: 876- await self.send(str(message.from_user.id), fmt_msg("System Error", f"Trace: `{exc}`", error=True)) 877- 878- async def _handle_state(self, ws: Workspace, text: str) -> bool: 879- user_id = ws.user_id 880- 881- if ws.state == "await_phone": 882- phone = normalize_phone(text) 883- if not re.match(r"^\+?\d{7,15}$", phone): 884- await self.send(user_id, fmt_msg("Invalid Phone", "Please send again in international format.\nExample: `+919876543210`", error=True)) 885- return True 886- 887- client = self.auth_clients.get(user_id) 888- if client is None: 889- client = Client(f"{ws.session_path}_auth", api_id=self.api_id, api_hash=self.api_hash) 890- self.auth_clients[user_id] = client 891- 892- try: 893- await client.connect() 894- sent = await client.send_code(phone) 895- except Exception as exc: 896- await self.send(user_id, fmt_msg("Code Failed", f"Could not send OTP: `{exc}`", error=True), keyboard=reply_kb([["šŸ” Connect Telegram"], ["šŸ”™ Back to Menu"]])) 897- return True 898- 899- ws.phone = phone 900- ws.phone_code_hash = sent.phone_code_hash 901- ws.state = "await_code" 902- self.save_workspace(ws) 903- await self.send( 904- user_id, 905- fmt_msg("OTP Sent", "šŸ“Œ Send the 5-6 digit code with spaces between numbers.\n\nšŸ‘‰ Example: `1 2 3 4 5`\n\n_(Telegram directly bheje gaye codes ko block kar deta hai, isliye space daal kar bhejein)_\n_If it expires, tap Resend Code._", success=True), 906- keyboard=reply_kb(OTP_KB), 907- ) 908- return True 909- 910- if ws.state == "await_code": 911- if text == "šŸ” Resend Code": 912- client = self.auth_clients.get(user_id) 913- if client is None: 914- await self.send(user_id, fmt_msg("Session Expired", "Login session expired. Please start over.", error=True), keyboard=reply_kb([["šŸ” Connect Telegram"]])) 915- ws.state = None 916- self.save_workspace(ws) 917- return True 918- 919- try: 920- sent = await client.resend_code(ws.phone, ws.phone_code_hash) 921- ws.phone_code_hash = sent.phone_code_hash 922- self.save_workspace(ws) 923- await self.send( 924- user_id, 925- fmt_msg("Resent OTP", "New code has been sent to your Telegram.\n\nšŸ“Œ Send with spaces, e.g.: `1 2 3 4 5`", success=True), 926- keyboard=reply_kb(OTP_KB), 927- ) 928- except Exception as exc: 929- await self.send(user_id, fmt_msg("Resend Failed", f"Error: `{exc}`", error=True), keyboard=reply_kb(OTP_KB)) 930- return True 931- 932- code = re.sub(r"\D", "", text.strip()) 933- if len(code) < 5: 934- await self.send(user_id, fmt_msg("Invalid Code", "Invalid code. Please send with spaces like: `1 2 3 4 5`", error=True)) 935- return True 936- 937- client = self.auth_clients.get(user_id) 938- if client is None: 939- await self.send(user_id, fmt_msg("Session Expired", "Login session expired. Please start over.", error=True)) 940- ws.state = None 941- self.save_workspace(ws) 942- return True 943- 944- try: 945- result = await client.sign_in( 946- phone_number=ws.phone, 947- phone_code_hash=ws.phone_code_hash, 948- phone_code=code, 949- )