If you are not using the API that provides you with this information, the IRC protocol does not give you any messages in "ident @vhost" in the WHOIS response 311. IRC bots that I wrote in the past, you must track this material yourself. Although when you send the WHOIS <nick> command, the response line 319 will have a list of channels in which the nickname is located, and @ / + /% / ~ in front of the channels indicating the user modes that the nickname has in this channel. You can analyze them, but this will increase the amount of traffic if you need to send WHOIS every time someone does something on the channel.
When you first join the channel, you will get a bunch of 353 <your nick> @ <channel> :<user_list> , where <user_list> could be:
: snowcloud Chibi-Ryu CUF Nere ~ thundra vatar nm449 | Klapo Apocalypse + Skull_Leader% KagaminBot Razaekel Kloacy & Cherry-chan @happytang MagusHrist% Frostii hexerr laptop
You can see modifiers + (voice), % (half-operator), @ (op), ~ (owner) before each nickname. In addition, if you select WHO <channel> (depending on the server, you may need to be in the channel to get something back), you will receive a line response on line 352: 352 <your nick> <channel> <user> <host> <server> <nick> <H|G>[*][@|+|%|~] :<hopcount> <real name> . And you can parse the material after H / G to get custom modes.
This is the only way to request custom modes, but while your bot is sitting in the channel, it will receive messages like MODE <channel> +|-<v|h|a|o> <nick> . So when you see one of them, you can internally keep track of who got + v or -v, etc. Then you will not need to send a command to the server every time someone from the channel makes a “! Roll” "(some IRC servers will kick you for flooding if you keep sending WHOIS).
Jon lin
source share