cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

Bot wont join channels #4

Closed adamjleonard closed 14 years ago

adamjleonard commented 14 years ago

If a server doesn't pass response 376, the bot will not join any channel you pass to it via channels.

leejarvis commented 14 years ago

The current implementation does not closely monitor input and server responses, which is what would be required to ensure we're joining default channels shortly after connecting to the server. Most servers should send a 376 response, it's used pretty much across the board from what I've found.

Unfortunately attempting to join a channel any sooner than 376, or at least a MOTD response usually fails. This is the sole reason I used this method. Future versions of Cinch may implement a method of controlling and monitoring server responses a little closer. Until then it's unlikely to change, unless anyone can suggest a better method which works consistently.

Is there a specific server which you've found does not return a 376 response code?

A quick fix would be to omit the options.channels array and instead use the Cinch::Base#on method to add a listener. For example:

bot.on(xxx) do |m|
  %w(#foo #bar).each {|channel| bot.join(channel) }
end
leejarvis commented 14 years ago

7a9cc02cef545bd0a34c4f8f7657e0d7d5c1428d Which is now the current HEAD implements channel joining on 004. If there are any issues with this please let me know