protonbot-titler 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb05fdf48caf043adfce45acc3136e2ab57b2e16
4
- data.tar.gz: 9892f5057b9419250d252b322f23b2e310234312
3
+ metadata.gz: 6d5f01ecddb1574b7ca771dafe7f103c3fb279bf
4
+ data.tar.gz: 95c7a1a76ec1193642bbd230336747be8507a0c1
5
5
  SHA512:
6
- metadata.gz: 23245ee287c335b41a1f9d3b4f352e50e2b164b427a40af4ca1a6d87e85aabfd01dbbfe1a8f4fbf2b412fa487570a68d00ddca826a4b6d6d5007856879d8d584
7
- data.tar.gz: 9266fc87f226973cbdc47a431bd84e93564f55751bb78232b8cbcecac5fe9ff694f43e6151e91923ee0c0a9b0fe6a3d1a250f18f08d8f641e6cf2e401e300e84
6
+ metadata.gz: 210847c4ed4e88562e6d534c3b76d1ceafcfb37908e266252d2d474343ad35817003be2277fab805bd6b1a084e60d823760263f6b50b12d00f203e0641a3ba32
7
+ data.tar.gz: 67f66404c0f795d8a197341047314e5e9f256c13ee671592d280ac8ac191b5229063b8d2806bdae14a285e35a088e92220e270f6d14110618f3830abb6ba1ab3
@@ -11,7 +11,7 @@ ProtonBot::Plugin.new do
11
11
  unless /(bot|serv)/i.match("#{dat[:nick]}!#{dat[:user]}@#{dat[:host]}")
12
12
  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
13
13
  pattern = "%N%B[ :NICK%N#:URLNUM %B|%N :OUT %B]%N"
14
- dat[:message].scan(regex).each_with_index do |v, k|
14
+ dat[:message].scan(regex)[0,5].each_with_index do |v, k|
15
15
  unless %r(http[s]?://).match(v)
16
16
  v = 'http://' + v
17
17
  end
@@ -28,19 +28,19 @@ ProtonBot::Plugin.new do
28
28
  if err
29
29
  dat.reply(pattern
30
30
  .gsub(':NICK', dat[:nick])
31
- .gsub(':URLNUM', k.to_s)
31
+ .gsub(':URLNUM', (k+1).to_s)
32
32
  .gsub(':OUT', "%C%RED\u200B#{err.message}%N"))
33
33
  elsif [200, 201, 203, 204, 205, 206, 207, 208, 226, 304].include?(res.code) && res["Content-Type"][/text\/html.*/]
34
34
  body = res.body.to_s
35
35
  html = Nokogiri::HTML(body)
36
36
  dat.reply(pattern
37
37
  .gsub(':NICK', dat[:nick])
38
- .gsub(':URLNUM', k.to_s)
38
+ .gsub(':URLNUM', (k+1).to_s)
39
39
  .gsub(':OUT', "%C%GREEN\u200B" + html.title + '%N'))
40
40
  else
41
41
  dat.reply(pattern
42
42
  .gsub(':NICK', dat[:nick])
43
- .gsub(':URLNUM', k.to_s)
43
+ .gsub(':URLNUM', (k+1).to_s)
44
44
  .gsub(':OUT', "%C%ORANGE\u200B#{res.code}%N"))
45
45
  end
46
46
  end
@@ -1,5 +1,5 @@
1
1
  module ProtonBot
2
2
  module Titler
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protonbot-titler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nickolay Ilyushin