I realize you're asking this in the scripts forum, but imho issues like this should be forwarded to the IRCOPs of a network (and they are able to use /who +u or /who +h).
If you decide to connect a bot that is massjoining channels to collect userdata, notably with the mere intention to "take law in your own hands", IRCOPs (who might actually help you with this issue) might rather turn against you...