Command exited with code 0. Command output: keyboard=self._workspace_menu(ws), ) async def _resolve_and_save_group(self, ws: Workspace, raw_ref: str, must_be_link: bool = False) -> bool: user_id = ws.user_id ref = raw_ref.strip() if not ref: await self.send(user_id, fmt_msg("Invalid Input", "Send an invite link, @username, or group/channel ID.", error=True), keyboard=reply_kb(BACK_KB)) return False if not self.main_client_ready: await self.send(user_id, fmt_msg("Session Not Ready", "Main Telegram session is not ready yet. Please wait.", error=True), keyboard=reply_kb(BACK_KB)) return False try: if re.fullmatch(r"-?\d+", ref): chat = await self.main_client.get_chat(int(ref)) elif self._is_invite_like(ref): try: chat = await self.main_client.join_chat(ref) except Exception as join_exc: invite_hash = self._extract_invite_hash(ref) if invite_hash and "user_already_participant" in str(join_exc).lower(): invite = await self.main_client.invoke(CheckChatInvite(hash=invite_hash)) if isinstance(invite, ChatInviteAlready): chat = invite.chat else: raise join_exc elif "invite_request_sent" in str(join_exc).lower(): ws.state = None self.save_workspace(ws) await self.send( user_id, fmt_msg( "Approval Required", "ā³ **Join Request Sent!**\n\nThis group requires admin approval to join. I will monitor the status for the next **3 minutes**.\n\nšŸ‘‰ **Action Required:** Please ask the group admin to approve your request now.", success=True ), keyboard=self._workspace_menu(ws) ) asyncio.create_task(self._poll_invite_approval(ws, ref, invite_hash)) return True else: raise join_exc else: target = self._normalize_username_ref(ref) try: chat = await self.main_client.join_chat(target) except Exception: chat = await self.main_client.get_chat(target) if not chat or not getattr(chat, "id", None): raise RuntimeError("Could not resolve chat") chat_id = self._canonical_chat_id(chat.id, getattr(chat, "type", None)) group_name = self._group_key_from_chat(chat) group_name = self._unique_group_name(ws, group_name, chat_id) ws.saved_groups[group_name] = chat_id ws.group_id = chat_id ws.state = None self.save_workspace(ws) await self.send( user_id, fmt_msg("Group Added", f"šŸ“” **Name:** `{group_name}`\nšŸ†” **ID:** `{chat_id}`", success=True), keyboard=self._workspace_menu(ws), ) return True