From 7fcb4086fa7e168b5ee8ebbd241865f18ef6a874 Mon Sep 17 00:00:00 2001 From: encrypt Date: Sat, 23 Jan 2016 12:36:25 +0100 Subject: [PATCH] =?UTF-8?q?al=20contadin=20non=20far=20sapere=20quanto=20?= =?UTF-8?q?=C3=A8=20buono=20il=20cacio=20con=20le=20pere?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tubiabot.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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