]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Make the lart plugin use language-specific lart/praises
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 15 Oct 2006 19:36:36 +0000 (19:36 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 15 Oct 2006 19:36:36 +0000 (19:36 +0000)
data/rbot/plugins/lart.rb
data/rbot/templates/lart/larts [deleted file]
data/rbot/templates/lart/larts-english [new file with mode: 0644]
data/rbot/templates/lart/praises [deleted file]
data/rbot/templates/lart/praises-english [new file with mode: 0644]

index d4abee3bafdd4ae9b1b83018adca15e4cf432064..40a0432a234133ab5afe149dd969c5a0022829a7 100644 (file)
@@ -1,9 +1,13 @@
-#  Author:     Michael Brailsford  <brailsmt@yahoo.com>
-#              aka brailsmt
-#  Purpose:       Provide for humorous larts and praises
-#  Copyright:  2002 Michael Brailsford.  All rights reserved.
-#  License:    This plugin is licensed under the BSD license.  The terms of
-#              which follow.
+#  Original Author:
+#               Michael Brailsford  <brailsmt@yahoo.com>
+#               aka brailsmt
+#  Author:      Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+#  Purpose:     Provide for humorous larts and praises
+#  Original Copyright:
+#               2002 Michael Brailsford.  All rights reserved.
+#  Copyright:   2006 Giuseppe Bilotta.  All rights reserved.
+#  License:     This plugin is licensed under the BSD license.  The terms of
+#               which follow.
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions
@@ -33,17 +37,26 @@ class LartPlugin < Plugin
   end
 
   def initialize
-    super
     @larts = Array.new
     @praises = Array.new
-    #read in the lart and praise files
-    if File.exists? "#{@bot.botclass}/lart/larts"
-      IO.foreach("#{@bot.botclass}/lart/larts") { |line|
+    @lartfile = nil
+    @praisefile = nil
+    super
+  end
+
+  def set_language(lang)
+    save
+    @lartfile = "#{@bot.botclass}/lart/larts-#{lang}"
+    @praisefile = "#{@bot.botclass}/lart/praises-#{lang}"
+    @larts.clear
+    @praises.clear
+    if File.exists? @lartfile
+      IO.foreach(@lartfile) { |line|
         @larts << line.chomp
       }
     end
-    if File.exists? "#{@bot.botclass}/lart/praises"
-      IO.foreach("#{@bot.botclass}/lart/praises") { |line|
+    if File.exists? @praisefile
+      IO.foreach(@praisefile) { |line|
         @praises << line.chomp
       }
     end
@@ -53,12 +66,13 @@ class LartPlugin < Plugin
   end
 
   def save
+    return if @lartfile.nil? and @praisefile.nil?
     Dir.mkdir("#{@bot.botclass}/lart") if not FileTest.directory? "#{@bot.botclass}/lart"
     # TODO implement safe saving here too
-    File.open("#{@bot.botclass}/lart/larts", "w") { |file|
+    File.open(@lartfile, "w") { |file|
       file.puts @larts
     }
-    File.open("#{@bot.botclass}/lart/praises", "w") { |file|
+    File.open(@praisefile, "w") { |file|
       file.puts @praises
     }
   end
diff --git a/data/rbot/templates/lart/larts b/data/rbot/templates/lart/larts
deleted file mode 100644 (file)
index c3a2588..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-swaps <who>'s shampoo with nair
-installs windows on <who>'s machine
-forces <who> to use perl for 3 weeks
-registers <who>'s name with 50 known spammers
-resizes <who>'s terminal to 40x24
-takes <who>'s tea
-dispenses <who>'s email address to a few hundred 'bulk mailing services'
-pokes <who> in the eye
-beats <who> senseless with a 50lb Unix manual
-cats /dev/urandom into <who>'s ear
-signs <who> up for AOL
-enrolls <who> in Visual Basic 101
-sporks <who>
-drops a truckload of VAXen on <who>
-judo chops <who>
-resizes <who>'s terminal to 40x24
-formats <who>'s harddrive to fat12
-rm -rf's <who>
-stabs <who>
-steals <who>'s mojo
-strangles <who> with a doohicky mouse cord
-whacks <who> with the cluebat
-sells <who> on E-Bay
-uses <who> as a biological warfare study
-uses the "Customer Appreciation Bat" on <who>
-reads <who> some vogon poetry
-puts <who> in the Total Perspective Vortex
-casts <who> into the fires of Mt. Doom
-gives <who> a melvin
-turns over <who> to Agent Smith to be "bugged"
-takes away <who>'s internet connection
-pushes <who> past the Shoe Event Horizon
-counts "1, 2, 5... er... 3!" and hurls the Holy Handgrenade Of Antioch at <who>
-puts <who> in a nest of camel spiders
-makes <who> read slashdot at -1
-puts "alias vim=emacs" in <who>'s /etc/profile
-uninstalls ld from <who>'s system
-locks <who> in the Chateau d'If
-signs <who> up for getting hit on the head lessons
-makes <who> try to set up a Lexmark printer
-fills <who>'s Visene eyedrop bottle with lime juice
-casts <who> into the fires of Mt. Doom.
-gives <who> a Chicago Steamer
-rips off <who>'s arm, and uses it to beat them to death
-pierces <who>'s nose with a rusty paper hole puncher
-pokes <who> with a rusty nail
-puts sugar between <who>'s bedsheets
-pours sand into <who>'s oatmeal
-mixes epoxy into <who>'s toothpaste
-puts Icy-Hot in <who>'s lip balm
-straps <who> to a chair, and plays a endless low bitrate MP3 loop of "the world's most annoying sound" from "Dumb and Dumber"
-tells Dr. Dre that <who> was talking smack
-forces <who> to use a Commodore 64 for all their word processing
-smacks <who> in the face with a burlap sack full of broken glass
-puts <who> in a room with several heavily armed manic depressives
-makes <who> watch reruns of "Blue's Clues"
-puts lye in <who>'s coffee
-tattoos the Windows symbol on <who>'s ass
-lets Borg have his way with <who>
-signs <who> up for line dancing classes at the local senior center
-wakes <who> out of a sound sleep with some brand new nipple piercings
-gives <who> a 2 guage Prince Albert
-forces <who> to eat all their veggies
-covers <who>'s toilet paper with lemon-pepper
-fills <who>'s ketchup bottle with Dave's Insanity sauce
-forces <who> to stare at an incredibly frustrating and seemingly neverending IRC political debate
-knocks two of <who>'s teeth out with a 2x4
-removes debian from <who>'s system
-uses <who>'s debian cds for skeet shooting practice
-gives <who>'s phone number to Borg
-posts <who>'s IP and root password on alt.2600
-forces <who> to use words like "irregardless" and "administrate" (thereby sounding like a real dumbass)"
-tickles <who> until they wet their pants and pass out
-replaces <who>'s KY with elmer's clear wood glue
-replaces <who>'s TUMS with alka-seltzer tablets
-squeezes habanero pepper juice into <who>'s tub of vaseline for <who>
-submits <who>'s photo to the people at SA for photoshopping
-Forces <who> to learn the Win32 API
-gives <who> an atomic wedgie
-ties <who> to a chair and forces them to listen to 'N Sync at full blast
-forces <who> to use emacs for text editing
-frowns at <who> really really hard
-jabs a hot car lighter into <who>'s eye sockets
-forces <who> to browse the web with IE
-takes <who> out at the knees with a broken pool cue
-forces <who> to listen to only emo music
-signs <who> up for the Iowa State Ferret Legging Championship
-attempts to hotswap <who>'s RAM
-donkey punches <who>
-puts track spikes into <who>'s side
-replaces <who>'s Astroglide with JB Weld
-replaces <who>'s hypertension pills with rat poison pellets
-replaces <who>s jock itch cream with Nair
-does the Australian Death Grip on <who>
-dances upon the grave of <who>'s ancestors.
-farts in <who>'s general direction
-flogs <who> with stinging neddle
-hands <who> a poison ivy joint
diff --git a/data/rbot/templates/lart/larts-english b/data/rbot/templates/lart/larts-english
new file mode 100644 (file)
index 0000000..c3a2588
--- /dev/null
@@ -0,0 +1,98 @@
+swaps <who>'s shampoo with nair
+installs windows on <who>'s machine
+forces <who> to use perl for 3 weeks
+registers <who>'s name with 50 known spammers
+resizes <who>'s terminal to 40x24
+takes <who>'s tea
+dispenses <who>'s email address to a few hundred 'bulk mailing services'
+pokes <who> in the eye
+beats <who> senseless with a 50lb Unix manual
+cats /dev/urandom into <who>'s ear
+signs <who> up for AOL
+enrolls <who> in Visual Basic 101
+sporks <who>
+drops a truckload of VAXen on <who>
+judo chops <who>
+resizes <who>'s terminal to 40x24
+formats <who>'s harddrive to fat12
+rm -rf's <who>
+stabs <who>
+steals <who>'s mojo
+strangles <who> with a doohicky mouse cord
+whacks <who> with the cluebat
+sells <who> on E-Bay
+uses <who> as a biological warfare study
+uses the "Customer Appreciation Bat" on <who>
+reads <who> some vogon poetry
+puts <who> in the Total Perspective Vortex
+casts <who> into the fires of Mt. Doom
+gives <who> a melvin
+turns over <who> to Agent Smith to be "bugged"
+takes away <who>'s internet connection
+pushes <who> past the Shoe Event Horizon
+counts "1, 2, 5... er... 3!" and hurls the Holy Handgrenade Of Antioch at <who>
+puts <who> in a nest of camel spiders
+makes <who> read slashdot at -1
+puts "alias vim=emacs" in <who>'s /etc/profile
+uninstalls ld from <who>'s system
+locks <who> in the Chateau d'If
+signs <who> up for getting hit on the head lessons
+makes <who> try to set up a Lexmark printer
+fills <who>'s Visene eyedrop bottle with lime juice
+casts <who> into the fires of Mt. Doom.
+gives <who> a Chicago Steamer
+rips off <who>'s arm, and uses it to beat them to death
+pierces <who>'s nose with a rusty paper hole puncher
+pokes <who> with a rusty nail
+puts sugar between <who>'s bedsheets
+pours sand into <who>'s oatmeal
+mixes epoxy into <who>'s toothpaste
+puts Icy-Hot in <who>'s lip balm
+straps <who> to a chair, and plays a endless low bitrate MP3 loop of "the world's most annoying sound" from "Dumb and Dumber"
+tells Dr. Dre that <who> was talking smack
+forces <who> to use a Commodore 64 for all their word processing
+smacks <who> in the face with a burlap sack full of broken glass
+puts <who> in a room with several heavily armed manic depressives
+makes <who> watch reruns of "Blue's Clues"
+puts lye in <who>'s coffee
+tattoos the Windows symbol on <who>'s ass
+lets Borg have his way with <who>
+signs <who> up for line dancing classes at the local senior center
+wakes <who> out of a sound sleep with some brand new nipple piercings
+gives <who> a 2 guage Prince Albert
+forces <who> to eat all their veggies
+covers <who>'s toilet paper with lemon-pepper
+fills <who>'s ketchup bottle with Dave's Insanity sauce
+forces <who> to stare at an incredibly frustrating and seemingly neverending IRC political debate
+knocks two of <who>'s teeth out with a 2x4
+removes debian from <who>'s system
+uses <who>'s debian cds for skeet shooting practice
+gives <who>'s phone number to Borg
+posts <who>'s IP and root password on alt.2600
+forces <who> to use words like "irregardless" and "administrate" (thereby sounding like a real dumbass)"
+tickles <who> until they wet their pants and pass out
+replaces <who>'s KY with elmer's clear wood glue
+replaces <who>'s TUMS with alka-seltzer tablets
+squeezes habanero pepper juice into <who>'s tub of vaseline for <who>
+submits <who>'s photo to the people at SA for photoshopping
+Forces <who> to learn the Win32 API
+gives <who> an atomic wedgie
+ties <who> to a chair and forces them to listen to 'N Sync at full blast
+forces <who> to use emacs for text editing
+frowns at <who> really really hard
+jabs a hot car lighter into <who>'s eye sockets
+forces <who> to browse the web with IE
+takes <who> out at the knees with a broken pool cue
+forces <who> to listen to only emo music
+signs <who> up for the Iowa State Ferret Legging Championship
+attempts to hotswap <who>'s RAM
+donkey punches <who>
+puts track spikes into <who>'s side
+replaces <who>'s Astroglide with JB Weld
+replaces <who>'s hypertension pills with rat poison pellets
+replaces <who>s jock itch cream with Nair
+does the Australian Death Grip on <who>
+dances upon the grave of <who>'s ancestors.
+farts in <who>'s general direction
+flogs <who> with stinging neddle
+hands <who> a poison ivy joint
diff --git a/data/rbot/templates/lart/praises b/data/rbot/templates/lart/praises
deleted file mode 100644 (file)
index 3d89df7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-hugs <who>
-gives <who> some love
-gives <who> a cookie
-slaps <who> heartily on the back
-tickles <who>
diff --git a/data/rbot/templates/lart/praises-english b/data/rbot/templates/lart/praises-english
new file mode 100644 (file)
index 0000000..3d89df7
--- /dev/null
@@ -0,0 +1,5 @@
+hugs <who>
+gives <who> some love
+gives <who> a cookie
+slaps <who> heartily on the back
+tickles <who>