I’m writing an IRC bot and I’m trying to figure out the maximum length that a message can have in characters, so that I know when to split long messages into several parts.
I found out that Twitch limits the length of messages to 500 characters, which does not include the characters for the rest of an IRC message at the protocol level. This can result in Twitch sending me IRC messages (the ones at the protocol level) that are much longer than the 512-character limit specified in RFC 1459.
However, I also found out that the Twitch server is dropping IRC messages that are longer than 469 characters. Those 469 characters include the IRC protocol header consisting of the PRIVMSG command, the parameters, the actual text message and the terminating CR/LF pair.
I’m wondering whether there’s a mistake on my part. A limit of 469 characters for server-inbound IRC messages seems kind of random.
Twitch is a bit half and half about following the RFC.
Since it’s not really IRC. It’s TMI (Twitch Messaging Interface), which implements and IRC compatible interface.
The other thing to consider is that your bot might wanna be avoiding “Walls of Text” in chat anyway so keeping a shorter message length, will look better for a Twitch Chat overall.
Gotta account for tags and other data attached to the message but I’ve not exactly looked into it too much myself since MOST of the messaging my bots send doesn’t get anywhere near the limits
You’re probably right. Most of the time, the messages will be shorter than whatever the limit is.
I was trying to prepare for the rare, possibly theoretical case of messages going over the limit. For lack of an officially-defined limit that I can write code against, I suppose I could either set myself a conservative limit or I could simply live with the fact that some messages might get dropped in rare cases.