diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-08 16:09:14 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-08 16:09:14 +0200 |
commit | 0779bf6e7247105b76b5a7563ffbf7a542fd8a4f (patch) | |
tree | 409b4508aa862f742751dcb5313c87b3bc73cf91 /data | |
parent | 52895a145e3327919b1a40647d4352bd2e9bc707 (diff) |
linkbot plugin: use fake_message()
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/linkbot.rb | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/data/rbot/plugins/linkbot.rb b/data/rbot/plugins/linkbot.rb index b50027ec..360735e9 100644 --- a/data/rbot/plugins/linkbot.rb +++ b/data/rbot/plugins/linkbot.rb @@ -61,24 +61,12 @@ class LinkBot < Plugin # person's highlight new_nick.gsub!(/[#{Bold}#{Underline}#{Reverse}#{Italic}#{NormalText}]/, '') debug "#{m.sourcenick} reports that #{new_nick} said #{message.inspect} on #{network}" - # One way to pass the new message back to the bot is to create a PrivMessage - # and delegate it to the plugins - new_m = PrivMessage.new(@bot, m.server, m.server.user(new_nick), m.target, message) - @bot.plugins.delegate "listen", new_m - @bot.plugins.delegate "message", new_m - @bot.plugins.privmsg(new_m) if new_m.address? - - ## Another way is to create a data Hash with source, target and message keys - ## and then letting the bot client :privmsg handler handle it - ## Note that this will also create irclog entries for the fake PRIVMSG - ## TODO we could probably add a :no_irc_log entry to the data passed to the - ## @bot.client handlers, or something like that - # data = { - # :source => m.server.user(new_nick) - # :target => m.target - # :message => message - # } - # @bot.client[:privmsg].call(data) + begin + # Pass the new message back to the bot + fake_message(message, :from => m, :source => m.server.user(new_nick)) + rescue RecurseTooDeep => e + error e + end end end end |