This repository has been archived on 2026-03-31. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
corgbot/app.rb
2016-04-19 17:21:03 +09:00

20 lines
446 B
Ruby

require 'sinatra'
require 'tilt/erb'
set :public_folder, 'public'
class CorgBotApp < Sinatra::Base
get '/' do
extensions = ['.png', '.jpg', '.jpeg', '.gif']
images = Dir.entries('public/images').delete_if { |x|
extension = x[-4, 4]
!extensions.index(extension)
}
corgi = images[rand(images.length)]
erb :index, :locals => {
:corgi => corgi
}
end
end