Created
August 14, 2015 15:13
-
-
Save seanedwards/27b14d711965c82e6cb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| require 'slackbotsy' | |
| set :bind, '0.0.0.0' | |
| config = { | |
| 'channel' => '#default', | |
| 'name' => 'botsy', | |
| 'incoming_webhook' => 'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX', | |
| 'outgoing_token' => 'XXXXXXXXXXXXXXXXXXXXXXXX' | |
| } | |
| bot = Slackbotsy::Bot.new(config) do | |
| hear /echo\s+(.+)/ do |mdata| | |
| puts "doop" | |
| "I heard #{user_name} say '#{mdata[1]}' in #{channel_name}" | |
| end | |
| hear /deploy\s+(.+)/ do |mdata| | |
| puts "We got: #{mdata}" | |
| puts "Now we're just running a ruby function, so we can do things like: " | |
| puts "sudo chef-client" | |
| "Deployment in progress" | |
| end | |
| end | |
| post '/' do | |
| bot.handle_item(params) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment