There is an urgent need for developing novel strategies for bacterial detection and inhibition. Herein, a multifunctional nanomaterial based on mesoporous silica nanoparticles (MSNs) is designed, loaded with amoxicillin (AMO), and surface-coated with 1,2-ethanediamine (EDA)-modified polyglycerol methacrylate (PGEDA), cucurbituril (CB), and tetraphenylethylene carboxylate derivatives (TPE-(COOH)4) by the layer-by-layer (LbL) self-assembly technique. When bacteria contacts with this nanoassembly, the binding of anionic bacterial surface toward the cationic PGEDA layer of this material can reduce or break the interactions between PGEDA layer and TPE-(COOH)4 layer, leading to attenuated TPE-(COOH)4 emission due to the weakening of aggregation-induced emission (AIE) effect. Furthermore, upon adding adamantaneamine (AD), the more stable AD⊂CB complex forms and PGEDA is liberated through competitive replacement, thus leading to the release of AMO and resulting in much higher antibacterial ability of this nanomaterial. This newly designed nanomaterial possesses dual functions of controllable antibacterial activity against Gram-positive Staphylococcus aureus and Gram-negative Escherichia coli, and bacterial detection ability in aqueous media, suggesting that the design of this multifunctional antibacterial material will provide a simple, effective, and rapid way to control the activity of antimicrobial and open up an alternative new avenue for bacterial detection and elimination.