Skip to content

kenjij/s-3po

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

S-3PO

Gem Version security Code Climate Dependency Status

A protocol droid made by Cybot Galactica for Slack.

This gem parses, generates, and manupilates various Slack events and messages.

Requirements

  • Ruby 2.0.0 <=

Usage

If you're creating integrations or bots for Slack, this may come useful. Install:

$ gem install s-3po

Then use:

require 's-3po'

Your bot would connect to Slack via RTM API. Then process events like this.

event = S3PO.parse_event(data_from_slack, {botid: bot_id})
puts "#{event.type} : #{event.subtype}"
puts event.plain if event.is_simplemessage?
# => "@U123ABC: hello you!"

Generate a message to send to Slack.

json = S3PO.generate_message do |reply|
  reply.channel = 'CABC123'
  reply.plain = "@channel: what's up, ya all?"
end
puts json
# => {"type":"message","channel":"CABC123","text":"<!channel>: what's up, ya all?","id":0}

See YARD Doc for more info.

What's Next

  • Provide feedback
  • Expect more updates
  • Random anniversary on May 4th

About

A Slack message "protocol droid®"

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages