Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Privatemessages not working #14

Closed
h1rule opened this issue Jan 14, 2014 · 4 comments
Closed

Privatemessages not working #14

h1rule opened this issue Jan 14, 2014 · 4 comments
Assignees
Labels

Comments

@h1rule
Copy link

h1rule commented Jan 14, 2014

Hello,

just noticed that PrivateMessages to the Bot Owner does not work.

I've set everything correctly in the config.js - the Bot works in channels etc., but private messages doesnt come up. I've logged the action when i send a message to the Botnumber on Whatsapp:

2014-01-14 17:03:19.828210 EE catch_them_all.py:12:
Traceback (most recent call last):
File "/home/niko/breakbot/catch_them_all.py", line 10, in wrapper
return function(_args, *_kwargs)
File "/home/niko/breakbot/wa_bot.py", line 43, in onMessageReceived
messageContent = unicode(messageContent, "utf-8")
TypeError: decoding Unicode is not supported

2014-01-14 17:03:19.828210 EE catch_them_all.py:12: Exception in function onMessageReceived

@stenyak
Copy link
Owner

stenyak commented Jan 28, 2014

Private messaging should now work in both directions (irc>wa, and wa>irc).

Please pull the most recent version and let me know if you still have problems.

@ghost ghost assigned stenyak Jan 28, 2014
@h1rule
Copy link
Author

h1rule commented Jan 29, 2014

Confirmed.

Whatsapp > IRC works.

IRC > Whatsapp not working.

2014-01-29 10:42:39.077555 II bot.py:101: <<< WA 1390988559000: 49151xxxx in 491775xxxx said to None: joooo
2014-01-29 10:42:39.079257 II irc_bot.py:166: ->- IRC ven000m: joooo
2014-01-29 10:42:39.084483 II irc_bot.py:152: >>> IRC PRIVMSG ven000m : joooo
2014-01-29 10:42:48.604819 II bot.py:76: <<< IRC 1390988568603239: ven000m in WhatsApp said to None: hi
2014-01-29 10:42:48.604901 EE catch_them_all.py:12:
Traceback (most recent call last):
File "/home/niko/breakbot/catch_them_all.py", line 10, in wrapper
return function(_args, *_kwargs)
File "./bot.py", line 80, in irc_msg_received
raise Exception("Private message sent to no one?")
Exception: Private message sent to no one?

2014-01-29 10:42:48.604901 EE catch_them_all.py:12: Exception in function irc_msg_received

@stenyak
Copy link
Owner

stenyak commented Jan 29, 2014

That is the expected behaviour, maybe the error message is not very intuitive. The reason is that, whenver you open whatsapp and talk to the bot, the bot doesn't know who to direct your message to.

The way it works is by prefixing the nick of the other person. For example, instead of "joooo", you should write "stenyak: joooo". The bot will then know "jooo" was directed at "stenyak".

Keep in mind that you can be private-messaging to 5 persons at the same time, and you need to know who each message you write is directed to.
You can't simply assume messages are directed at the previous person X (because other person Y may send a message before you hit "send", and the message directed at X will be sent to person Y instead).

I'm open to suggestion on how to handle this situation though. In any case, I should document it better...

@h1rule
Copy link
Author

h1rule commented Jan 29, 2014

It works with Name: text

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants