34 lines
558 B
Ruby
34 lines
558 B
Ruby
require 'cinch'
|
|
|
|
|
|
file = File.open "cat_facts.html", "r"
|
|
a = file.read.split "<li"
|
|
l = a.collect do |s|
|
|
if s.include? "id"
|
|
s.slice s.index("id"), s.index("<sub>")
|
|
end
|
|
end
|
|
|
|
l.delete_at 0
|
|
done = l.collect do |s|
|
|
if s.include? "id"
|
|
s.slice( s.index(">") + 1 .. s.index("<") - 1 )
|
|
end
|
|
end
|
|
|
|
bot = Cinch::Bot.new do
|
|
configure do |c|
|
|
c.nick = 'CatFacts^'
|
|
c.server = 'server'
|
|
c.port = port
|
|
c.channels = ['#bot-test']
|
|
c.ssl.use = true
|
|
end
|
|
|
|
on :message, /(?i)(.*).*cat.*/ do |m|
|
|
m.reply done.sample
|
|
end
|
|
end
|
|
|
|
bot.start
|