summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/quotes.rb2
-rw-r--r--lib/rbot/core/remote.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/data/rbot/plugins/quotes.rb b/data/rbot/plugins/quotes.rb
index bb5ae57e..c1066689 100644
--- a/data/rbot/plugins/quotes.rb
+++ b/data/rbot/plugins/quotes.rb
@@ -80,7 +80,7 @@ class QuotePlugin < Plugin
end
else
# random quote
- return @lists[channel].compact[rand(@lists[channel].nitems)],
+ return @lists[channel].compact.pick_one,
@lists[channel].length - 1
end
end
diff --git a/lib/rbot/core/remote.rb b/lib/rbot/core/remote.rb
index 2d39d769..0cefae26 100644
--- a/lib/rbot/core/remote.rb
+++ b/lib/rbot/core/remote.rb
@@ -136,7 +136,7 @@ class Bot
raise "Botmodule #{botmodule.name} tried to unmap #{tmpl.inspect} that was handled by #{tmpl.botmodule}" unless tmpl.botmodule == botmodule.name
debug "Unmapping #{tmpl.inspect}"
@templates[handle] = nil
- @templates.clear unless @templates.nitems > 0
+ @templates.clear unless @templates.compact.size > 0
end
# We redefine the handle() method from MessageMapper, taking into account