2017-11-01 00:10:08 +00:00
|
|
|
require 'cinch'
|
2017-11-01 00:02:35 +00:00
|
|
|
require_relative 'DictionaryGenerator'
|
|
|
|
require_relative 'SentenceGenerator'
|
|
|
|
|
|
|
|
|
|
|
|
love_file = File.open("love_story.txt","r").read
|
|
|
|
our_file = File.open("our_song.txt","r").read
|
|
|
|
shouldve_file = File.open('shouldve_said_no.txt','r').read
|
|
|
|
|
|
|
|
text = love_file + our_file + shouldve_file
|
|
|
|
|
|
|
|
@dictionary = DictionaryGenerator.new(2)
|
|
|
|
@dictionary.insert_text text
|
|
|
|
|
|
|
|
@sentenceGen = SentenceGenerator.new(@dictionary)
|
|
|
|
puts "-------------------------------------"
|
2017-11-01 00:10:08 +00:00
|
|
|
puts @sentenceGen.generate_sentence
|
2017-11-01 00:02:35 +00:00
|
|
|
puts "-------------------------------------"
|
2017-11-01 00:10:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
bot = Cinch::Bot.new do
|
|
|
|
configure do |c|
|
|
|
|
c.nick = 'TaylorSwift'
|
|
|
|
c.server = 'nick'
|
|
|
|
c.port = 0
|
|
|
|
c.channels = []
|
|
|
|
c.ssl.use = true
|
|
|
|
end
|
|
|
|
|
|
|
|
on :message, /.*(?i)(.).*taylor.*/ do |m|
|
|
|
|
to_reply = @sentenceGen.generate_sentence
|
|
|
|
sec_to_sleep = to_reply.size * 0.01+1
|
|
|
|
sleep(sec_to_sleep)
|
|
|
|
m.reply to_reply
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
bot.start
|