stenyak / breakbot

WhatsApp<->IRC gateway bot
90 stars 38 forks source link

Messages with emoji or text smileys entirely dropped #26

Open Hugo2607 opened 9 years ago

Hugo2607 commented 9 years ago

First off, this script is great, just what I was looking for. So thanks very much to the devs.

However I did run into a few bugs I thought I'd report: The ASCII conversion doesn't pick up the emoji, wich is to be expected but instead of the emoji just being ignored the whole message including the regular text is dropped.

Also, technically unrelated but most text smileys contain a ":" which this script uses to signal a username and as a result the message is also dropped, for example, if someone sends the message "Smileys are great :D" the message shows up in IRC as "D". I use this mostly to connect a group chat to an IRC channel so this could be easily resolved by dropping the username detection from group chats but that isn't exactly the best solution.

Thanks in advance, Hugo2607

stenyak commented 9 years ago

I need more information regarding the emoji issue. Is it the problem described in #6, or the problem described in #24, or is it something else entirely? If it's different than those two issues, I need you to please attach the logs generated by the bot (log.txt), so that I can try to find the problem.

Hugo2607 commented 9 years ago

It seems to be the same problem described in #6, however the script was able to mirror all the example characters he named and in my case I just wasn't able to send emoji.

The other issue I named is the same as #24.

I was able to find two fixes for both of those issues, but they're not perfect since I can't write python code myself.

I fixed issue #24 by changing line 20 of bot.py from "split = msg.split(":", 1)" to "split = msg.split(":", 0)" this breaks the private messaging feature, however if you're only using the bot for group chats it's probably worth it to prevent half of a message being dropped if it's got a ":" in it.

I found a workaround for issue #6 by changing Python's default encoding from ASCII to UTF-8.

I did this by changing "encoding = "ascii"" to " encoding = "utf-8"" in /usr/lib/python2.7/site.py

This is not recommended as it might cause problems with other python scripts however the server I'm running this on doesn't run any other python scripts so this works for me.

Once again these more workarounds than they are fixes, so any actual fixes would be appreciated but maybe these will help anyone who's also having these issues.