robut icon indicating copy to clipboard operation
robut copied to clipboard

Plugin fetching data periodically

Open Ponf opened this issue 10 years ago • 1 comments

I have ruby script, which runs as daemon and fetches some data from internet every 60 seconds, and posts messages in our channel using HipChat's url hook. I want to move this logic into robut plugin, but all plugins in samples triggered by messages. Can you please provide sample, which will post any message into channel every N seconds starting from robut launch?

Ponf avatar Jan 14 '15 19:01 Ponf

There’s not a great way to do it through the plugin architecture — Robut wasn’t really designed for that kind of thing. But since the Chatfile is just Ruby, you could spin up a thread that could manually send a message every few seconds.

I don’t have any examples of it at hand, but the robut-rdio plugin (https://github.com/radamant/robut-rdio https://github.com/radamant/robut-rdio) does start a Sinatra server from the Chatfile.

The trickiest part is going to be actually sending the message. But I think you could just do it in a similar way to how the plugin architecture sends and receives messages.

On Jan 14, 2015, at 11:42 AM, Filipp Panfilov [email protected] wrote:

I have ruby script, which runs as daemon and fetches some data from internet every 60 seconds, and posts messages in our channel using HipChat's url hook. I want to move this logic into robut plugin, but all plugins in samples triggered by messages. Can you please provide sample, which will post any message into channel every N seconds?

— Reply to this email directly or view it on GitHub https://github.com/justinweiss/robut/issues/49.

justinweiss avatar Jan 15 '15 06:01 justinweiss