TubiaBot/plugins/film.rb
2016-03-08 18:10:59 +01:00

19 lines
445 B
Ruby

class Film
include Cinch::Plugin
match /film/
def execute(m)
loop do
if open("http://www.imdb.com/random/title").read =~ /<title>(.*?) (\(.*?\)) - IMDb<\/title>/
title = $1.gsub("&quot;","\"").split
if title.count > 1
#title[title.count - 1] = "Tubia"
title[rand(0...title.count)] = "Tubia"
m.reply title.join(' ')
break
end
end
end
end
end