FIXED
SMS encodings
GroupMe works with the old SMS system. Which means that a message can be up to 160 normal characters (normal being defined by GSM-7 standard) and not normal characters taking up the value of 2 normal characters. (E.g. the characters ‘’ aren’t gsm-7 normal characters). Then there are even funnier characters such as Hebrew and emojis which change the entire messages encoding to USC-2 which gives you a limit of only 70 characters per message.
GroupMe behavior with SMS
So GroupMe used to take any none GSM compatible character and replace it with a ‘?’ for SMS users. That meant you can always have close to the full 160 characters per message. (I say close because you gotta subtract the ‘name: ’ in the beginning and the ’ (1/2)’ at the end and the fact that it didn’t split mid word.)
what changed
Now 2 changes were made. 1 good and 1 not so much. And the good 1 makes the bad 1 worse…
So the first thing is that GroupMe started supporting emojis and Hebrew characters for SMS users. The second thing is that they limited the amount of splits to 3. So if the message is longer, in the third message it’ll just end with ‘… Link’. And since now all characters are supported, 1 funny symbol in a Copilot response means the entire message be limited to 70 characters a chunk and the limit being reached annoyingly quickly.
the fix
The fix is simple. Instead of letting GroupMe do the work of splitting your long message according to it’s discretion I made the bot do it itself. So before a message is sent, it’s parsed. If less than a fifth is funny characters (aka it’s not a text written in Yiddish), all funny characters are replaced with literall question marks (so that you don’t get 5 splits for a single message) and it’s split into chunks of close to 160 each (accounting for the bot name and the 1/2 the bot appends to the end). If more than a fifth is funny characters then it leaves them as is. Either way they get split in a way that makes GroupMe sends each message without further splitting or truncating.
The code is written in python and uses a python library. I don’t know if or what exists for js. But technically it should be easy to write it without a library. Just arrays of different character sets.