jaraco / irc

Full-featured Python IRC library for Python.
MIT License
390 stars 84 forks source link

Add example on how to send a message to a channel #182

Open Torxed opened 3 years ago

Torxed commented 3 years ago

Perhaps in on_message using the c handle, it might be easy. But if you access the server object from outside a event-driven event, it seams extremely complicated to figure out how to send messages.

Overall, documentation other than auto-doc strings would be pretty helpful.

jaraco commented 3 years ago

Thanks for the suggestion. I'd welcome additional documentation. I've always managed by hacking through the source, but I'd be very much delighted if someone were to author some docs, especially ones that meet common needs.

The short answer to your question is that it's not easy, at least not that I've found.

In the pmxbot project, which builds on IRC, I found that to send messages from an outside source, I needed to inject them into a queue and then in a periodic, scheduled command, pop messages off the queue to send them.

It's inelegant and sure would be nice if there were a more straightforward way to send messages.