Unable to have bot post using whitespace


I have recently been developing a bot that needs to be able to post using whitespace. It seems that Twitch is stripping whitespace from bot posts. In chat, for example, if I use the EN QUAD, U+2000, the space is not stripped, but if I send the same message via an IRC bot the whitespace is stripped. Is this expected behavior or is it just a bug? See below for the python code.

			eq = u" "*4 # EN QUAD Whitespace
			mesg = u" x " # Message with normal spaces
			mesg = mesg.replace(" ", eq)
			print mesg

			self.socket.send(u"PRIVMSG {} :{}\r\n".format(TWITCH_CHAN, msg).encode("utf-8"))

Thanks for your help!

the space in your eq is a normal space or the forum software messed it up. I’d just use the explicit \u2000 syntax with it.

I can assure you that in my code it is an eq… Twitch seems to be stripping all whitespace to one space, regardless. I also did try to use the explicit syntax as well.

Twitch doesn’t (I don’t think) but Twitch Chat/Web/HTML/Chrome/Firefox does.

And you probably can’t send a   ie an encoded space and expect it to decode.

Does that replace only the first space (like javascript) or all spaces? Is it a global replace for the string? My python is rusty :stuck_out_tongue:

White-space characters are trimmed on purpose to avoid walls of spam in chat and accidental spaces before a command. Extensions or separate webpages would be better used for formatted output.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.