diff options
-rw-r--r-- | data/rbot/plugins/excuse.rb | 2 | ||||
-rw-r--r-- | data/rbot/plugins/points.rb (renamed from data/rbot/plugins/karma.rb) | 42 | ||||
-rw-r--r-- | lib/rbot/messagemapper.rb | 12 | ||||
-rw-r--r-- | lib/rbot/plugins.rb | 22 | ||||
-rw-r--r-- | po/en/rbot-points.po (renamed from po/en/rbot-karma.po) | 0 | ||||
-rw-r--r-- | po/fi/rbot-points.po (renamed from po/fi/rbot-karma.po) | 0 | ||||
-rw-r--r-- | po/fr/rbot-points.po (renamed from po/fr/rbot-karma.po) | 0 | ||||
-rw-r--r-- | po/it/rbot-points.po (renamed from po/it/rbot-karma.po) | 0 | ||||
-rw-r--r-- | po/ja/rbot-points.po (renamed from po/ja/rbot-karma.po) | 0 | ||||
-rw-r--r-- | po/rbot-points.pot (renamed from po/rbot-karma.pot) | 0 | ||||
-rw-r--r-- | po/zh_CN/rbot-points.po (renamed from po/zh_CN/rbot-karma.po) | 0 | ||||
-rw-r--r-- | po/zh_TW/rbot-points.po (renamed from po/zh_TW/rbot-karma.po) | 0 |
12 files changed, 39 insertions, 39 deletions
diff --git a/data/rbot/plugins/excuse.rb b/data/rbot/plugins/excuse.rb index ad0e8334..61f38bd6 100644 --- a/data/rbot/plugins/excuse.rb +++ b/data/rbot/plugins/excuse.rb @@ -387,7 +387,7 @@ class ExcusePlugin < Plugin "Dyslexics retyping hosts file on servers", "The Internet is being scanned for viruses.", "Your computer's union contract is set to expire at midnight.", -"Bad user karma.", +"Bad reputation.", "/dev/clue was linked to /dev/null", "Increased sunspot activity.", "We already sent around a notice about that.", diff --git a/data/rbot/plugins/karma.rb b/data/rbot/plugins/points.rb index 93d21189..1a1464e5 100644 --- a/data/rbot/plugins/karma.rb +++ b/data/rbot/plugins/points.rb @@ -1,4 +1,4 @@ -class KarmaPlugin < Plugin +class PointsPlugin < Plugin def initialize super @@ -14,17 +14,17 @@ class KarmaPlugin < Plugin @registry.set_default(0) # import if old file format found - oldkarma = @bot.path 'karma.rbot' - if File.exist? oldkarma - log "importing old karma data" - IO.foreach(oldkarma) do |line| + oldpoints = @bot.path 'points.rbot' + if File.exist? oldpoints + log "importing old points data" + IO.foreach(oldpoints) do |line| if(line =~ /^(\S+)<=>([\d-]+)$/) item = $1 - karma = $2.to_i - @registry[item] = karma + points = $2.to_i + @registry[item] = points end end - File.delete oldkarma + File.delete oldpoints end end @@ -38,26 +38,26 @@ class KarmaPlugin < Plugin end end - def karma(m, params) + def points(m, params) thing = params[:key] thing = m.sourcenick unless thing thing = thing.to_s - karma = @registry[thing] - if(karma != 0) - m.reply "karma for #{thing}: #{@registry[thing]}" + points = @registry[thing] + if(points != 0) + m.reply "points for #{thing}: #{@registry[thing]}" else - m.reply "#{thing} has neutral karma" + m.reply "#{thing} has zero points" end end - def setkarma(m, params) + def setpoints(m, params) thing = (params[:key] || m.sourcenick).to_s @registry[thing] = params[:val].to_i - karma(m, params) + points(m, params) end def help(plugin, topic="") - "karma module: Listens to everyone's chat. <thing>++/<thing>-- => increase/decrease karma for <thing>, karma for <thing>? => show karma for <thing>, karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own." + "points module: Keeps track of internet points, infusing your pointless life with meaning. Listens to everyone's chat. <thing>++/<thing>-- => increase/decrease points for <thing>, points for <thing>? => show points for <thing>, pointstats => show stats. Points are a community rating system - only in-channel messages can affect points and you cannot adjust your own." end def message(m) @@ -100,11 +100,11 @@ class KarmaPlugin < Plugin end end -plugin = KarmaPlugin.new +plugin = PointsPlugin.new plugin.default_auth( 'edit', false ) -plugin.map 'karmastats', :action => 'stats' -plugin.map 'karma :key', :defaults => {:key => false} -plugin.map 'setkarma :key :val', :defaults => {:key => false}, :requirements => {:val => /^-?\d+$/}, :auth_path => 'edit::set!' -plugin.map 'karma for :key' +plugin.map 'pointstats', :action => 'stats' +plugin.map 'points :key', :defaults => {:key => false} +plugin.map 'setpoints :key :val', :defaults => {:key => false}, :requirements => {:val => /^-?\d+$/}, :auth_path => 'edit::set!' +plugin.map 'points for :key' 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 e40cfcc4..0e7e9d6f 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. diff --git a/po/en/rbot-karma.po b/po/en/rbot-points.po index e69de29b..e69de29b 100644 --- a/po/en/rbot-karma.po +++ b/po/en/rbot-points.po diff --git a/po/fi/rbot-karma.po b/po/fi/rbot-points.po index e69de29b..e69de29b 100644 --- a/po/fi/rbot-karma.po +++ b/po/fi/rbot-points.po diff --git a/po/fr/rbot-karma.po b/po/fr/rbot-points.po index e69de29b..e69de29b 100644 --- a/po/fr/rbot-karma.po +++ b/po/fr/rbot-points.po diff --git a/po/it/rbot-karma.po b/po/it/rbot-points.po index e69de29b..e69de29b 100644 --- a/po/it/rbot-karma.po +++ b/po/it/rbot-points.po diff --git a/po/ja/rbot-karma.po b/po/ja/rbot-points.po index e69de29b..e69de29b 100644 --- a/po/ja/rbot-karma.po +++ b/po/ja/rbot-points.po diff --git a/po/rbot-karma.pot b/po/rbot-points.pot index e69de29b..e69de29b 100644 --- a/po/rbot-karma.pot +++ b/po/rbot-points.pot diff --git a/po/zh_CN/rbot-karma.po b/po/zh_CN/rbot-points.po index e69de29b..e69de29b 100644 --- a/po/zh_CN/rbot-karma.po +++ b/po/zh_CN/rbot-points.po diff --git a/po/zh_TW/rbot-karma.po b/po/zh_TW/rbot-points.po index e69de29b..e69de29b 100644 --- a/po/zh_TW/rbot-karma.po +++ b/po/zh_TW/rbot-points.po |