Skip to content

Instantly share code, notes, and snippets.

@seanedwards
Created August 14, 2015 15:13
Show Gist options
  • Select an option

  • Save seanedwards/27b14d711965c82e6cb7 to your computer and use it in GitHub Desktop.

Select an option

Save seanedwards/27b14d711965c82e6cb7 to your computer and use it in GitHub Desktop.
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