]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/imdb.rb
Plugin header boilerplating.
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / imdb.rb
index 432d0efc47ea4d87f537f6d431a9f3abb7073e0a..6cbdaf5386728dc09865491d57117872bc9bad39 100644 (file)
@@ -1,6 +1,11 @@
-# IMDB plugin for RubyBot
-# (c) 2005 Arnaud Cornet <arnaud.cornet@gmail.com>
-# Licensed under MIT License.
+#-- vim:sw=2:et
+#++
+#
+# :title: IMDB plugin for rbot
+#
+# Author:: Arnaud Cornet <arnaud.cornet@gmail.com>
+# Copyright:: (C) 2005 Arnaud Cornet
+# License:: MIT license
 
 require 'net/http'
 require 'cgi'
@@ -70,16 +75,12 @@ class ImdbPlugin < Plugin
     "imdb <string> => search http://www.imdb.org for <string>"
   end
 
-  def privmsg(m)
-    unless(m.params && m.params.length > 0)
-      m.reply "incorrect usage: " + help(m.plugin)
-      return
-    end
-
+  def imdb(m, params)
+    what = params[:what].to_s
     i = Imdb.new(@bot)
-    info = i.info(m.params)
+    info = i.info(what)
     if !info
-      m.reply "Nothing found for #{m.params}"
+      m.reply "Nothing found for #{what}"
       return nil
     end
     m.reply "#{info[1]} : #{info[0]}"
@@ -88,5 +89,5 @@ class ImdbPlugin < Plugin
 end
 
 plugin = ImdbPlugin.new
-plugin.register("imdb")
+plugin.map "imdb *what"