Last active
September 14, 2020 16:44
-
-
Save aapis/2847c40bb4d86fc0e88a83a333e21ec9 to your computer and use it in GitHub Desktop.
This file contains 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
#! /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