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

Server password #28

Open Ghezzo opened 11 years ago

Ghezzo commented 11 years ago

The IRC server I'm trying to connect to requires a server password, would be nice it that could be added. Everything else seems to work just fine but the password is missing.

ElvenSpellmaker commented 11 years ago

Try looking at my code, I have just tried to implement channel and server password handling. I'm hoping at some point pogo will pull my code.

https://github.com/pogosheep/IRC-Bot/pull/26

Ghezzo commented 11 years ago

It doesn't seem to work, it doesn't show the password in the output, and also spams empty log messages filling up the log file making it huge.

ElvenSpellmaker commented 11 years ago

Does it just say "PASS" then?

Ghezzo commented 11 years ago

Yes, only PASS.

ElvenSpellmaker commented 11 years ago

OK I'll take a look now, and hopefully will find my error.

ElvenSpellmaker commented 11 years ago

OK try what I have just pushed now, on my end I now get the password in the PASS message. =)

Ghezzo commented 11 years ago

Now it connects to the server but it doesn't join a channel. It shows the server MOTD and then nothing.

ElvenSpellmaker commented 11 years ago

OK is your config file as needed?

If you wanted to join a channel called #phpbot404 with no password and #cs with password foobarbaz you would have:

'channels' => array( '#phpbot404' => '', '#cs' => 'foobarbaz', ),

If you are sure your config. is correct, please may you post a log output, thanks. =)

Ghezzo commented 11 years ago

28.02.2013 - 20:23:28 [ COMMAND ] PASS removedpassword 28.02.2013 - 20:23:28 [ COMMAND ] NICK ghezzotest 28.02.2013 - 20:23:28 [ COMMAND ] USER ghezzotest Layne-Obserdia.de ghezzotest :ghezzotest 28.02.2013 - 20:23:28 [ LOG ] :tmi.twitch.tv 001 ghezzotest :connected to TMI 28.02.2013 - 20:23:29 [ LOG ] :tmi.twitch.tv 002 ghezzotest :your host is TMI 28.02.2013 - 20:23:29 [ LOG ] :tmi.twitch.tv 003 ghezzotest :this server is pretty new 28.02.2013 - 20:23:29 [ LOG ] :tmi.twitch.tv 004 ghezzotest tmi.twitch.tv 0.0.1 w n 28.02.2013 - 20:23:29 [ LOG ] :tmi.twitch.tv 375 ghezzotest :- tmi.twitch.tv Message of the day - 28.02.2013 - 20:23:29 [ LOG ] :tmi.twitch.tv 372 ghezzotest :- not much to say here 28.02.2013 - 20:23:29 [ LOG ] :tmi.twitch.tv 376 ghezzotest :End of /MOTD command

And then nothing after that.

The config is:

'channels' => array( '#ghezzotest' => 'removedpassword', ),

ElvenSpellmaker commented 11 years ago

Hmm it seems like that should work... I just tested my code on a private room and it connected fine...

I don't have a server that needs a password to try my code out on, but I really don't see why it would not work. My code also doesn't complain if you try to join an passwordless channel with a password and it says it can't connect to a channel if the password is wrong...

It seems very strange to me.

ElvenSpellmaker commented 11 years ago

Are you still receiving this weird bug? If I had a server with a password to try then I could try and debug it, but without access to that configuration I can't. =S

Ghezzo commented 11 years ago

Yes I am, if you want to you can create an account on twitch.tv and the irc password is the same as on the website.

ElvenSpellmaker commented 11 years ago

Hmmm, when I try to connect to that server, I get the infinite loop problem (when I clone the code here) and I can't work that one out, but if you aren't then I know why your bot isn't connecting to any channels.

Super3 put in some code which checks for "Welcome" in the MOTD and if it's not there then the bot doesn't try and connect to any channels and from your log above the MOTD doesn't have "Welcome" in it!

if (stripos( $data, 'Welcome' ) !== false) {

That is a very silly check, but at this moment I think the best way is to look for "End of /MOTD command" instead.

Try the latest push and fingers crossed it works.

I really do need to get to the bottom of that infinite loop though, if you were getting it and I still am.

Ghezzo commented 11 years ago

Now it connects and accepts commands, thanks!

ElvenSpellmaker commented 11 years ago

Great! \o/

nathanaelbaaij commented 10 years ago

Connecting to irc.twitch.tv

I get this error can you help me out?

socket_create(): Unable to create socket [0]: An address incompatible with the requested protocol was used. in E:\xampp\htdocs\github\IRC-Bot\Classes\Library\IRC\Bot.php on line 195

log:

21.10.2014 - 19:36:50 [ COMMAND ] PASS password 21.10.2014 - 19:36:50 [ COMMAND ] NICK disputatio 21.10.2014 - 19:36:50 [ COMMAND ] USER disputatio Layne-Obserdia.de disputatio :disputatio 21.10.2014 - 19:36:50 [ LOG ] TEST: BEFORE SOCKET SELECT. 21.10.2014 - 19:36:51 [ LOG ] TEST: AFTER SOCKET SELECT. 21.10.2014 - 19:36:51 [ LOG ] :tmi.twitch.tv 001 disputatio :Welcome, GLHF! 21.10.2014 - 19:36:51 [ LOG ] TEST: BEFORE SOCKET SELECT. 21.10.2014 - 19:36:51 [ LOG ] TEST: AFTER SOCKET SELECT. 21.10.2014 - 19:36:51 [ LOG ] :tmi.twitch.tv 002 disputatio :Your host is tmi.twitch.tv 21.10.2014 - 19:36:51 [ LOG ] :tmi.twitch.tv 003 disputatio :This server is rather new 21.10.2014 - 19:36:51 [ LOG ] :tmi.twitch.tv 004 disputatio :- 21.10.2014 - 19:36:51 [ LOG ] :tmi.twitch.tv 375 disputatio :- 21.10.2014 - 19:36:51 [ LOG ] :tmi.twitch.tv 372 disputatio :You are in a maze of twisty passages, all alike. 21.10.2014 - 19:36:51 [ LOG ] :tmi.twitch.tv 376 disputatio :> 21.10.2014 - 19:36:51 [ LOG ] TEST: BEFORE SOCKET SELECT.