diff options
author | Jay Thomas <degradinglight@gmail.com> | 2013-04-27 22:21:19 -0400 |
---|---|---|
committer | Jay Thomas <degradinglight@gmail.com> | 2013-04-27 22:21:19 -0400 |
commit | cbdb5bd2eae2d30805e7228bce8d9ad70f7e4a9e (patch) | |
tree | 21ea47500d697693e3913499a633a7991b007631 /data | |
parent | 58e1c73deeb78501170f74b68d43721f2079c80e (diff) |
note: added config option to privmsg all notes
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/note.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/data/rbot/plugins/note.rb b/data/rbot/plugins/note.rb index 8b6e5272..25d122a1 100644 --- a/data/rbot/plugins/note.rb +++ b/data/rbot/plugins/note.rb @@ -12,6 +12,10 @@ class NotePlugin < Plugin Note = Struct.new('Note', :time, :from, :private, :text) + Config.register Config::BooleanValue.new 'note.private_message', + :default => false, + :desc => 'Send all notes in private messages instead of channel messages.' + def initialize super return if @registry.length < 1 @@ -41,14 +45,17 @@ class NotePlugin < Plugin priv = [] @registry[nick].each do |n| s = "[#{n.time.strftime('%H:%M')}] <#{n.from}> #{n.text}" - (n.private ? priv : pub).push s + unless n.private or @bot.config['note.private_message'] + pub << s + else + priv << s + end end - if !pub.empty? + unless pub.empty? @bot.say m.replyto, "#{m.sourcenick}, you have notes! " + pub.join(' ') end - - if !priv.empty? + unless priv.empty? @bot.say m.sourcenick, 'you have notes! ' + priv.join(' ') end @registry.delete nick |