ajm188 / slack

Slack clients in golang
MIT License
2 stars 1 forks source link

Bot events that trigger after a certain amount of time elapses. #34

Open brenns10 opened 8 years ago

brenns10 commented 8 years ago

It would be convenient for some types of plugins (the ones that don't just respond to things) to be able to be called every X seconds. I'm thinking an API similar to: bot.Every(X, callable). I tried to look through the code to see how this would be possible (set a timeout on the read() operation, right?), but it seems that not knowing Go put me at a serious disadvantage.

The specific use case I have in mind is that I would like to write a plugin that will (every 5/10/15 minutes or so) scan a set of RSS feeds and @channel any new articles to a designated channel (like #blogs). Because I for one don't really use RSS, and I think many people don't, but it would be cool if everyone at HacSoc got free publicity (directly to interested readers) in Slack whenever they write something.

ajm188 commented 8 years ago

I agree. Unfortunately, I don't think it's currently possible, at least not easily given the current architecture.

However, once #12 is complete (at least with the solution I have in mind), this should be possible, as all a handler would need to send a message is send a struct into a channel, so that would be able to happen at any time.