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

Answer to private messages #144

Closed
msehnout opened this issue Aug 14, 2018 · 2 comments
Closed

Answer to private messages #144

msehnout opened this issue Aug 14, 2018 · 2 comments
Labels

Comments

@msehnout
Copy link

msehnout commented Aug 14, 2018

Hi,

first of all, thank you for the library, I really like it!

I have a bot, which works fine when I talk to it in a specific channel such as #test, but I'd also like to talk to it in a private conversation (/QUERY bot ...) so that I don't spam the channel too much. My code looks a lot like in the available examples:
https://github.com/msehnout/lunch-bot/blob/master/src/main.rs#L125
but it does not respond and I cannot figure out how to make it work from the documentation. Can you help me with this? Is it possible?

@msehnout
Copy link
Author

I was able to figure it out, but it took a bit longer. Maybe it would be worth mentioning in some example, that you should respond to message.prefix in case the target from Command::PRIVMSG(target, _) is the same as the current nickname. What to you think?

@aatxe
Copy link
Owner

aatxe commented Aug 16, 2018

This question came up a few years ago (#20), and I think is definitely a confusing thing about the IRC protocol (PRIVMSG really doesn't sound like the name for sending a message to everything...). There's a useful utility function Message::response_target(...) that will yield either the channel being messaged in a PRIVMSG or NOTICE or the nickname of the sender. I've pushed an update to develop that adds this information directly to the docs for PRIVMSG and NOTICE.

Thanks for the report though, and let me know if you think there's more that can be done to clear things up! 🍻

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