jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 86 forks source link

Keep track of previous users in a channel #70

Closed jaraco closed 8 years ago

jaraco commented 8 years ago

I'm writing an irc logging bot, the code is available here: https://github.com/meskarune/autobot/blob/master/autobot.py

I'm trying to log quit messages from users in each of the channels they were previously in. has_user(nick) won't work as the user is no longer in the channel when they quit. Maybe it would be possible to have _on_quit run before _quit so it is possible to capture the channel a user is leaving.


jaraco commented 8 years ago

In the example bot provided in the source, the bot keeps track of each user in each channel, and when a user quits, the internal copy of the users that channel was in are removed. The IRC client doesn't have a special connection to the server, so has no way to signal to get a channel list for the user prior to the quit being processed. Therefore, the technique in irc/bot.py is probably your best bet.


Original comment by: Jason R. Coombs