Added config

This commit is contained in:
Alexander Munch-Hansen 2017-11-01 13:17:16 +01:00
parent 6f700fadfc
commit 4875126983

View File

@ -1,6 +1,7 @@
require 'cinch' require 'cinch'
require_relative 'DictionaryGenerator' require_relative 'DictionaryGenerator'
require_relative 'SentenceGenerator' require_relative 'SentenceGenerator'
require_relative 'config'
love_file = File.open("love_story.txt","r").read love_file = File.open("love_story.txt","r").read
@ -12,23 +13,23 @@ text = love_file + our_file + shouldve_file
@dictionary = DictionaryGenerator.new(2) @dictionary = DictionaryGenerator.new(2)
@dictionary.insert_text text @dictionary.insert_text text
@sentenceGen = SentenceGenerator.new(@dictionary) sentenceGen = SentenceGenerator.new(@dictionary)
puts "-------------------------------------" puts "-------------------------------------"
puts @sentenceGen.generate_sentence puts sentenceGen.generate_sentence
puts "-------------------------------------" puts "-------------------------------------"
bot = Cinch::Bot.new do bot = Cinch::Bot.new do
configure do |c| configure do |c|
c.nick = 'TaylorSwift' c.nick = 'TaylorSwift'
c.server = 'nick' c.server = SERVER_ADDRESS
c.port = 0 c.port = PORT
c.channels = [] c.channels = CHANNELS
c.ssl.use = true c.ssl.use = true
end end
on :message, /.*(?i)(.).*taylor.*/ do |m| on :message, /.*(?i)(.).*taylor.*/ do |m|
to_reply = @sentenceGen.generate_sentence to_reply = sentenceGen.generate_sentence
sec_to_sleep = to_reply.size * 0.01+1 sec_to_sleep = to_reply.size * 0.01+1
sleep(sec_to_sleep) sleep(sec_to_sleep)
m.reply to_reply m.reply to_reply