nice first try!
a problem is that if you speak to someone without mircryption or fish it's going to try to do a key exchange with them every time they say anything.
a nice solution would be to set a persistent variable (or hash entry) like %autokeyx_USERNAME (where USERNAME is the name of the person, i.e. $3) whenever you do the mckeyx in your routine, and only try they mckeyx if the variable for the user is not set yet. that way, it will only ever try it once per user.