百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

robut

> 编程语言
开源

一个简单的支持插件的 HipChat 机器人

171 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个简单的支持插件的 HipChat 机器人

{}[https://travis-ci.org/justinweiss/robut]

= Robut

The friendly plugin-enabled HipChat bot.

== Installation and usage

Robut can be installed by running gem install robut. This installs the +robut+ binary. When run, +robut+ reads a Chatfile, connects to the specified HipChat server and chatroom, and feeds every line said in the chatroom through the plugins configured by the Chatfile.

Once robut is running, the plugins listen to what's being said in the chatroom. Most plugins listen for @replies to robut:

@robut lunch? # => "Banh Mi!" @robut calc 1 + 1 # => 2

Others listen to everything, and don't require an @reply.

Some of the included plugins require extra gems to be installed:

[Robut::Plugin::TWSS] requires the twss gem. [Robut::Plugin::Calc] requires the calc gem. [Robut::Plugin::Weather] requires the nokogiri gem. [Robut::Plugin::GoogleImages] requires the google-search gem.

A list of known 3rd-party plugins is available on the wiki: https://github.com/justinweiss/robut/wiki/Robut-Plugins Feel free to add your own creations!

== The Chatfile

When the +robut+ command runs, it looks for and evals ruby code in a file called +Chatfile+ in the current directory. You can override the configuration file by passing +robut+ a path to a Chatfile as the first parameter:

robut /path/to/Chatfile

The Chatfile is just ruby code. A simple example can be found here: Chatfile[https://github.com/justinweiss/robut/blob/master/examples/Chatfile]

== Robut::Web

You can run Robut as a rack application, which allows it to accept incoming post requests (e.g. Heroku deploy hooks, GitHub post-recieve hooks, etc.) that can send messages to all connected rooms. Have a look at config.ru[https://github.com/justinweiss/robut/blob/master/examples/config.ru] for an example.

=== Adding and configuring plugins

Plugins are ruby classes, so enabling a plugin just requires requiring the plugin file, optionally configuring the plugin class, and adding the class to the global plugin list:

require 'robut/plugin/lunch' Robut::Plugin::Lunch.places = ["Banh Mi", "Mad Oven", "Mod Pizza", "Taphouse"] Robut::Plugin.plugins 2

[Robut::Plugin::Lunch] a random decider for lunch locations.

@robut lunch? # => "Banh Mi!"

[Robut::Plugin::Meme] generates meme images using memecaptain.

@robut meme all_the_things drink; all the beer

[Robut::Plugin::GoogleImages] does a google image search for a query and returns the first result.

@robut image ship it

[Robut::Plugin::Sayings] a simple regex listener and responder.

You're the worst robot ever, @robut. # => I know.

[Robut::Plugin::TWSS] an interface to the TWSS gem. Listens to anything said in the chat room and responds "That's what she said!" where appropriate.

well hurry up, you're not going fast enough # => "That's what she said!"

[Robut::Plugin::Echo] echo back whatever it gets.

@robut echo hello world # => "hello world"

[Robut::Plugin::Say] invokes the "say" command (text-to-speech).

@robut say this rocks # (make sure robut is running on a machine with speakers :)

[Robut::Plugin::Ping] responds with "pong".

@robut ping # => "pong"

[Robut::Plugin::Later] performs the given command after waiting an arbitrary amount of time.

@robut in 5 minutes echo @justin wake up! # => (5 minutes later) "@justin wake up!"

[Robut::Plugin::Weather] uses Google Weather to fetch for the weather for a given location and day.

@robut seattle weather saturday? # => "Forecast for Seattle, WA on Sat: Sunny, High: 77F, Low: 55F"

[Robut::Plugin::Alias] creates aliases to other robut commands.

@robut alias "cowboy" "@robut play bon jovi wanted dead or alive" # Cuz somtimes you need it. @robut alias w weather? # less typing for common stuff

[Robut::Plugin::Quips] stores and posts Bugzilla-style quips.

@robut add quip It was great when I wrote it! @robut quip # => It was great when I wrote it! @robut remove quip It was great when I wrote it!

[Robut::Plugin::Help] lists usage for all the plugins loaded into robut

@robut help # => command usage

== Writing custom plugins

You can supply your own plugins to Robut. To create a plugin, include the Robut::Plugin module and implement the handle(time, sender_nick, message) to perform any plugin-specific logic.

Robut::Plugin provides a few helper methods that are documented in its class definition.

== Contributing

To test your changes:

  1. Install Bundler[http://gembundler.com]
  2. Run bundle install
  3. Make your changes and run bundle exec ruby -Ilib bin/robut ~/MyTestingChatfile
  4. Add tests and verify by running bundle exec rake test

Once your changes are ready:

  1. Fork robut
  2. Create a topic branch: git checkout -b my_branch
  3. Commit your changes
  4. Push to your branch: git push origin my_branch
  5. Send me a pull request
  6. That's it!

== Todo

  • More plugins!

Issues· 15 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言