there is a command made intended for this called /filter