From 6f700fadfc1e45beb6c688c4882a85956bd03e01 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Wed, 1 Nov 2017 01:10:08 +0100 Subject: [PATCH] Forgot bot functionality --- taylor_bot.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/taylor_bot.rb b/taylor_bot.rb index 3611574..f1f7f77 100644 --- a/taylor_bot.rb +++ b/taylor_bot.rb @@ -1,3 +1,4 @@ +require 'cinch' require_relative 'DictionaryGenerator' require_relative 'SentenceGenerator' @@ -13,5 +14,25 @@ text = love_file + our_file + shouldve_file @sentenceGen = SentenceGenerator.new(@dictionary) puts "-------------------------------------" -puts @sentenceGen.generate_sentence() +puts @sentenceGen.generate_sentence puts "-------------------------------------" + + + 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