TubiaBot/tubiabot.rb
2016-02-18 15:46:48 +01:00

122 lines
2.2 KiB
Ruby

# coding: utf-8
require 'cinch'
require 'marky_markov'
class ToniNegri
include Cinch::Plugin
match "toninegri"
def execute(m)
@bot.nick = "toninegri"
m.reply "swasp: sono tuo padre"
@bot.nick = "TubiaBot"
end
end
class Caffe
include Cinch::Plugin
match /caff(è|e)/
def execute(m)
users = [ "qup", "imega", "gresci" ]
requests = [ "andiamo al bar?", "caffè?", "bar?" ]
m.reply users.sample+": "+requests.sample
end
end
class Amici
include Cinch::Plugin
match /lavor(o|are|atori)/
def execute(m)
users = [ "qup", "imega", "gresci", "jigen", "lgine", "encrypt", "thegamer" ]
requests = [ "oggi non ho voglia di fare un cazzo", "caffè?", "andiamo al bar?" ]
m.reply users.sample+" "+users.sample+" "+requests.sample
end
end
class JS
include Cinch::Plugin
match /js/
def execute(m)
frameworks = ["Angular", "React", "Ember", "Meteor"]
loves = ["è una figata", "è bellissimo"]
m.reply frameworks.sample+" "+loves.sample
end
end
class Salvino
include Cinch::Plugin
match /salvino/
def execute(m)
m.reply "FORZA SALVINO"+("O"*rand(3...10))
end
end
class Jops
include Cinch::Plugin
match /jops/
def execute(m)
cibo = ["tigelle", "crescentine"]
m.reply "jops: andiamo a mangiare le "+cibo.sample+" ?"
end
end
class Qup
include Cinch::Plugin
match /qup/
def execute(m)
m.reply "qup, ora ti vengo a menare"
end
end
class Vergogna
include Cinch::Plugin
match /vergogna/
def execute(m)
m.reply "vergogna vergogna settimo reparto"
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"
c.nick = "TubiaBot"
c.channels = ["#indivia"]
c.plugins.plugins = [Caffe, ToniNegri, Amici, JS, Salvino, Jops, Qup, Vergogna]
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?("encrypt")
File.open('/tmp/lucine', 'w') do |f|
f.puts('blink 3 0.3')
f.flush
end
end
end
bot.start