PDA

View Full Version : IRC Bot not regoconizing commands without arguments



gluxon
February 27th, 2011, 04:41 AM
I'm working on a PHP bot for my IRC channel. It works extremely well, but I have one problem that I just can't figure out. For commands that don't take arguments, gluxonbot doesn't recognize them. For example, in the code below, entering ".time" in the channel won't work, however ".time bob" works fine.

http://gluxon.pastebin.com/fwQNmrCp

I've been scratching my head for days trying to figure out what the problem is. If any of you could look at it, thanks.

gmargo
February 27th, 2011, 08:16 PM
Your input lines coming from the IRC server are terminated with CR-LF. Those are not stripped by the fgets(). That's why ".time " (.time followed by a space) works but ".time" does not - it's because the string is really ".time\r\n".

gmargo
March 2nd, 2011, 04:45 PM
Interested in IRC bots? There is an Ubuntu Developer Week presentation on "Developing IRC bots", today at 19:00 UTC, or about 3 hours from now.

https://wiki.ubuntu.com/UbuntuDeveloperWeek