TubiaBot/tubiabot.rb
2016-03-08 18:10:59 +01:00

47 lines
1,006 B
Ruby

# coding: utf-8
require 'cinch'
require 'marky_markov'
require 'open-uri'
require 'cgi'
plugins = [ :Caffe, :ToniNegri, :Amici, :JS, :Salvino, :Jops, :Qup, :Vergogna, :Film, :Thegamer, :Roll, :Encrypt, :Tpo, :Radio]
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.mufhd0.net"
c.nick = "TubiaBot"
c.channels = ["#indivia"]
c.plugins.plugins = plugins.map { |p| eval(p.to_s) }
end
end
bot.on :message do |m|
if m.user.nick == "Tubia87"
logger.write(m.message+"\n")
end
if m.message.include?(@bot.nick)
m.reply markov.generate_n_sentences 1
end
if m.message.include?("jops")
m.reply "jops: aggiorna lattuga"
end
if m.message.include?("encrypt")
File.open('/tmp/lucine', 'w') do |f|
f.puts('blink 3 0.3')
f.flush
end
end
end
bot.start