So I'm writting an IRC bot in Python. Right now, the first thing I'm trying to get it to do is Log all the important things in every channel it's on (as well as private messages to the bot itself).
So far I've gotten it to log the JOIN
, PRIVMSG
(including CTCP
commands) and PART
. However I'm having some trouble with the QUIT
command. Now I know the QUIT
command doesn't include the <channel>
parameter because it doesn't need it. However my bot is connected to multiple channels and I need to be able to differentiate which channels the user was connected to when he/she issued the QUIT
command to appropriate log it. Many users won't be connected to every channel the bot is.
What would be the ideal way to go about this? Thanks for your help.
It sounds like you want to write the same QUIT
log message to multiple per-channel log files, but only specific ones the bot is in?
To accomplish something similar, I ended up getting the list of names in a channel when the bot joins, then keeping track of every nick change, join, part, kick, and quit, and adjusting the bot's internal list. That way, on a quit, I could just check the internal list and see what channels they were on.