totallymike / ircnode

Extensible IRC bot written with node.js
https://github.com/totallymike/ircnode/wiki
MIT License
4 stars 2 forks source link

Dynamically using users.json file #13

Closed sigv closed 12 years ago

sigv commented 12 years ago

Currently when the irc.users object is modified when a new message is received (so that !seen reflects to the correct message) the changes are only kept in the memory and not saved to the users.json file. The "last seen" should be persistent over sessions. The users.json file should also be loaded when it is used so that if the file is changed, the changes to it appear immediately.

sigv commented 12 years ago

This has been implemented in a pretty basic way in dyn_users branch. The current implementation on the branch is as follows:

var handler = function (act) {
  // Before the callback, the file is reloaded from disk.
  irc.readUsers(function (users) {
    if (typeof users['foo'] === 'undefined')
      users['foo'] = {};
    users['foo'].bar = 10;
  });
  // After the callback, the changes are saved to disk.
}
totallymike commented 12 years ago

I finalized this one and merged it into master. I believe the branch can be deleted.