zetabot 2.0.7 → 2.1.0

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
  SHA256:
3
- metadata.gz: 164c42943de0925e50ab65b93855cd0676a9e095f3fa8433b4ae51c500a11288
4
- data.tar.gz: 520c37a37cb8f3be79d5833f80a09a6e8e49d73fb903d641986c83aef410e8ef
3
+ metadata.gz: e3cf112f4395bf4c81f0738640cd8b31bed1ad8749e52cb8fe1a985386bc1b59
4
+ data.tar.gz: a184fedf9faab0a30c2be0af85845825f11f7b6ff1150534c7c0e0ed9a562fe0
5
5
  SHA512:
6
- metadata.gz: c1b4888a42c4f177b829669bb6efd7df2371e9e9af06d7210b41bd6bf1212389f89abaef11ae10e65448d7f6fff993c31c3bb241edc327e0059dd792e718c1a0
7
- data.tar.gz: 6ec520577624e2d306efad46632cc81fd3ea996b4a29476ff576c476fa158fa631205d7c0556f79c0ecc175a6e9a6cc493f1a7296443ec6ab8b6183d22c8dc79
6
+ metadata.gz: 04f5b194486be8bcf98da12942e7c065acaa2bcb3c8a37c0cc6ed984699a3423f9cfc46a50b81509f8b91b3006e42bdf1f1d44a696e0be56fb44d5b6203ba5b9
7
+ data.tar.gz: fa58eb2c5284d4926290a37fe8eecdf23237752d03e7c047804f52722b3c7ed1f825e82fdaad938b6669960e93b81e2cee0ed4ae9e5562af929e00ddc6ad4714
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zetabot (2.0.7)
4
+ zetabot (2.0.9)
5
5
  actionview
6
6
  chronic
7
7
  chronic_duration
@@ -41,24 +41,23 @@ PATH
41
41
  GEM
42
42
  remote: https://rubygems.org/
43
43
  specs:
44
- Ascii85 (1.0.3)
45
- actionview (6.0.2)
46
- activesupport (= 6.0.2)
44
+ Ascii85 (1.1.0)
45
+ actionview (7.0.3)
46
+ activesupport (= 7.0.3)
47
47
  builder (~> 3.1)
48
48
  erubi (~> 1.4)
49
49
  rails-dom-testing (~> 2.0)
50
50
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
51
- activesupport (6.0.2)
51
+ activesupport (7.0.3)
52
52
  concurrent-ruby (~> 1.0, >= 1.0.2)
53
- i18n (>= 0.7, < 2)
54
- minitest (~> 5.1)
55
- tzinfo (~> 1.1)
56
- zeitwerk (~> 2.2)
57
- addressable (2.7.0)
53
+ i18n (>= 1.6, < 2)
54
+ minitest (>= 5.1)
55
+ tzinfo (~> 2.0)
56
+ addressable (2.8.0)
58
57
  public_suffix (>= 2.0.2, < 5.0)
59
58
  afm (0.2.2)
60
59
  ansi (1.5.0)
61
- ast (2.4.0)
60
+ ast (2.4.2)
62
61
  binding.repl (3.0.0)
63
62
  builder (3.2.4)
64
63
  cd (1.0.1)
@@ -66,81 +65,103 @@ GEM
66
65
  chronic_duration (0.10.6)
67
66
  numerizer (~> 0.1.1)
68
67
  cinch (2.3.4)
69
- cinch-cooldown (1.2.0)
68
+ cinch-cooldown (1.2.1)
70
69
  cinch (~> 2)
71
70
  time-lord (~> 1.0, >= 1.0.1)
72
71
  cinch-quotes (0.0.4)
73
72
  cinch (~> 2.0)
74
- cinch-toolbox (1.1.6)
73
+ cinch-toolbox (1.1.7)
75
74
  nokogiri (~> 1.6)
76
- clipboard (1.3.3)
77
- code (0.9.2)
75
+ clipboard (1.3.6)
76
+ code (0.9.3)
78
77
  coderay (~> 1.1)
79
- method_source (~> 0.9)
80
- coderay (1.1.2)
81
- concurrent-ruby (1.1.5)
82
- connection_pool (2.2.2)
83
- crack (0.4.3)
84
- safe_yaml (~> 1.0.0)
85
- crass (1.0.5)
86
- daemons (1.3.1)
87
- debugging (1.1.1)
78
+ method_source (>= 0.9, < 2.0)
79
+ coderay (1.1.3)
80
+ concurrent-ruby (1.1.10)
81
+ connection_pool (2.2.5)
82
+ crack (0.4.5)
83
+ rexml
84
+ crass (1.0.6)
85
+ daemons (1.4.1)
86
+ debugging (1.1.2)
88
87
  binding.repl (~> 3.0)
89
88
  paint (>= 0.9, < 3.0)
90
89
  descendants_tracker (0.0.4)
91
90
  thread_safe (~> 0.3, >= 0.3.1)
92
91
  destructor (0.1.0)
93
- diff-lcs (1.3)
94
- discourse_api (0.38.0)
95
- faraday (~> 0.9)
96
- faraday_middleware (~> 0.10)
92
+ diff-lcs (1.5.0)
93
+ discourse_api (1.0.0)
94
+ faraday (~> 1.0)
95
+ faraday_middleware (~> 1.0)
97
96
  rack (>= 1.6)
98
- dnsbl-client (1.0.4)
97
+ dnsbl-client (1.0.6)
99
98
  domain_name (0.5.20190701)
100
99
  unf (>= 0.0.5, < 1.0.0)
101
100
  dronebl.rb (0.1.0.0)
102
101
  httparty (~> 0.13)
103
102
  nokogiri (~> 1.6)
104
- erubi (1.9.0)
105
- every_day_irb (2.1.0)
103
+ erubi (1.10.0)
104
+ every_day_irb (2.1.1)
106
105
  cd (~> 1.0)
107
- fancy_irb (1.2.1)
106
+ fancy_irb (1.4.3)
108
107
  paint (>= 0.9, < 3.0)
109
- unicode-display_width (~> 1.1)
110
- faraday (0.17.1)
111
- multipart-post (>= 1.2, < 3)
112
- faraday_middleware (0.13.1)
113
- faraday (>= 0.7.4, < 1.0)
114
- ffi (1.11.3)
115
- geocoder (1.5.2)
116
- gist (5.0.0)
117
- github_api (0.18.2)
108
+ unicode-display_width (>= 1.1)
109
+ faraday (1.10.0)
110
+ faraday-em_http (~> 1.0)
111
+ faraday-em_synchrony (~> 1.0)
112
+ faraday-excon (~> 1.1)
113
+ faraday-httpclient (~> 1.0)
114
+ faraday-multipart (~> 1.0)
115
+ faraday-net_http (~> 1.0)
116
+ faraday-net_http_persistent (~> 1.0)
117
+ faraday-patron (~> 1.0)
118
+ faraday-rack (~> 1.0)
119
+ faraday-retry (~> 1.0)
120
+ ruby2_keywords (>= 0.0.4)
121
+ faraday-em_http (1.0.0)
122
+ faraday-em_synchrony (1.0.0)
123
+ faraday-excon (1.1.0)
124
+ faraday-httpclient (1.0.1)
125
+ faraday-multipart (1.0.4)
126
+ multipart-post (~> 2)
127
+ faraday-net_http (1.0.1)
128
+ faraday-net_http_persistent (1.2.0)
129
+ faraday-patron (1.0.0)
130
+ faraday-rack (1.0.0)
131
+ faraday-retry (1.0.3)
132
+ faraday_middleware (1.2.0)
133
+ faraday (~> 1.0)
134
+ ffi (1.15.5)
135
+ geocoder (1.8.0)
136
+ gist (6.0.0)
137
+ github_api (0.19.0)
118
138
  addressable (~> 2.4)
119
139
  descendants_tracker (~> 0.0.4)
120
- faraday (~> 0.8)
140
+ faraday (>= 0.8, < 2)
121
141
  hashie (~> 3.5, >= 3.5.2)
122
142
  oauth2 (~> 1.0)
123
- haml (5.1.2)
143
+ haml (5.2.2)
124
144
  temple (>= 0.8.0)
125
145
  tilt
126
146
  hashery (2.1.2)
127
147
  hashie (3.6.0)
128
148
  hirb (0.7.3)
129
149
  http-accept (1.7.0)
130
- http-cookie (1.0.3)
150
+ http-cookie (1.0.5)
131
151
  domain_name (~> 0.5)
132
- httparty (0.17.1)
152
+ httparty (0.20.0)
133
153
  mime-types (~> 3.0)
134
154
  multi_xml (>= 0.5.2)
135
155
  humanize-bytes (2.2.0)
136
- i18n (1.7.0)
156
+ i18n (1.10.0)
137
157
  concurrent-ruby (~> 1.0)
138
158
  interactive_editor (0.0.11)
139
159
  spoon (>= 0.0.1)
160
+ io-console (0.5.11)
140
161
  ipaddress (0.8.3)
141
- irb (1.2.0)
142
- reline (>= 0.0.1)
143
- irbtools (3.0.1)
162
+ irb (1.4.1)
163
+ reline (>= 0.3.0)
164
+ irbtools (3.0.5)
144
165
  binding.repl (~> 3.0)
145
166
  clipboard (~> 1.3)
146
167
  code (>= 0.9.2, < 2.0)
@@ -151,7 +172,7 @@ GEM
151
172
  hirb (~> 0.7, >= 0.7.3)
152
173
  interactive_editor (~> 0.0, >= 0.0.10)
153
174
  irb (>= 0.9.6)
154
- methodfinder (~> 2.2)
175
+ methodfinder (~> 2.2, >= 2.2.2)
155
176
  object_shadow (~> 1.1)
156
177
  ori (~> 0.1.0)
157
178
  os
@@ -159,101 +180,105 @@ GEM
159
180
  ruby_engine (~> 1.0)
160
181
  ruby_info (~> 1.0)
161
182
  ruby_version (~> 1.0)
162
- wirb (~> 2.0)
183
+ wirb (~> 2.0, >= 2.2.1)
163
184
  iso8601 (0.9.1)
164
- jwt (2.2.1)
185
+ jwt (2.4.1)
165
186
  liner (0.2.4)
166
- loofah (2.4.0)
187
+ loofah (2.18.0)
167
188
  crass (~> 1.0.2)
168
189
  nokogiri (>= 1.5.9)
169
- mechanize (2.7.6)
170
- domain_name (~> 0.5, >= 0.5.1)
171
- http-cookie (~> 1.0)
172
- mime-types (>= 1.17.2)
173
- net-http-digest_auth (~> 1.1, >= 1.1.1)
174
- net-http-persistent (>= 2.5.2)
175
- nokogiri (~> 1.6)
176
- ntlm-http (~> 0.1, >= 0.1.1)
177
- webrobots (>= 0.0.9, < 0.2)
190
+ mechanize (2.8.5)
191
+ addressable (~> 2.8)
192
+ domain_name (~> 0.5, >= 0.5.20190701)
193
+ http-cookie (~> 1.0, >= 1.0.3)
194
+ mime-types (~> 3.0)
195
+ net-http-digest_auth (~> 1.4, >= 1.4.1)
196
+ net-http-persistent (>= 2.5.2, < 5.0.dev)
197
+ nokogiri (~> 1.11, >= 1.11.2)
198
+ rubyntlm (~> 0.6, >= 0.6.3)
199
+ webrick (~> 1.7)
200
+ webrobots (~> 0.1.2)
178
201
  memoizable (0.4.2)
179
202
  thread_safe (~> 0.3, >= 0.3.1)
180
- method_source (0.9.2)
181
- methodfinder (2.2.1)
182
- mime-types (3.3)
203
+ method_source (1.0.0)
204
+ methodfinder (2.2.4)
205
+ mime-types (3.4.1)
183
206
  mime-types-data (~> 3.2015)
184
- mime-types-data (3.2019.1009)
185
- mini_portile2 (2.4.0)
186
- minitest (5.13.0)
207
+ mime-types-data (3.2022.0105)
208
+ minitest (5.15.0)
187
209
  mkfifo (0.1.1)
188
- multi_json (1.14.1)
210
+ multi_json (1.15.0)
189
211
  multi_xml (0.6.0)
190
- multipart-post (2.1.1)
212
+ multipart-post (2.2.3)
191
213
  net-http-digest_auth (1.4.1)
192
- net-http-persistent (3.1.0)
214
+ net-http-persistent (4.0.1)
193
215
  connection_pool (~> 2.2)
194
216
  net_http_timeout_errors (0.3.5)
195
217
  netrc (0.11.0)
196
- nokogiri (1.10.7)
197
- mini_portile2 (~> 2.4.0)
198
- ntlm-http (0.1.1)
218
+ nokogiri (1.13.6-x86_64-darwin)
219
+ racc (~> 1.4)
199
220
  numerizer (0.1.1)
200
- oauth2 (1.4.2)
201
- faraday (>= 0.8, < 2.0)
221
+ oauth2 (1.4.9)
222
+ faraday (>= 0.17.3, < 3.0)
202
223
  jwt (>= 1.0, < 3.0)
203
224
  multi_json (~> 1.3)
204
225
  multi_xml (~> 0.5)
205
226
  rack (>= 1.2, < 3)
206
- object_shadow (1.1.0)
207
- oga (2.15)
227
+ object_shadow (1.1.1)
228
+ oga (3.3)
208
229
  ast
209
230
  ruby-ll (~> 2.1)
210
231
  ori (0.1.0)
211
- os (1.0.1)
212
- paint (2.1.1)
232
+ os (1.1.4)
233
+ paint (2.2.1)
213
234
  parslet (1.8.2)
214
- pdf-reader (2.4.0)
215
- Ascii85 (~> 1.0.0)
235
+ pdf-reader (2.10.0)
236
+ Ascii85 (~> 1.0)
216
237
  afm (~> 0.2.1)
217
238
  hashery (~> 2.0)
218
239
  ruby-rc4
219
240
  ttfunk
220
241
  persist (1.0.0)
221
- public_suffix (4.0.1)
222
- rack (2.0.7)
242
+ public_suffix (4.0.7)
243
+ racc (1.6.0)
244
+ rack (2.2.3.1)
223
245
  rails-dom-testing (2.0.3)
224
246
  activesupport (>= 4.2.0)
225
247
  nokogiri (>= 1.6)
226
- rails-html-sanitizer (1.3.0)
248
+ rails-html-sanitizer (1.4.3)
227
249
  loofah (~> 2.3)
228
250
  rake (10.5.0)
229
- recursive-open-struct (1.1.0)
230
- reline (0.0.7)
251
+ recursive-open-struct (1.1.3)
252
+ reline (0.3.1)
253
+ io-console (~> 0.5)
231
254
  rest-client (2.1.0)
232
255
  http-accept (>= 1.7.0, < 2.0)
233
256
  http-cookie (>= 1.0.2, < 2.0)
234
257
  mime-types (>= 1.16, < 4.0)
235
258
  netrc (~> 0.8)
236
- rspec (3.9.0)
237
- rspec-core (~> 3.9.0)
238
- rspec-expectations (~> 3.9.0)
239
- rspec-mocks (~> 3.9.0)
240
- rspec-core (3.9.0)
241
- rspec-support (~> 3.9.0)
242
- rspec-expectations (3.9.0)
259
+ rexml (3.2.5)
260
+ rspec (3.11.0)
261
+ rspec-core (~> 3.11.0)
262
+ rspec-expectations (~> 3.11.0)
263
+ rspec-mocks (~> 3.11.0)
264
+ rspec-core (3.11.0)
265
+ rspec-support (~> 3.11.0)
266
+ rspec-expectations (3.11.0)
243
267
  diff-lcs (>= 1.2.0, < 2.0)
244
- rspec-support (~> 3.9.0)
245
- rspec-mocks (3.9.0)
268
+ rspec-support (~> 3.11.0)
269
+ rspec-mocks (3.11.1)
246
270
  diff-lcs (>= 1.2.0, < 2.0)
247
- rspec-support (~> 3.9.0)
248
- rspec-support (3.9.0)
271
+ rspec-support (~> 3.11.0)
272
+ rspec-support (3.11.0)
249
273
  ruby-ll (2.1.2)
250
274
  ansi
251
275
  ast
252
276
  ruby-rc4 (0.1.5)
277
+ ruby2_keywords (0.0.5)
253
278
  ruby_engine (1.0.1)
254
279
  ruby_info (1.0.1)
255
- ruby_version (1.0.1)
256
- safe_yaml (1.0.5)
280
+ ruby_version (1.0.2)
281
+ rubyntlm (0.6.3)
257
282
  signed_multiset (0.2.1)
258
283
  spoon (0.0.6)
259
284
  ffi
@@ -262,40 +287,40 @@ GEM
262
287
  thread_safe (0.3.6)
263
288
  tilt (2.0.10)
264
289
  time-lord (1.0.1)
265
- ttfunk (1.5.1)
266
- tzinfo (1.2.5)
267
- thread_safe (~> 0.1)
290
+ ttfunk (1.7.0)
291
+ tzinfo (2.0.4)
292
+ concurrent-ruby (~> 1.0)
268
293
  unf (0.1.4)
269
294
  unf_ext
270
- unf_ext (0.0.7.6)
271
- unicode-display_width (1.6.0)
295
+ unf_ext (0.0.8.2)
296
+ unicode-display_width (2.1.0)
272
297
  unitwise (2.2.0)
273
298
  liner (~> 0.2)
274
299
  memoizable (~> 0.4)
275
300
  parslet (~> 1.5)
276
301
  signed_multiset (~> 0.2)
277
- video_info (2.7)
302
+ video_info (3.0.2)
278
303
  iso8601 (~> 0.9.1)
279
304
  net_http_timeout_errors (~> 0.3.0)
280
- oga (~> 2.7)
305
+ oga (~> 3.0)
306
+ webrick (1.7.0)
281
307
  webrobots (0.1.2)
282
- wirb (2.2.0)
308
+ wirb (2.2.2)
283
309
  paint (>= 0.9, < 3.0)
284
310
  wolfram (0.2.1)
285
311
  nokogiri (>= 1.4.3)
286
312
  wolfram-alpha (0.3.1)
287
313
  nokogiri
288
- zeitwerk (2.2.2)
289
314
 
290
315
  PLATFORMS
291
316
  ruby
292
317
 
293
318
  DEPENDENCIES
294
- bundler (~> 1.11)
319
+ bundler (~> 2.3)
295
320
  irbtools
296
321
  rake (~> 10.0)
297
322
  rspec (~> 3.0)
298
323
  zetabot!
299
324
 
300
325
  BUNDLED WITH
301
- 1.17.2
326
+ 2.3.15
data/Zeta.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_development_dependency "bundler", "~> 1.11"
30
+ spec.add_development_dependency "bundler", "~> 2.3"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
33
  spec.add_development_dependency "irbtools"
@@ -0,0 +1,42 @@
1
+ module Admin
2
+ class AutoVoice
3
+ include Cinch::Plugin
4
+ include Cinch::Helpers
5
+ enable_acl()
6
+
7
+ # Listeners
8
+ listen_to :join, method: :autovoice
9
+
10
+ match /autovoice (.+)/, method: :autovoice_mode
11
+
12
+ def initialize(*args)
13
+ @auto_voice_state = Array.new
14
+ super
15
+ end
16
+
17
+ def autovoice_mode(msg, mode='status')
18
+ return unless msg.user.oper?
19
+
20
+ if mode == 'on' || mode == 'true'
21
+ @auto_voice_state << msg.channel.to_s
22
+ return msg.reply "AutoVoice is now enabled!"
23
+ elsif mode == 'off' || mode == 'false'
24
+ @auto_voice_state.delete_if { _1 == msg.channel.to_s }
25
+ return msg.reply "AutoVoice is now disabled!"
26
+ end
27
+
28
+ msg.reply "AutoVoice is currently: #{@auto_voice_state.include?(msg.channel.to_s) ? 'On' : 'Off'}"
29
+ end
30
+
31
+ # Methods
32
+ def autovoice(msg)
33
+ if @auto_voice_state.include?(msg.channel.to_s) && msg.user.authed?
34
+ Channel(msg.channel).voice(msg.user)
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+
41
+ # AutoLoad
42
+ Bot.config.plugins.plugins.push Admin::AutoVoice
data/lib/Zeta/admin.rb CHANGED
@@ -8,4 +8,5 @@ require 'Zeta/admin/users'
8
8
  require 'Zeta/admin/autojoin'
9
9
  require 'Zeta/admin/ignore'
10
10
  require 'Zeta/admin/bot'
11
- require 'Zeta/admin/blacklister'
11
+ require 'Zeta/admin/blacklister'
12
+ require 'Zeta/admin/autovoice'
@@ -22,8 +22,10 @@ module Plugins
22
22
  private
23
23
  def fetch_random_fml
24
24
  url = 'http://www.fmylife.com/random'
25
- # fml_story = Nokogiri.HTML(RestClient.get(url)).at('div.article').text.strip
26
- fml_story = Nokogiri.HTML(open(url).read).at('div.article').text.strip
25
+
26
+ html_body = RestClient.get(url).body
27
+
28
+ fml_story = Nokogiri.HTML(html_body).at('article').text.strip
27
29
  fml_story[/^Today, (.+) FML/]
28
30
  rescue => e
29
31
  e.message
@@ -33,8 +33,10 @@ module Plugins
33
33
  private
34
34
 
35
35
  def search(query)
36
- url = URI.encode "http://www.gifbin.com/search/#{query}/"
37
- doc = Nokogiri::HTML( open(url) )
36
+ parser = URI::Parser.new
37
+ url = parser.escape "http://www.gifbin.com/search/#{query}/"
38
+
39
+ doc = Nokogiri::HTML( RestClient.get(url).body )
38
40
  e = doc.css('.thumbs li').length
39
41
  return "No Results Found" if e == 0
40
42
  result = doc.css('.thumbs li')[rand(e)].css('a img').attribute('src').text.gsub(/tn_/, '')
@@ -42,16 +44,20 @@ module Plugins
42
44
  end
43
45
 
44
46
  def gifbin
45
- url = URI.encode 'http://www.gifbin.com/random'
46
- doc = Nokogiri.HTML(open url)
47
+ parser = URI::Parser.new
48
+
49
+ url = parser.escape 'http://www.gifbin.com/random'
50
+ doc = Nokogiri.HTML(RestClient.get(url).body)
47
51
  doc.css('div#gifcontainer a img').attribute('src').text
48
52
  end
49
53
 
50
54
  def imgur
51
55
  # Cache results for 1 hour
52
56
  if @imgurray.empty? || @last_update >= (Time.now + 3600)
53
- url = URI.encode('http://reddit.com/r/gifs.json')
54
- doc = JSON.load(open(url))
57
+ parser = URI::Parser.new
58
+
59
+ url = parser.escape('http://reddit.com/r/gifs.json')
60
+ doc = JSON.load(RestClient.get(url).body)
55
61
 
56
62
  doc['data']['children'].each_with_index do |post, index|
57
63
  if doc['data']['children'][index]['data']['url'].to_s =~ /imgur/
@@ -25,11 +25,14 @@ module Plugins
25
25
 
26
26
  private
27
27
  def query_movie(m)
28
+ parser = URI::Parser.new
29
+
28
30
  year = m[/:\d+/].gsub(/:/, '') if m[/:\d+/]
29
- movie = URI.encode(m.gsub(/:\d+/, ''))
31
+ movie = parser.escape(m.gsub(/:\d+/, ''))
32
+
30
33
  data = JSON.parse(
31
34
  # RestClient.get("http://www.omdbapi.com/?t=#{movie}&y=#{year}")
32
- open("http://www.omdbapi.com/?t=#{movie}&y=#{year}&apikey=#{Config.secrets[:omdb]}").read
35
+ RestClient.get("http://www.omdbapi.com/?t=#{movie}&y=#{year}&apikey=#{Config.secrets[:omdb]}").body
33
36
  )
34
37
  OpenStruct.new(
35
38
  title: data['Title'],
@@ -51,8 +51,9 @@ module Plugins
51
51
  react_on: :channel
52
52
 
53
53
  def execute(msg, url)
54
+ parser = URI::Parser.new
54
55
  url = "http://#{url}" unless url=~/^https?:\/\//
55
- url = URI.encode(url)
56
+ url = parser.escape(url)
56
57
 
57
58
  # Ignore items on blacklist
58
59
  # blacklist = DEFAULT_BLACKLIST.dup
@@ -9,7 +9,7 @@ module Plugins
9
9
 
10
10
  set(
11
11
  plugin_name: 'UrbanDictionary',
12
- help: "Urban Dictionary -- Grabs a term from urbandictionary.com.\nUsage: `?urban <term>`; `?wotd`; `!?woty`"
12
+ help: "Urban Dictionary -- Grabs a term from urbandictionary.com.\nUsage: `?ud <term>`; `?wotd`;"
13
13
  )
14
14
 
15
15
  match /urban (.*)/, method: :query
@@ -23,10 +23,11 @@ module Plugins
23
23
 
24
24
 
25
25
  def wotd(m)
26
- url = URI.encode "http://www.urbandictionary.com/"
26
+ parser = URI::Parser.new
27
+ url = parser.escape("http://www.urbandictionary.com/")
28
+
27
29
  doc = Nokogiri.HTML(
28
- # RestClient.get(url)
29
- open(url)
30
+ RestClient.get(url).body
30
31
  )
31
32
  word = doc.at_css('.word').text.strip[0..40]
32
33
  meaning = doc.at_css('.meaning').text.strip[0..450] + "... \u263A"
@@ -35,13 +36,12 @@ module Plugins
35
36
 
36
37
  private
37
38
  def search(query)
38
- url = URI.encode "http://api.urbandictionary.com/v0/define?term=#{query}"
39
- # Nokogiri.HTML(open url).at_css('.meaning').text.strip[0..500]
39
+ parser = URI::Parser.new
40
+ url = parser.escape "http://api.urbandictionary.com/v0/define?term=#{query}"
40
41
 
41
42
  # Load API data
42
43
  data = JSON.parse(
43
- #RestClient.get(url)
44
- open(url).read
44
+ RestClient.get(url).body
45
45
  )
46
46
 
47
47
  # Return if nothing is found
@@ -87,9 +87,9 @@ module Plugins
87
87
  location = CGI.escape(location)
88
88
 
89
89
  ac = JSON.parse(
90
- open(
90
+ RestClient.get(
91
91
  "https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}"
92
- ).read, object_class: OpenStruct
92
+ ).body, object_class: OpenStruct
93
93
  )
94
94
 
95
95
  return nil if ac.results.nil? ## Unable to locate
@@ -100,8 +100,8 @@ module Plugins
100
100
 
101
101
  # Get Data
102
102
  data = JSON.parse(
103
- open("https://api.openweathermap.org/data/2.5/weather?lat=#{lat}&lon=#{lon}&APPID=#{Config.secrets[:owm]}"
104
- ).read, object_class: OpenStruct
103
+ RestClient.get("https://api.openweathermap.org/data/2.5/weather?lat=#{lat}&lon=#{lon}&APPID=#{Config.secrets[:owm]}"
104
+ ).body, object_class: OpenStruct
105
105
  )
106
106
 
107
107
  temp = Unitwise(data.main.temp, 'K') # Data is given in kelvin
@@ -124,7 +124,7 @@ module Plugins
124
124
  location = CGI.escape(location)
125
125
 
126
126
  ac = JSON.parse(
127
- open("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}").read,
127
+ RestClient.get("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}").body,
128
128
  object_class: OpenStruct
129
129
  )
130
130
  return nil if ac.results.nil? ## Unable to locate
@@ -134,7 +134,7 @@ module Plugins
134
134
  lon = ac.geometry.location.lng
135
135
 
136
136
  data = JSON.parse(
137
- open("https://api.darksky.net/forecast/#{Config.secrets[:darksky]}/#{lat},#{lon}").read,
137
+ RestClient.get("https://api.darksky.net/forecast/#{Config.secrets[:darksky]}/#{lat},#{lon}").body,
138
138
  object_class: OpenStruct
139
139
  )
140
140
  data.ac = ac
@@ -165,7 +165,7 @@ module Plugins
165
165
  location = CGI.escape(location)
166
166
 
167
167
  ac = JSON.parse(
168
- open("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}").read,
168
+ RestClient.get("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}").body,
169
169
  object_class: OpenStruct
170
170
  )
171
171
  return nil if ac.results.nil? ## Unable to locate
@@ -175,13 +175,13 @@ module Plugins
175
175
  lon = ac.geometry.location.lng
176
176
 
177
177
  stations = JSON.parse(
178
- open("https://api.weather.gov/points/#{lat},#{lon}/stations/").read
178
+ RestClient.get("https://api.weather.gov/points/#{lat},#{lon}/stations/").body
179
179
  ) rescue nil
180
180
 
181
181
  return nil if stations.nil? ## Unable to find station. probably not in the USA
182
182
 
183
183
  parsed = JSON.parse(
184
- open("#{CGI.escape(stations['observationStations'][0])}/observations/current").read,
184
+ RestClient.get("#{CGI.escape(stations['observationStations'][0])}/observations/current").body,
185
185
  object_class: OpenStruct
186
186
  )
187
187
 
@@ -20,7 +20,7 @@ module Plugins
20
20
  # Rescue in case something goes wrong
21
21
  begin
22
22
  url = "http://api.wolframalpha.com/v2/query?input=#{CGI.escape(query)}&appid=#{Config.secrets[:wolfram]}&primary=true&format=plaintext"
23
- request = open(url).read
23
+ request = RestClient.get(url).body
24
24
 
25
25
  data = Crack::XML.parse(request)
26
26
 
data/lib/Zeta/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zeta
2
- VERSION = '2.0.7'
2
+ VERSION = '2.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zetabot
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liothen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-15 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '2.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -556,7 +556,7 @@ dependencies:
556
556
  - - ">="
557
557
  - !ruby/object:Gem::Version
558
558
  version: '0'
559
- description:
559
+ description:
560
560
  email:
561
561
  - liothen@flagrun.net
562
562
  executables:
@@ -566,6 +566,7 @@ extra_rdoc_files: []
566
566
  files:
567
567
  - ".bundle/config"
568
568
  - ".gitignore"
569
+ - ".tool-versions"
569
570
  - Gemfile
570
571
  - Gemfile.lock
571
572
  - LICENSE.txt
@@ -579,6 +580,7 @@ files:
579
580
  - lib/Zeta/access.rb
580
581
  - lib/Zeta/admin.rb
581
582
  - lib/Zeta/admin/autojoin.rb
583
+ - lib/Zeta/admin/autovoice.rb
582
584
  - lib/Zeta/admin/blacklister.rb
583
585
  - lib/Zeta/admin/bot.rb
584
586
  - lib/Zeta/admin/channels.rb
@@ -641,7 +643,7 @@ licenses:
641
643
  - MIT
642
644
  metadata:
643
645
  allowed_push_host: https://rubygems.org
644
- post_install_message:
646
+ post_install_message:
645
647
  rdoc_options: []
646
648
  require_paths:
647
649
  - lib
@@ -656,8 +658,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
656
658
  - !ruby/object:Gem::Version
657
659
  version: '0'
658
660
  requirements: []
659
- rubygems_version: 3.0.3
660
- signing_key:
661
+ rubygems_version: 3.1.6
662
+ signing_key:
661
663
  specification_version: 4
662
664
  summary: Zeta is a IRC bot written in ruby using the Cinch Framework
663
665
  test_files: []