summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-07-27 23:09:48 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-07-27 23:09:48 +0000
commit9e6085f0ec2a892cb6ea6d6c4f9ee5a3ea5a832b (patch)
tree0c80b494bde8667e4c2bf7922ec13c133700a441 /lib/rbot
parenta159bb4a89705c08b235b08ff1ac3cfbdd29b016 (diff)
Display plugin status after rescan
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/ircbot.rb6
-rw-r--r--lib/rbot/plugins.rb31
2 files changed, 26 insertions, 11 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index b673c673..fac6c290 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -1003,11 +1003,11 @@ class IrcBot
say m.replyto, "pong"
when (/^rescan$/i)
if(@auth.allow?("config", m.source, m.replyto))
- m.reply "Saving ..."
+ m.reply "saving ..."
save
- m.reply "Rescanning ..."
+ m.reply "rescanning ..."
rescan
- m.okay
+ m.reply "done. #{@plugins.status(true)}"
end
when (/^quiet$/i)
if(auth.allow?("talk", m.source, m.replyto))
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb
index 9fa7ad88..b735c4c5 100644
--- a/lib/rbot/plugins.rb
+++ b/lib/rbot/plugins.rb
@@ -299,22 +299,37 @@ module Plugins
cleanup
@@plugins = Hash.new
scan
+
end
- # return list of help topics (plugin names)
- def helptopics
+ def status(short=false)
# Active plugins first
if(@@plugins.length > 0)
- list = " [#{length} plugin#{'s' if length > 1}: " + @@plugins.values.uniq.collect{|p| p.name}.sort.join(", ")
+ list = "#{length} plugin#{'s' if length > 1}"
+ if short
+ list << " loaded"
+ else
+ list << ": " + @@plugins.values.uniq.collect{|p| p.name}.sort.join(", ")
+ end
else
- list = " [no plugins active"
+ list = "no plugins active"
end
# Ignored plugins next
- list << "; #{Underline}#{@ignored.length} plugin#{'s' if @ignored.length > 1} ignored#{Underline}: use #{Bold}help ignored plugins#{Bold} to see why" unless @ignored.empty?
+ unless @ignored.empty?
+ list << "; #{Underline}#{@ignored.length} plugin#{'s' if @ignored.length > 1} ignored#{Underline}"
+ list << ": use #{Bold}help ignored plugins#{Bold} to see why" unless short
+ end
# Failed plugins next
- list << "; #{Reverse}#{@failed.length} plugin#{'s' if @failed.length > 1} failed to load#{Reverse}: use #{Bold}help failed plugins#{Bold} to see why" unless @failed.empty?
- list << "]"
- return list
+ unless @failed.empty?
+ list << "; #{Reverse}#{@failed.length} plugin#{'s' if @failed.length > 1} failed to load#{Reverse}"
+ list << ": use #{Bold}help failed plugins#{Bold} to see why" unless short
+ end
+ list
+ end
+
+ # return list of help topics (plugin names)
+ def helptopics
+ return " [#{status}]"
end
def length