Closed lpeabody closed 10 years ago
:tmi.twitch.tv 421 peebznationbot WHOIS :Unknown command
Run it on an actual IRC server, not something that pretends to be but fails horribly.
That's very helpful, thank you.
Yep, this is a bug and it still doesn't work with Twitch.
Twitch doesn't run an actual IRC server, as it doesn't implement the specification. Cinch only supports actual IRC servers, not things that implement a subset of the protocol.
I came across the same issue, and it seems to be related to how twitch handles incoming messages. While it is true cinch does not have to support non-IRC servers, it is nice when we can reuse an existing framework. Here's a quick work-around that allows me to send messages to twitch. Basically, it circumvents all and every checks and pre-processing cinch does, make sure you know what you are doing when using this. Add the following lines to your file:
class Cinch::Message
def twitch(string)
string = string.to_s.gsub('<','<').gsub('>','>')
bot.irc.send ":#{bot.config.user}!#{bot.config.user}@#{bot.config.user}.tmi.twitch.tv PRIVMSG #{channel} :#{string}"
end
end
And use m.twitch
instead of m.reply
. You should also give your password with c.password='oauth:XXXXXXXX'
, where oauth is your twitch oauth pass. You can get it here: http://www.twitchapps.com/tmi/ Also, the channel must be all lowercase. Even a twitch channel called 360Chrism
will only work if you change that to 360chrism
.
Note that this will transmit the message as is - it will neither split it on linebreaks (use string.split(/\r\n|\r|\n/).each do |line| ; <...> ; end
), and it will not check if it is too long (max is 510 bytes total, ie what gets passed to Cinch::IRC#send
), nor does it take care of the encoding issues or color codes. Check out the source code at http://rubydoc.info/gems/cinch/Cinch/Channel#msg-instance_method and http://rubydoc.info/gems/cinch/Cinch/Target#msg-instance_method , it implements the above-mentioned.
@blutorange Thanks for the patch, it works like a charm.
@blutorange You are a hero in my eyes.
Thanks @blutorange this work nicely!
I'm basically running an identical copy of the first example listed on the main page of the repository.
Here's my code:
Here's the error that gets produced:
Running ruby v2.0.0.-p353 and the following gemset:
Any thoughts? I have zero experience with Ruby threading, though it seems like there is a problem establishing a lock on user? Help!