X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fplugins.rb;h=8621fe45341456e485894a4768c8d8c298ae8257;hb=41276911b95c934dd5f33ccef53b03bc9dd40975;hp=e40cfcc445a9a03abd46f24699e3e410d2dfbbc9;hpb=91b88cb3a769cc3b7ef97da9354aa1727caf3437;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index e40cfcc4..8621fe45 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -38,36 +38,36 @@ module Plugins Examples: - plugin.map 'karmastats', :action => 'karma_stats' + plugin.map 'pointstats', :action => 'point_stats' # while in the plugin... - def karma_stats(m, params) + def point_stats(m, params) m.reply "..." end # the default action is the first component - plugin.map 'karma' + plugin.map 'points' # attributes can be pulled out of the match string - plugin.map 'karma for :key' - plugin.map 'karma :key' + plugin.map 'points for :key' + plugin.map 'points :key' # while in the plugin... - def karma(m, params) + def points(m, params) item = params[:key] - m.reply 'karma for #{item}' + m.reply 'points for #{item}' end # you can setup defaults, to make parameters optional - plugin.map 'karma :key', :defaults => {:key => 'defaultvalue'} + plugin.map 'points :key', :defaults => {:key => 'defaultvalue'} # the default auth check is also against the first component # but that can be changed - plugin.map 'karmastats', :auth => 'karma' + plugin.map 'pointstats', :auth => 'points' # maps can be restricted to public or private message: - plugin.map 'karmastats', :private => false - plugin.map 'karmastats', :public => false + plugin.map 'pointstats', :private => false + plugin.map 'pointstats', :public => false See MessageMapper#map for more information on the template format and the allowed options. @@ -410,6 +410,9 @@ module Plugins attr_reader :botmodules attr_reader :maps + attr_reader :core_module_dirs + attr_reader :plugin_dirs + # This is the list of patterns commonly delegated to plugins. # A fast delegation lookup is enabled for them. DEFAULT_DELEGATE_PATTERNS = %r{^(?: