diff --git a/tubiabot.rb b/tubiabot.rb index fc881b2..6154ffc 100644 --- a/tubiabot.rb +++ b/tubiabot.rb @@ -1,5 +1,6 @@ # coding: utf-8 require 'cinch' +require 'marky_markov' class ToniNegri include Cinch::Plugin @@ -59,6 +60,10 @@ class Salvino end end +logger = File.open("./logs.txt", 'a+') +markov = MarkyMarkov::TemporaryDictionary.new +markov.parse_file './logs.txt' + bot = Cinch::Bot.new do configure do |c| c.server = "irc.mufhd0.net" @@ -68,12 +73,13 @@ bot = Cinch::Bot.new do end end -logger = File.open("./logs.txt", 'a+') - bot.on :message do |m| if m.user.nick == "Tubia87" logger.write(m.message+"\n") end + if m.message.include?(@bot.nick) and !@bot.user_list.include?("Tubia87") + m.reply markov.generate_n_sentences 1 + end end bot.start