¿Qué consulta para dar insignia por dar 'me gusta' o responder a un tema?

Is there a way to write a query to award a badge to all users who like a certain post/topic or reply to it?

1 me gusta

That should help:

3 Me gusta