TubiaBot/tubiabot.rb

48 lines
1,006 B
Ruby
Raw Normal View History

2016-01-20 16:23:41 +01:00
# coding: utf-8
require 'cinch'
require 'marky_markov'
2016-02-26 11:31:45 +01:00
require 'open-uri'
2016-03-08 18:10:59 +01:00
require 'cgi'
2016-01-20 16:23:41 +01:00
2016-03-08 18:10:59 +01:00
plugins = [ :Caffe, :ToniNegri, :Amici, :JS, :Salvino, :Jops, :Qup, :Vergogna, :Film, :Thegamer, :Roll, :Encrypt, :Tpo, :Radio]
2016-01-20 16:23:41 +01:00
2016-03-08 18:10:59 +01:00
plugins.each do |plugin|
require './plugins/'+plugin.downcase.to_s
2016-01-22 10:02:55 +01:00
end
2016-01-20 16:23:41 +01:00
2016-02-18 15:46:48 +01:00
2016-02-26 11:31:45 +01:00
logger = File.open("./logs.txt", 'a+')
markov = MarkyMarkov::TemporaryDictionary.new
markov.parse_file './logs.txt'
2016-01-20 16:23:41 +01:00
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.mufhd0.net"
c.nick = "TubiaBot"
c.channels = ["#indivia"]
2016-03-08 18:10:59 +01:00
c.plugins.plugins = plugins.map { |p| eval(p.to_s) }
2016-01-22 12:56:21 +01:00
end
end
bot.on :message do |m|
if m.user.nick == "Tubia87"
logger.write(m.message+"\n")
2016-01-20 16:23:41 +01:00
end
2016-02-18 15:46:48 +01:00
if m.message.include?(@bot.nick)
m.reply markov.generate_n_sentences 1
end
2016-03-08 18:10:59 +01:00
if m.message.include?("jops")
m.reply "jops: aggiorna lattuga"
end
2016-02-18 15:46:48 +01:00
if m.message.include?("encrypt")
File.open('/tmp/lucine', 'w') do |f|
f.puts('blink 3 0.3')
f.flush
end
end
2016-01-20 16:23:41 +01:00
end
bot.start