If a child is brought before the court or delivered to a detention or shelter care facility designated by the court, the intake or other authorized officer of the court shall immediately make an investigation and release the child unless it appears that his detention or shelter care is warranted or required under section 6325 (relating to detention of child). The release of the child shall not prevent the subsequent filing of a petition as provided in this chapter. If he is not so released, a petition shall be promptly made and presented to the court within 24 hours or the next court business day of the admission of the child to detention or shelter care.
42 Pa.C.S. § 6331