39 lines
934 B
Ruby
39 lines
934 B
Ruby
# coding: utf-8
|
|
require 'cinch'
|
|
require 'marky_markov'
|
|
require 'open-uri'
|
|
|
|
plugins = [ :Caffe, :ToniNegri, :Amici, :JS, :Salvino, :Jops, :Qup, :Vergogna, :Film, :Thegamer, :Roll, :Encrypt, :Tpo, :Radio, :VCN, :Bookmarks]
|
|
|
|
plugins.each do |plugin|
|
|
require './plugins/'+plugin.downcase.to_s
|
|
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.autistici.org"
|
|
c.port = 9999
|
|
c.ssl.use = true
|
|
c.nick = "TubiaBot"
|
|
c.channels = ["#indivia"]
|
|
c.plugins.plugins = plugins.map { |p| eval(p.to_s) }
|
|
end
|
|
end
|
|
|
|
bot.on :message do |m|
|
|
nicks = [ "Tubia87", "pippo" ]
|
|
if nicks.include? m.user.nick
|
|
#logger.write(m.message+"\n")
|
|
end
|
|
if m.message.include?(@bot.nick)
|
|
rp = markov.generate_n_sentences 1
|
|
m.reply rp
|
|
#system("espeak -v italian \""+rp+"\"")
|
|
end
|
|
end
|
|
|
|
bot.start
|