2016-01-20 16:23:41 +01:00
# coding: utf-8
require 'cinch'
2016-03-01 15:45:12 +01:00
require 'marky_markov'
require 'open-uri'
2016-01-20 16:23:41 +01:00
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
2016-01-20 16:40:56 +01:00
match / caff(è|e) /
2016-01-20 16:23:41 +01:00
def execute ( m )
users = [ " qup " , " imega " , " gresci " ]
requests = [ " andiamo al bar? " , " caffè? " , " bar? " ]
m . reply users . sample + " : " + requests . sample
end
end
2016-01-21 10:18:47 +01:00
class Amici
include Cinch :: Plugin
match / lavor(o|are|atori) /
def execute ( m )
2016-03-01 15:45:12 +01:00
users = [ " qup " , " imega " , " gresci " , " jigen " , " lgine " , " encrypt " , " thegamer " ]
2016-01-21 10:18:47 +01:00
requests = [ " oggi non ho voglia di fare un cazzo " , " caffè? " , " andiamo al bar? " ]
m . reply users . sample + " " + users . sample + " " + requests . sample
end
end
2016-03-01 15:45:12 +01:00
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
class Film
include Cinch :: Plugin
match / film /
def execute ( m )
loop do
if open ( " http://www.imdb.com/random/title " ) . read =~ / <title>(.*?) ( \ (.*? \ )) - IMDb< \/ title> /
title = $1 . gsub ( " " " , " \" " ) . split
if title . count > 1
#title[title.count - 1] = "Tubia"
title [ rand ( 0 ... title . count ) ] = " Tubia "
m . reply title . join ( ' ' )
break
end
end
end
end
end
class Thegamer
include Cinch :: Plugin
match / thegamer /
def execute ( m )
m . reply [ " ahahahahahaha " , " sistemistahahahahah " ] . sample
end
end
class Encrypt
include Cinch :: Plugin
match / encrypt /
def execute ( m )
m . reply [ " encrypt, non vedo l'ora che arrivi il tempo del nostro prossimo incontro " , " soccia encrypt quanto sei troll " , " encrypt, sei malvagio " , " encrypt, guardare la nebbia " , " ahahah encrypt esatto " , " il nostro encrypt " , " encrypt, è il JSON marxista leninista " , " encrypt, magari " , " encrypt... " , " ciao encrypt " , " encrypt è impazzito " , " encrypt, se vuoi puoi parlare con me " , " ma sei pazzo encrypt? " , " questa è per encrypt " , " encrypt, conosciamo la tua religione " , " Ciao encrypt " , " in particolare encrypt che usa la sua capacità per il Male " ] . sample
end
end
class Tpo
include Cinch :: Plugin
2016-03-01 16:57:34 +01:00
match / (P|p)olitic(a|he|i) /
2016-03-01 15:45:12 +01:00
def execute ( m )
m . reply [ " ahahahahahaha " , " Swasps democrazia! 'Con 1589 votanti si sono concluse le primarie di CoalizioneCivica' " , " Swasps hashtag per tutti: LaCittàDelBuonVivere # CoalizioneCivica # Bologna LoSportDiCittadinanza tra # benessere e # integrazione " , " VIGILI URBANI: UN BUON SINDACO NON DISPREZZA I PROPRI LAVORATORI - Il Sindaco di Bologna... http://fb.me/1XmvjJ2nc " ] . sample
end
end
class Roll
include Cinch :: Plugin
match / roll /
def execute ( m )
m . reply rand ( 1 .. 6 )
end
end
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-01 16:57:34 +01:00
c . plugins . plugins = [ Caffe , ToniNegri , Amici , JS , Salvino , Jops , Qup , Vergogna , Film , Thegamer , Roll , Tpo , Encrypt ]
2016-03-01 15:45:12 +01:00
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
2016-01-20 16:23:41 +01:00
end
end
bot . start