ElvenSpellmaker / IRC-Bot

A very little basic IRCBot that is being improved all the time
http://www.wildphp.com
7 stars 1 forks source link

Release of new refactored version of IRC-Bot? #7

Open oliveratgithub opened 9 years ago

oliveratgithub commented 9 years ago

Hi @ElvenSpellmaker You mentioned in the issue ElvenSpellmaker/IRC-Bot#6 , that you are currently working on refactoring the IRC-Bot and going to release an updated version soon.

Can you give any estimated date when you will have it ready? I just did an implementation of the original super3/IRC-Bot@9d141884515d5088da0dde0c39ebd5359eb9f7bc and I am getting at its limits by extending it with some features I need. And honestly I felt dumb realising I worked on a year old code base and then saw your comment that you are working on an active refactoring ;)

Would be great to know when it's ready, so I can estimate if I should spend any more time on my current implementation, or wait to replace it completely with your new one (it looked pretty good from what I saw in the current repo, so I'd like to switch).

Thanks, Oliver

ElvenSpellmaker commented 9 years ago

Hi @oliveratgithub,

I am actively working on my refactor, the front-end process is nearly done and the back-end process will be started soon.

I have been distracted the past couple of days through preparing my MonkeyLoader (https://github.com/ElvenSpellmaker/MonkeyLoader) library which the back-end will use to be able to re-load plug-ins.

I see that the original project has suddenly got a new lease of life (just as I start doing mine too) which is weird, but nice to see. I'll definitely be keeping an eye on it to make sure I don't miss out putting anything decent into my new version.

If you can think of anything that's needed or wanted then let me know and I'll try to work something out.

I am tempted to hack the back-end to work with the new front-end and release it as an intermediary release.

oliveratgithub commented 9 years ago

That's great news @ElvenSpellmaker . If you want to have somebody testing a preview of the new release, I'd be happy to do so!

2 things that I am currently in need with the IRC-Bot and want to give you on the way for the refactored version:

Again, if you need somebody to test the new release, I'd be glad to do so.

ElvenSpellmaker commented 9 years ago

By database integration do you mean a standard and central way to connect to a Database for use in plug-ins etc?

Threading is a massive problem in PHP as it doesn't support threads (except pthreads by an extension) which is why my bot uses two PHP processes and not threads... I am trying my best to allow extra processes to connect via sockets to the back-end much like the front-end does which would allow you to have, but that has many limitations that would need to be solved...

oliveratgithub commented 9 years ago

By database integration do you mean a standard and central way to connect to a Database for use in plug-ins etc?

Exactly.

Threading is a massive problem in PHP as it doesn't support threads

Yes, I know it goes towards multithreading which PHP doesn't support oob. (and honestly, also might be a bit oversized for the PHP Bot). I am still thinking of another creative way of getting this done... Probably just include a watcher that closes if nothing new has been found in the database, and looping thorugh with an open db-connection (instead of initialising a new connection every time the function runs through).

ElvenSpellmaker commented 9 years ago

Hmm I am wondering if using the pthreads extension would be considered wise. It's gaining traction and it's not too difficult to re-compile PHP with ZTS support, and it even works on Windows with a pthreads dll download.

It would remove the need for the multiple process model, which while it works is starting to cause some problems (the need for a NICK sync, problems with message histories and nicks in channel, etc., etc., etc.).

I'd have the main bot in the main thread, the commands etc. would be in one thread, and then the option for people to create their own threads for use in such plug-ins as !remind which would need to keep track of time and do things at the correct time.

ElvenSpellmaker commented 9 years ago

To update you on the status of the re-write, I have just about finished the re-write of the front-end bot, which I am currently testing on freenode, and it seems to be working OK, but it's noticeably slower, which is why my thoughts about the above seem better than continuing this multi-process model.

Re-writing code in a nicer and more OO way certainly slows the code down! (But also the code for handling multiple servers also slows it down)