From 9f3561b05bef1ba04f9cc49ea4fb89a49b6291a4 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 29 Aug 2007 10:46:14 +0000 Subject: timers: get rid of useless data passing to timer actions. The timer blocks are closures, so they inherit the variables in the scope they were created. Passing those same variables to the block as data is useless. --- data/rbot/plugins/autorejoin.rb | 2 +- data/rbot/plugins/markov.rb | 2 +- data/rbot/plugins/rss.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'data') diff --git a/data/rbot/plugins/autorejoin.rb b/data/rbot/plugins/autorejoin.rb index a8d65958..fde8827c 100644 --- a/data/rbot/plugins/autorejoin.rb +++ b/data/rbot/plugins/autorejoin.rb @@ -11,7 +11,7 @@ class AutoRejoinPlugin < Plugin if m.address? r = rand(10) if r > 0 - @bot.timer.add_once(r, m) {|m| + @bot.timer.add_once(r) { @bot.join m.channel @bot.say(m.channel, @bot.lang.get("insult") % m.sourcenick) if @bot.config['rejoin.insult'] } diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index de33136e..14cd0f99 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -133,7 +133,7 @@ class MarkovPlugin < Plugin line = generate_string(word1, word2) return unless line return if line == message - @bot.timer.add_once(delay, m) {|m| + @bot.timer.add_once(delay) { m.reply line } end diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index c34e5926..ce52420a 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -679,7 +679,7 @@ class RSSFeedsPlugin < Plugin status = Hash.new status[:failures] = 0 status[:first_run] = true - @watch[feed.handle] = @bot.timer.add(0, status) { + @watch[feed.handle] = @bot.timer.add(0) { debug "watcher for #{feed} started" failures = status[:failures] first_run = status.delete(:first_run) -- cgit v1.2.3