lib/protonbot/titler/plugin.rb in protonbot-titler-0.1.2 vs lib/protonbot/titler/plugin.rb in protonbot-titler-0.1.3

- old
+ new

@@ -7,10 +7,10 @@ @description = 'A URL resolver for ProtonBot. Filters most bots automatically, so no botloops.' hook(type: :privmsg) do |dat| #core.privmsg_patch(dat) unless /(bot|serv)/i.match("#{dat[:nick]}!#{dat[:user]}@#{dat[:host]}") - regex = %r((?:(?:https?):\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?)i + regex = %r((?:(?:https?):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?)i pattern = "%N%B[ :NICK%N#:URLNUM %B|%N :OUT %B]%N" dat[:message].scan(regex)[0,5].each_with_index do |v, k| unless %r(http[s]?://).match(v) v = 'http://' + v end \ No newline at end of file