This commit is contained in:
Alexander Munch-Hansen 2017-11-01 01:39:55 +01:00
commit b28822b0bb
2 changed files with 38 additions and 0 deletions

33
bot.rb Normal file
View File

@ -0,0 +1,33 @@
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

5
cat_facts.html Normal file

File diff suppressed because one or more lines are too long