Skip to content

Commit

Permalink
UrlFetchTitle: listen_to を使うようにした
Browse files Browse the repository at this point in the history
refs #5

すべてにマッチする正規表現をなくした
  • Loading branch information
ochaochaocha3 committed Mar 15, 2015
1 parent d0307aa commit 617862a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/rgrb/plugin/url_fetch_title/irc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@ class IrcAdapter

set(plugin_name: 'UrlFetchTitle')

self.prefix = ''
match(/(.*)/, method: :fetch_title)
listen_to(:privmsg, method: :fetch_title)

def initialize(*args)
super

config_data = config[:plugin]
prepare_generator
end

# NOTICE でページのタイトルを返す
# @return [void]
def fetch_title(m, message)
URI.extract(message, %w(http https)) do |url|
def fetch_title(m)
URI.extract(m.message, %w(http https)) do |url|
m.target.send(@generator.fetch_title(url), true)
end
end
Expand Down

0 comments on commit 617862a

Please sign in to comment.