super3 / IRC-Bot

A very little basic IRCBot that will get improved over the next time.
http://www.wildphp.com
102 stars 47 forks source link

Fixes to get the Bot working and then some more... #26

Closed ElvenSpellmaker closed 9 years ago

ElvenSpellmaker commented 11 years ago

I forked your code and tried to run the bot but it complained about passing arguments to commands/listeners that didn't have constructors, so I have made a fix for it which attempts to use arguments and if that fails then it tries to construct without arguments. If the config. file has arguments but the command/listener doesn't accept them then it will warn the user that the command doesn't accept the supplied arguments.

I also fixed the keywors mistake to keywords because it failed to start due to it being misspelt. I then noticed that FutileFreedom also fixed the second bug but you haven't committed his pull request yet (I cloned yours and it still had the error), found here: https://github.com/pogosheep/IRC-Bot/pull/25

Thanks. =)

matejvelikonja commented 11 years ago

Good job. I'll take a look at commit when I'll have time and let you know how is it. For merging, we'll have to wait for @pogosheep.

ElvenSpellmaker commented 11 years ago

I've just pushed up more adds some functionality to the bot that it didn't have as well as fixing an issue mentioned here: https://github.com/pogosheep/IRC-Bot/issues/16 I patched that by making it ignore PRIVMSG messages for server commands which is a good enough patch imo..

Also added is serialisation and remembering (un-serialisation) which for now is a manual process (initiated by !serialise and !remember assuming those plug-ins are enabled, hence the new config. file).

One thing I noticed is that if the bot is messaged personally it responds to itself rather than to the user who messaged them. The say method in Bot will need to be fixed to respond back to the right person.

matejvelikonja commented 11 years ago

Hey, could you use spaces for indentation instead of tabs. Code looks a bit hard to read if we mix that two together.

Could you explain a bit more about this two new commands?

ElvenSpellmaker commented 11 years ago

Sorry, I would've though github would convert tabs to spaces automatically. (I'm a bit new to all this) I'll change it now.

The serialisation function serves as a way for Commands and Listeners to store data to a file, or database on demand so that it may be recalled later into the memory of the bot. If you wanted to patch your bot but not lose working data that a command or listener may use, it might be nice to write it to a file/db. Several bots I have seen implement this type of manual functionality, rather than thrashing a file or db after every command/event. My code provides a way of calling all Commands and Listeners and if they implement a serialise() or remember() method then it will call them when the user uses !serialise or !remember respectively.

If you write a new Command or Listener, you only need to implement serialise and remember to have this store/load functionality.

Probably would be wise for the Bot class to have a field which is set by the config. file for a directory to store files into.

(Also I fixed the bot messaging itself instead of the user who messaged it which I mentioned previously).

matejvelikonja commented 11 years ago

@ElvenSpellmaker i just did a quick review and it looks great. It would be awesome now that we would have a command or listener to use this. do you have an idea for a command or listener to use this?

ElvenSpellmaker commented 11 years ago

I have done a few more commits today to try and make the bot handle passwords for both servers and channels, as described in these reports: https://github.com/pogosheep/IRC-Bot/issues/20 https://github.com/pogosheep/IRC-Bot/issues/28

If people can validate they work I'd be very grateful!

I haven't implemented nickname passwords yet. (Such as messaging nickserv), I may attempt this later.

ElvenSpellmaker commented 11 years ago

(I have no idea how I have closed the pull request twice...)

Update: Changed a naïve way of looking if you are welcome, I assume if you can see the MOTD then you are welcome, probably isn't always the case, but it's better than looking for "Welcome". (If you look at the log in https://github.com/pogosheep/IRC-Bot/issues/28 then you can see "Welcome" isn't in the MOTD and so the bot just hangs.

ElvenSpellmaker commented 11 years ago

@matejvelikonja Do you have write access to Pogosheep's repo?

If so, can't you merge my changes?

matejvelikonja commented 11 years ago

yes, I have it now. @pogosheep doesn't have enough time to do this, so he gave me permissions.

will merge this as soon as I test it and figure out how we will proceed with development. lot's of developers started to contribute, and we will have to make some rules about that. like start writing tests, code standards etc. we have to write maintainable and well tested code.

i also have to set up irc channel, so we can stay in touch easier.

matejvelikonja commented 11 years ago

@ElvenSpellmaker can you merge current version of pogosheep code to your one? otherwise i cant accept PR.

ElvenSpellmaker commented 11 years ago

I will when I get back home in a couple of hours.

ElvenSpellmaker commented 11 years ago

I will also hopefully upload the few plugins I have written and will update the readme.

ElvenSpellmaker commented 11 years ago

Also where is the IRC channel so I can join please?

matejvelikonja commented 11 years ago

look at the config file :)

ElvenSpellmaker commented 9 years ago

Seeing as this has many, many merge conflicts and is horrendously old I will close this.

I am writing a new version of all these changes over on my fork if anyone would like to check that out.