Skip to content

Instantly share code, notes, and snippets.

@aapis
Last active September 14, 2020 16:44
Show Gist options
  • Save aapis/2847c40bb4d86fc0e88a83a333e21ec9 to your computer and use it in GitHub Desktop.
Save aapis/2847c40bb4d86fc0e88a83a333e21ec9 to your computer and use it in GitHub Desktop.
#! /usr/bin/ruby
# Really dumb slack bot. Change the contents of the people array, run script. Start
# ngrok, create slack app with a "slash command", use URL from ngrok
require 'sinatra'
def who_first
cache = '.wholast'
people = [:Name1, :Name2]
last = File.read(cache)
person = people.reject { |p| p.to_sym == last }.sample
File.write(cache, person)
"The person who goes first today is... #{person}!"
end
post '/first' do
who_first
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment