ktiedt / NodeJS-IRC-Bot

A plugin-based IRC bot written in NodeJS.
http://www.michaelowens.nl
The Unlicense
54 stars 19 forks source link

Cleanup of existing functionality #14

Closed triplem closed 11 years ago

triplem commented 11 years ago

use already existing freenode plugin, instead of own functionality in irc.js. move classes (*js) from main directory to lib directory.

triplem commented 11 years ago

closes #13 as well.

triplem commented 11 years ago

I have commited this change in the wrong branch and therefor reverted it, thats why the new pull request does contain the same changes again. This time these are right ;-)

I used object, because otherwise the wanted functionality is not working (this seems to be a bug in the pkgconfig package or I did missunderstood something).

You are right on the method, I would just cleanly separay the pluginname and the pluginProperty and therefor the 1 param is the pluginname and the second just the pluginProperty without the name prefix. In the above example it would then be something like:

irc.getPluginConfig('freenode', 'nickPass');

I am just thinking about moving this whole plugin stuff into its own super class which should then be used for all plugins, since e.g. the Help functionality and also the properties could then be handled in a central manner.

triplem commented 11 years ago

Added a new composite PluginHelper, which is added to each plugin (contains already the name of the plugin) instead of the irc class. this module contains a function to determine the pluginProperties.

Furthermore I added a new plugin (admin) and a couple of new functionatlity to the freenode plugin.

What do you think?

next step is now to add some testcases for plugins.

any chance to meet in irc?

ktiedt commented 11 years ago

tk on FreeNode I'll try and watch for messages (working a bit now)

triplem commented 11 years ago

Jeez, should do smaller commits and take more care about pwd stuff. Well, it is changed anyway to a very secure one. LOL. Sure, the method in the PluginHelper should replace the one in irc.js. I was thinking about a central method in irc and a more specified one in PluginHelper. Unfortunately JS inheritance is not really as nice, otherwise I would have made an constructor chain for the plugins. Inow used the composite stuff, but unfortunately the irc class knows about the PluginHelper. Anyway, the PluginHelper will provide more methods for eg messagesplitting and stuff like already done in several plugins.

ktiedt commented 11 years ago

LOL, Well I review pull requests for part of my job, so I try to catch things like that ;) Also thats not a bad idea... I wonder if Compose is usable in Node... I shall check that out.. .I do like being able to easily handle inheritance and it would certainly make something like this much more clean I believe and modularized....