graymalkin / gwen

My IRC Bot
MIT License
0 stars 0 forks source link

autojoin not always working #22

Open tensort opened 9 years ago

tensort commented 9 years ago

Hello,

Autojoin is not always working. Some IRC servers wait the first PONG response before allowing that (or wait the end of motd, it is not always the same)

In order to connect to quakenet for example, i had to change IRC class :

i removed the connection and added it after the first PING / PONG (by setting a variable to let know if it is first time or later)

I guess that could change on servers, so try yourself on servers you try to connect it.

(By the way, the modules are great to add new features !!!!!! )

graymalkin commented 9 years ago

If I remember correctly there is a horrible hack for working out when a server comes up before sending messages.

It's worked fine against the irc servers I connect to (freenode and an internal University server) -- however, I'll have a play with quakenet at some point.

Could you push your fork of gwen on GitHub so I can see the change you made?

tensort commented 9 years ago

Hello,

I'll do that,i am making some modifications so don't worry if some stuffs are missing :) ( i made some customs like answers only in private) I'll make a fork later today so you can see what i modified on that. Yet I am not sure it is perfect, it is at least working with servers waiting first PING and servers not waiting it, since it is not based on a timed timer, but on server answer.

tensort commented 9 years ago

done here for the IRC File. https://github.com/tensort/gwen I'll see for doing a proper fork when i finish my job, but it might be a brand new project since it ifs forking from 2 different : you and RIO API using :)

tensort commented 9 years ago

(i corrected another issue where the bot don't understand Server's message and make message => issuing help message => bot don't understand => answer => server send help message and so the loop goes on) (look at the switch)

graymalkin commented 9 years ago

Hmm. Looking at the code, as-is: there are probably more elegant ways to deal with the IRC parsing -- it's the part of the bot I did 1st, quite some time ago, and is probably the worst. Several of these behaviours should be really firing events (of appropriate types).

I'll consider rationalising it soonishâ„¢.

tensort commented 9 years ago

yeah don't worry. I agree on that, was just a quick way to correct that. you can see what do what on the RFC ( digit from https://www.alien.net.au/irc/irc2numerics.html )

For exemple 372 RPL_MOTD RFC1459 :- Reply to MOTD

The bot was replying to help message, seems cause there was some key he did recognise.

[user/server] [cmd] [etc....] you have to parse the CMD to check what will the bot do.

But again : it did that on quakenet, you might not have experimented before.

On the first try i implemented a way to join chan after motd : switch (text.Split(' ')[1]) { case "PRIVMSG": //do what you want break; case "420" : //end of motd on some server //join chan cause on some you have to wait end of motd break; }