I think your response was fair, although halachically you may have been incorrect to rebuke them as a group together, especially if you did so in front of others in the class who weren't previously involved. A first rebuke should almost always be done privately unless the tochecha is for a much graver chillul HaShem (but the likelihood of this being avoda zara, to name one example, strikes me as small).
OTOH, if you did rebuke them publicly, you almost certainly made an impression on the other talmidim that a private chat would have failed to impart, and my recollection of Shmirat Ha Loshon is that such utility is sometimes exculpatory, even if it's not ideal.
no subject
OTOH, if you did rebuke them publicly, you almost certainly made an impression on the other talmidim that a private chat would have failed to impart, and my recollection of Shmirat Ha Loshon is that such utility is sometimes exculpatory, even if it's not ideal.