cinchrb / cinch

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

message.user.nick doesn't work in non/semicompliant whois servers #91

Closed taksuyu closed 11 years ago

taksuyu commented 11 years ago

One such server is twitch, and I can't get the bot to do anything since it always tries to identify itself with the server. Poses a problem because it logs in just fine, and you can't change your login information so that is static.

However it tries to identify and times out.

Love the bot, needs work. I'd love to help if I can :D

dominikh commented 11 years ago

You could help by stating server address and port as well as provide me with login details, if required.

Generally speaking, JustinTV, Twitch and all the other folks that are just copies of each other all run completely crippled and non-compliant IRC servers that they reach a point at which they can hardly be considered IRC servers anymore. I tend to add support for them when it doesn't mean too many changes, but as soon as they require ridiculous hacks on my part, I tend to refuse.

taksuyu commented 11 years ago

I can completely agree

the general login information required is .jtvirc.com which will log you into the current irc server hosting the user's irc and then login to the channel #.

The bot really has no trouble logging in, infact I even got the hello script to work.. once albeit I have no idea the conditions that allowed it to work

What tends to happen is I get a timeout from the method trying to solve a whois for the bot

Hope that helps

dominikh commented 11 years ago

So TwitchTV is the exact same thing as JustinTV? Because I remember adding special checks for that network.

Well, I have no log in details for either site and am not really that motivated to sign up, either. If you can provide me with log-in details, I'll gladly investigate. (Obviously I won't need the login details of your real account, some new account will work just as fine.)

taksuyu commented 11 years ago

Alright I made a dummy account account cinchrb pass cinchtest

Figured I'd add some debug from what I'm getting which might help

Alright heres the bot script: require 'cinch'

bot = Cinch::Bot.new do configure do |c| c.nick = "taksuey" c.server = "taksuyu.jtvirc.com" c.channels = ["#taksuyu"] c.password = "foobar" end

on :message, "hello" do |m| m.reply "Hello" end end

bot.start

http://screencast.com/t/dOnfQdWpNHVw - Link of the CLI debug thread for said hello method

EDIT: Removed BBC since github doesn't use it

dominikh commented 11 years ago

dominikh@dominikh-pc!E:130 $ telnet cinchrb.jtvirc.com 6667
Trying 199.9.253.199...
Connected to cinchrb.jtvirc.com.
Escape character is '^]'.
PASS cinchtest
USER cinchrb
NICK cinchrb
Connection closed by foreign host.

So, that's not really working. What gives?

dominikh commented 11 years ago

Well, I just looked at your screenshot again, and I think we can close this right here. They do not support WHOIS (a rudimentary IRC command) at all, and making Cinch work without that would involve quite a couple of ugly hacks.

I'd suggest asking them to fix their server instead. Until then, Cinch on Justin TV/Twitch/any of their dozen names will not work :(

taksuyu commented 11 years ago

Aww.. is it that the bot is trying to whois itself or the person who messaged? Who knows I may be able to get a workaround going even if it's mickey moused

Would really like to get this bot working since its the only promising one in ruby >_>

dominikh commented 11 years ago

In this particular instance, Cinch runs a WHOIS on itself to determine its host in order to determine the max message length and split messages accordingly. Don't get me wrong, it would technically be possible to make it work with extra checks, I am just not willing to maintain special workarounds for something that is technically not even IRC anymore.

You are free to make your own adjustments in a fork. In this particular instance, the offending part is in Cinch::Target#msg, in particular where @bot.mask is being accessed (that will simply not work on that network). So the whole splitting would need to be removed. Depending on how they implemented their server, messages that are too long will get dropped, truncated or treated properly. Automatic splitting by Cinch will not work.

taksuyu commented 11 years ago

Thank you for pointing me in the right direction, I really appreciate it

I'll probably just play around with it, and if you interested I'll send you what I come up with

Again thank you for taking the time