go-chat-bot / bot

IRC, Slack, Telegram and RocketChat bot written in go
MIT License
826 stars 195 forks source link

#97 add GetInstance() returning a singleton to expose b.SendMessage() to plugins #98

Closed bnfinet closed 5 years ago

bnfinet commented 5 years ago

This seems like the most straight forward way to access b.SendMessage() directly from a plugin.

The use case is sending out messages which are triggered by events outside of the message stream. My specific itch is notifying an IRC channel of a build on docker-hub after receiving a webhook. So events, not responsive commands nor periodic commands.

I'm happy to explore other solutions such as registering a function with an Outbox, but even in that case the call would be initiated from outside of bot. Perhaps using a queue (or even kafka or redis pub/sub) would be better.