diff options
author | Matthias Hecker <36882671+mattzque@users.noreply.github.com> | 2020-03-27 20:58:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-27 20:58:27 +0100 |
commit | b6db18c5467c1a161e3fcc39d82ad1b38e213c87 (patch) | |
tree | d14a83493271efdbcd75c499e4ceeee200da3ab0 /lib/rbot | |
parent | 1ebaeb69079f8c6b07423201ce83f996ecff7b01 (diff) | |
parent | bc7efe2d4b360da0276287e6cc7f6a401609c162 (diff) |
Merge pull request #4 from ahpook/rename_karma
Rename and improve karma plugin
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/messagemapper.rb | 12 | ||||
-rw-r--r-- | lib/rbot/plugins.rb | 22 |
2 files changed, 17 insertions, 17 deletions
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index 3e877626..3966bc17 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -199,12 +199,12 @@ class Bot # # Further examples: # - # # match 'karmastats' and call my stats() method - # plugin.map 'karmastats', :action => 'stats' - # # match 'karma' with an optional 'key' and call my karma() method - # plugin.map 'karma :key', :defaults => {:key => false} - # # match 'karma for something' and call my karma() method - # plugin.map 'karma for :key' + # # match 'pointstats' and call my stats() method + # plugin.map 'pointstats', :action => 'stats' + # # match 'points' with an optional 'key' and call my points() method + # plugin.map 'points :key', :defaults => {:key => false} + # # match 'points for something' and call my points() method + # plugin.map 'points for :key' # # # two matches, one for public messages in a channel, one for # # private messages which therefore require a channel argument diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 3b01509b..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. |