Weird character at the end of every message?

Yo yo yo. I am a software dev, using Node.js and the tmi.js library to create a chatbot.
The only problem I’m having is that I’m getting “false positives” on my arguments array. At the end of each twitch message, it seems some weird Unicode character is added. And it doesn’t qualify as a string, but it makes any if statement on args[0] return truthy.

Any idea as to why this is?

Did you try this using a different library/no library at all?

In case it’s a bug with tmi.js as I’m not seeing the issue in my deployed bots, (And I don’t use tmi.js I use no library at all other than WS for connecting)

1 Like

I have not tried any other library.
When I started making Twitch bots (a while ago). I used tmi.js, so that’s what I am most used to.

But when I started with this particular bot, I wanted to use something more up to date, so I picked dank-twitch-irc, but that was even more buggy.

I glanced over something a week ago when creating a username generator for Twitch (nothing malicious, just random string from the regex Twitch uses/complies with Twitch’s restrictions), a bit of code that removed some part of the message string because they had a similar problem, but as it wasn’t relevant to my project at the time, I don’t remember it.

Heres my chat “template”

that might help see if you are getting this character

What character are you seeing?

1 Like

It’s two boxes in my command prompt (Windows user, yas), since it’s not UTF8 by default. So when I try to copy and paste it into Google, I get %F3%A0%80%80%F3%A0%80%80 which is literally the unicode character for undefined.

Probably time to post your code for others to look at, or raise it on the tmi.js github as an issue (for better visiblity)

1 Like

Oh wow, I was just making the code “forum friendly” and discovered the issue.
Apparently, there has to be a space when using template literals.
"blah${somevar}" will produce the weird unicode character, but "blah ${somevar}" will not.

That would do it

but odd it gets unicode-ed out

1 Like

You should also be aware that many chatters are apparently using clients rigged to get around the “duplicate message” spam restrictions in Twitch. See: https://github.com/pajbot/tmi-rate-limits – essentially they append a space character followed by the reserved Unicode character U+E0000 to the end of their message to get around the Twitch filter. As a byte string you’ll see this as %F3%A0%80%80 which I see you noticed.

1 Like