I know there is a lot of Snippets like this, but i didn't see one like this i added some colors so it look nice Enjoy!
on *:OP:#:{ if ($opnick == $me) { msg $chan 2Thank You For The 4@p42 $nick } }
on *:VOICE:#:{ if ($vnick == $me) { msg $chan 2Thank You For The 4+v42 $nick } }