Browse Source

add thegamer film roll

encrypt 8 years ago
parent
commit
32c1f74602
1 changed files with 42 additions and 1 deletions
  1. 42 1
      tubiabot.rb

+ 42 - 1
tubiabot.rb

@@ -1,6 +1,7 @@
 # coding: utf-8
 require 'cinch'
 require 'marky_markov'
+require 'open-uri'
 
 class ToniNegri
   include Cinch::Plugin
@@ -91,6 +92,46 @@ class Vergogna
   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("&quot;","\"").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 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'
@@ -100,7 +141,7 @@ bot = Cinch::Bot.new do
     c.server = "irc.mufhd0.net"
     c.nick = "TubiaBot"
     c.channels = ["#indivia"]
-    c.plugins.plugins = [Caffe, ToniNegri, Amici, JS, Salvino, Jops, Qup, Vergogna]
+    c.plugins.plugins = [Caffe, ToniNegri, Amici, JS, Salvino, Jops, Qup, Vergogna, Film, Thegamer, Roll]
   end
 end