zetabot 2.0.3 → 2.0.4
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 +4 -4
- data/Gemfile.lock +53 -47
- data/lib/Zeta/plugins/weather.rb +39 -38
- data/lib/Zeta/plugins/wolfram.rb +3 -4
- data/lib/Zeta/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 36b57e6ff16c98c38ea3c9030b4117ae756f014c801c5ae3bda4337f0fde5357
|
|
4
|
+
data.tar.gz: 2e9de7aae7a9dbf84910a4802b2994443efb8927fff89f5ab203da59e801f996
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee301d2f5ad8919a5f1433cc1ccd246fc77d13032f8fa75e1435fe832536dcd0cae1f511baccbaab8748905f32679a6031dbda5ee9b7c559ee057d07e31eb4fc
|
|
7
|
+
data.tar.gz: a037bd7354fa2984dec90982077e17875b3cd35c4415e794a13d20483d4c5bbe8df993bba23f91d0b881351562852036fdae1b6805bd2a5de99f235b05cc49ca
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
zetabot (2.0.
|
|
4
|
+
zetabot (2.0.3)
|
|
5
5
|
actionview
|
|
6
6
|
chronic
|
|
7
7
|
chronic_duration
|
|
@@ -42,19 +42,20 @@ GEM
|
|
|
42
42
|
remote: https://rubygems.org/
|
|
43
43
|
specs:
|
|
44
44
|
Ascii85 (1.0.3)
|
|
45
|
-
actionview (
|
|
46
|
-
activesupport (=
|
|
45
|
+
actionview (6.0.1)
|
|
46
|
+
activesupport (= 6.0.1)
|
|
47
47
|
builder (~> 3.1)
|
|
48
48
|
erubi (~> 1.4)
|
|
49
49
|
rails-dom-testing (~> 2.0)
|
|
50
|
-
rails-html-sanitizer (~> 1.
|
|
51
|
-
activesupport (
|
|
50
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
51
|
+
activesupport (6.0.1)
|
|
52
52
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
53
53
|
i18n (>= 0.7, < 2)
|
|
54
54
|
minitest (~> 5.1)
|
|
55
55
|
tzinfo (~> 1.1)
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
zeitwerk (~> 2.2)
|
|
57
|
+
addressable (2.7.0)
|
|
58
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
58
59
|
afm (0.2.2)
|
|
59
60
|
ansi (1.5.0)
|
|
60
61
|
ast (2.4.0)
|
|
@@ -81,7 +82,7 @@ GEM
|
|
|
81
82
|
connection_pool (2.2.2)
|
|
82
83
|
crack (0.4.3)
|
|
83
84
|
safe_yaml (~> 1.0.0)
|
|
84
|
-
crass (1.0.
|
|
85
|
+
crass (1.0.5)
|
|
85
86
|
daemons (1.3.1)
|
|
86
87
|
debugging (1.1.1)
|
|
87
88
|
binding.repl (~> 3.0)
|
|
@@ -90,7 +91,7 @@ GEM
|
|
|
90
91
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
91
92
|
destructor (0.1.0)
|
|
92
93
|
diff-lcs (1.3)
|
|
93
|
-
discourse_api (0.
|
|
94
|
+
discourse_api (0.38.0)
|
|
94
95
|
faraday (~> 0.9)
|
|
95
96
|
faraday_middleware (~> 0.10)
|
|
96
97
|
rack (>= 1.6)
|
|
@@ -100,18 +101,18 @@ GEM
|
|
|
100
101
|
dronebl.rb (0.1.0.0)
|
|
101
102
|
httparty (~> 0.13)
|
|
102
103
|
nokogiri (~> 1.6)
|
|
103
|
-
erubi (1.
|
|
104
|
+
erubi (1.9.0)
|
|
104
105
|
every_day_irb (2.1.0)
|
|
105
106
|
cd (~> 1.0)
|
|
106
|
-
fancy_irb (1.1
|
|
107
|
+
fancy_irb (1.2.1)
|
|
107
108
|
paint (>= 0.9, < 3.0)
|
|
108
109
|
unicode-display_width (~> 1.1)
|
|
109
|
-
faraday (0.
|
|
110
|
+
faraday (0.17.1)
|
|
110
111
|
multipart-post (>= 1.2, < 3)
|
|
111
112
|
faraday_middleware (0.13.1)
|
|
112
113
|
faraday (>= 0.7.4, < 1.0)
|
|
113
|
-
ffi (1.11.
|
|
114
|
-
geocoder (1.5.
|
|
114
|
+
ffi (1.11.3)
|
|
115
|
+
geocoder (1.5.2)
|
|
115
116
|
gist (5.0.0)
|
|
116
117
|
github_api (0.18.2)
|
|
117
118
|
addressable (~> 2.4)
|
|
@@ -125,26 +126,28 @@ GEM
|
|
|
125
126
|
hashery (2.1.2)
|
|
126
127
|
hashie (3.6.0)
|
|
127
128
|
hirb (0.7.3)
|
|
129
|
+
http-accept (1.7.0)
|
|
128
130
|
http-cookie (1.0.3)
|
|
129
131
|
domain_name (~> 0.5)
|
|
130
|
-
httparty (0.17.
|
|
132
|
+
httparty (0.17.1)
|
|
131
133
|
mime-types (~> 3.0)
|
|
132
134
|
multi_xml (>= 0.5.2)
|
|
133
135
|
humanize-bytes (2.2.0)
|
|
134
|
-
i18n (1.
|
|
136
|
+
i18n (1.7.0)
|
|
135
137
|
concurrent-ruby (~> 1.0)
|
|
136
138
|
interactive_editor (0.0.11)
|
|
137
139
|
spoon (>= 0.0.1)
|
|
138
140
|
ipaddress (0.8.3)
|
|
139
|
-
irb (1.
|
|
140
|
-
|
|
141
|
+
irb (1.1.0)
|
|
142
|
+
reline (>= 0.0.1)
|
|
143
|
+
irbtools (3.0.1)
|
|
141
144
|
binding.repl (~> 3.0)
|
|
142
145
|
clipboard (~> 1.3)
|
|
143
146
|
code (>= 0.9.2, < 2.0)
|
|
144
147
|
coderay (~> 1.1)
|
|
145
148
|
debugging (~> 1.1)
|
|
146
149
|
every_day_irb (~> 2.0)
|
|
147
|
-
fancy_irb (~> 1.1)
|
|
150
|
+
fancy_irb (~> 1.2, >= 1.2.1)
|
|
148
151
|
hirb (~> 0.7, >= 0.7.3)
|
|
149
152
|
interactive_editor (~> 0.0, >= 0.0.10)
|
|
150
153
|
irb (>= 0.9.6)
|
|
@@ -160,7 +163,7 @@ GEM
|
|
|
160
163
|
iso8601 (0.9.1)
|
|
161
164
|
jwt (2.2.1)
|
|
162
165
|
liner (0.2.4)
|
|
163
|
-
loofah (2.
|
|
166
|
+
loofah (2.4.0)
|
|
164
167
|
crass (~> 1.0.2)
|
|
165
168
|
nokogiri (>= 1.5.9)
|
|
166
169
|
mechanize (2.7.6)
|
|
@@ -176,13 +179,13 @@ GEM
|
|
|
176
179
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
177
180
|
method_source (0.9.2)
|
|
178
181
|
methodfinder (2.2.1)
|
|
179
|
-
mime-types (3.
|
|
182
|
+
mime-types (3.3)
|
|
180
183
|
mime-types-data (~> 3.2015)
|
|
181
|
-
mime-types-data (3.2019.
|
|
184
|
+
mime-types-data (3.2019.1009)
|
|
182
185
|
mini_portile2 (2.4.0)
|
|
183
|
-
minitest (5.
|
|
186
|
+
minitest (5.13.0)
|
|
184
187
|
mkfifo (0.1.1)
|
|
185
|
-
multi_json (1.
|
|
188
|
+
multi_json (1.14.1)
|
|
186
189
|
multi_xml (0.6.0)
|
|
187
190
|
multipart-post (2.1.1)
|
|
188
191
|
net-http-digest_auth (1.4.1)
|
|
@@ -190,12 +193,12 @@ GEM
|
|
|
190
193
|
connection_pool (~> 2.2)
|
|
191
194
|
net_http_timeout_errors (0.3.5)
|
|
192
195
|
netrc (0.11.0)
|
|
193
|
-
nokogiri (1.10.
|
|
196
|
+
nokogiri (1.10.7)
|
|
194
197
|
mini_portile2 (~> 2.4.0)
|
|
195
198
|
ntlm-http (0.1.1)
|
|
196
199
|
numerizer (0.1.1)
|
|
197
|
-
oauth2 (1.4.
|
|
198
|
-
faraday (>= 0.8, <
|
|
200
|
+
oauth2 (1.4.2)
|
|
201
|
+
faraday (>= 0.8, < 2.0)
|
|
199
202
|
jwt (>= 1.0, < 3.0)
|
|
200
203
|
multi_json (~> 1.3)
|
|
201
204
|
multi_xml (~> 0.5)
|
|
@@ -206,41 +209,43 @@ GEM
|
|
|
206
209
|
ruby-ll (~> 2.1)
|
|
207
210
|
ori (0.1.0)
|
|
208
211
|
os (1.0.1)
|
|
209
|
-
paint (2.1.
|
|
212
|
+
paint (2.1.1)
|
|
210
213
|
parslet (1.8.2)
|
|
211
|
-
pdf-reader (2.
|
|
214
|
+
pdf-reader (2.4.0)
|
|
212
215
|
Ascii85 (~> 1.0.0)
|
|
213
216
|
afm (~> 0.2.1)
|
|
214
217
|
hashery (~> 2.0)
|
|
215
218
|
ruby-rc4
|
|
216
219
|
ttfunk
|
|
217
220
|
persist (1.0.0)
|
|
218
|
-
public_suffix (
|
|
221
|
+
public_suffix (4.0.1)
|
|
219
222
|
rack (2.0.7)
|
|
220
223
|
rails-dom-testing (2.0.3)
|
|
221
224
|
activesupport (>= 4.2.0)
|
|
222
225
|
nokogiri (>= 1.6)
|
|
223
|
-
rails-html-sanitizer (1.
|
|
224
|
-
loofah (~> 2.
|
|
226
|
+
rails-html-sanitizer (1.3.0)
|
|
227
|
+
loofah (~> 2.3)
|
|
225
228
|
rake (10.5.0)
|
|
226
229
|
recursive-open-struct (1.1.0)
|
|
227
|
-
|
|
230
|
+
reline (0.0.7)
|
|
231
|
+
rest-client (2.1.0)
|
|
232
|
+
http-accept (>= 1.7.0, < 2.0)
|
|
228
233
|
http-cookie (>= 1.0.2, < 2.0)
|
|
229
234
|
mime-types (>= 1.16, < 4.0)
|
|
230
235
|
netrc (~> 0.8)
|
|
231
|
-
rspec (3.
|
|
232
|
-
rspec-core (~> 3.
|
|
233
|
-
rspec-expectations (~> 3.
|
|
234
|
-
rspec-mocks (~> 3.
|
|
235
|
-
rspec-core (3.
|
|
236
|
-
rspec-support (~> 3.
|
|
237
|
-
rspec-expectations (3.
|
|
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)
|
|
238
243
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
239
|
-
rspec-support (~> 3.
|
|
240
|
-
rspec-mocks (3.
|
|
244
|
+
rspec-support (~> 3.9.0)
|
|
245
|
+
rspec-mocks (3.9.0)
|
|
241
246
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
242
|
-
rspec-support (~> 3.
|
|
243
|
-
rspec-support (3.
|
|
247
|
+
rspec-support (~> 3.9.0)
|
|
248
|
+
rspec-support (3.9.0)
|
|
244
249
|
ruby-ll (2.1.2)
|
|
245
250
|
ansi
|
|
246
251
|
ast
|
|
@@ -253,9 +258,9 @@ GEM
|
|
|
253
258
|
spoon (0.0.6)
|
|
254
259
|
ffi
|
|
255
260
|
tag_formatter (0.0.3)
|
|
256
|
-
temple (0.8.
|
|
261
|
+
temple (0.8.2)
|
|
257
262
|
thread_safe (0.3.6)
|
|
258
|
-
tilt (2.0.
|
|
263
|
+
tilt (2.0.10)
|
|
259
264
|
time-lord (1.0.1)
|
|
260
265
|
ttfunk (1.5.1)
|
|
261
266
|
tzinfo (1.2.5)
|
|
@@ -274,12 +279,13 @@ GEM
|
|
|
274
279
|
net_http_timeout_errors (~> 0.3.0)
|
|
275
280
|
oga (~> 2.7)
|
|
276
281
|
webrobots (0.1.2)
|
|
277
|
-
wirb (2.
|
|
282
|
+
wirb (2.2.0)
|
|
278
283
|
paint (>= 0.9, < 3.0)
|
|
279
284
|
wolfram (0.2.1)
|
|
280
285
|
nokogiri (>= 1.4.3)
|
|
281
286
|
wolfram-alpha (0.3.1)
|
|
282
287
|
nokogiri
|
|
288
|
+
zeitwerk (2.2.2)
|
|
283
289
|
|
|
284
290
|
PLATFORMS
|
|
285
291
|
ruby
|
data/lib/Zeta/plugins/weather.rb
CHANGED
|
@@ -15,8 +15,8 @@ module Plugins
|
|
|
15
15
|
enable_acl
|
|
16
16
|
|
|
17
17
|
set(
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
plugin_name: "Weather",
|
|
19
|
+
help: "Get the Weather?.\nUsage: `?weather`\nUsage: `?wx zip` `?w zip` `?setw zip` `?forecast zip`",
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
match /w (.+)/, method: :weather
|
|
@@ -35,7 +35,7 @@ module Plugins
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# ?w <location>
|
|
38
|
-
def weather(msg, query=nil)
|
|
38
|
+
def weather(msg, query = nil)
|
|
39
39
|
# Pull data source and scrub query
|
|
40
40
|
# Lookup user from pstore
|
|
41
41
|
if !@store[msg.user.to_s].nil? && query.nil?
|
|
@@ -53,7 +53,9 @@ module Plugins
|
|
|
53
53
|
true_src = @api_src.include?(src) ? src : 'darksky'
|
|
54
54
|
data = send("#{true_src}_src", query)
|
|
55
55
|
end
|
|
56
|
+
|
|
56
57
|
return msg.reply "No results found for #{query} with #{true_src} source." if data.nil?
|
|
58
|
+
|
|
57
59
|
# return msg.reply 'Problem getting data. Try again later.' if data.nil?
|
|
58
60
|
msg.reply(data.reply)
|
|
59
61
|
end
|
|
@@ -82,23 +84,24 @@ module Plugins
|
|
|
82
84
|
|
|
83
85
|
# Open Weather map - https://openweathermap.org/api
|
|
84
86
|
def owm_src(location)
|
|
87
|
+
location = CGI.escape(location)
|
|
88
|
+
|
|
85
89
|
ac = JSON.parse(
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
open(
|
|
91
|
+
"https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}"
|
|
92
|
+
).read, object_class: OpenStruct
|
|
88
93
|
)
|
|
89
94
|
|
|
90
95
|
return nil if ac.results.nil? ## Unable to locate
|
|
91
96
|
|
|
92
97
|
ac = ac.results[0]
|
|
93
|
-
lat = ac.geometry.location.lat
|
|
94
|
-
lon = ac.geometry.location.lng
|
|
98
|
+
lat = CGI.escape(ac.geometry.location.lat)
|
|
99
|
+
lon = CGI.escape(ac.geometry.location.lng)
|
|
95
100
|
|
|
96
101
|
# Get Data
|
|
97
102
|
data = JSON.parse(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
).read,
|
|
101
|
-
object_class: OpenStruct
|
|
103
|
+
open("https://api.openweathermap.org/data/2.5/weather?lat=#{lat}&lon=#{lon}&APPID=#{Config.secrets[:owm]}"
|
|
104
|
+
).read, object_class: OpenStruct
|
|
102
105
|
)
|
|
103
106
|
|
|
104
107
|
temp = Unitwise(data.main.temp, 'K') # Data is given in kelvin
|
|
@@ -106,34 +109,33 @@ module Plugins
|
|
|
106
109
|
wind = Unitwise(data.wind.speed, 'kilometer')
|
|
107
110
|
|
|
108
111
|
data.reply = "OWM ∴ #{ac.formatted_address} " \
|
|
109
|
-
"≈ #{(Time.now.utc + data.timezone.seconds).strftime("%c")
|
|
112
|
+
"≈ #{(Time.now.utc + data.timezone.seconds).strftime("%c")} " \
|
|
110
113
|
"≈ #{data.weather[0].description}, #{temp.convert_to('[degF]').to_i.round(2)} F (#{temp.convert_to('Cel').to_i.round(2)} C) " \
|
|
111
|
-
"≈ Humidity: #{data.main.humidity}% " \
|
|
114
|
+
"≈ Humidity: #{data.main.humidity.to_i.round(2)}% " \
|
|
112
115
|
"≈ Pressure: #{pressure.convert_to('[in_i\'Hg]').to_f.round(2)} in/Hg " \
|
|
113
116
|
"(#{pressure.convert_to("kPa").to_f.round(2)} kPa) " \
|
|
114
117
|
"≈ Wind: #{wind.convert_to('mile').to_i.round(2)} mph (#{wind.to_i.round(2)} km/h) ∴"
|
|
115
118
|
|
|
116
119
|
return data
|
|
117
|
-
|
|
118
120
|
end
|
|
119
121
|
|
|
120
122
|
# DarkSky - https://darksky.net/dev
|
|
121
123
|
def darksky_src(location)
|
|
124
|
+
location = CGI.escape(location)
|
|
125
|
+
|
|
122
126
|
ac = JSON.parse(
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
open("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}").read,
|
|
128
|
+
object_class: OpenStruct
|
|
125
129
|
)
|
|
126
130
|
return nil if ac.results.nil? ## Unable to locate
|
|
127
131
|
|
|
128
132
|
ac = ac.results[0]
|
|
129
|
-
lat = ac.geometry.location.lat
|
|
130
|
-
lon = ac.geometry.location.lng
|
|
133
|
+
lat = CGI.escape(ac.geometry.location.lat)
|
|
134
|
+
lon = CGI.escape(ac.geometry.location.lng)
|
|
131
135
|
|
|
132
136
|
data = JSON.parse(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
).read,
|
|
136
|
-
object_class: OpenStruct
|
|
137
|
+
open("https://api.darksky.net/forecast/#{Config.secrets[:darksky]}/#{lat},#{lon}").read,
|
|
138
|
+
object_class: OpenStruct
|
|
137
139
|
)
|
|
138
140
|
data.ac = ac
|
|
139
141
|
current = data.currently
|
|
@@ -146,45 +148,46 @@ module Plugins
|
|
|
146
148
|
tempstring = "#{current.temperature.to_i} F (#{c} C)"
|
|
147
149
|
|
|
148
150
|
data.reply = "DS ∴ #{ac.formatted_address} " \
|
|
149
|
-
"≈ #{
|
|
151
|
+
"≈ #{TZInfo::Timezone.get(data.timezone).now.strftime("%c")} " \
|
|
150
152
|
"≈ #{current.summary} #{tempstring} " \
|
|
151
|
-
"≈ Humidity: #{current.humidity * 100}% " \
|
|
153
|
+
"≈ Humidity: #{(current.humidity * 100).round(2)}% " \
|
|
152
154
|
"≈ Pressure: #{p.convert_to('[in_i\'Hg]').to_f.round(2)} in/Hg " \
|
|
153
155
|
"(#{p.convert_to("kPa").to_f.round(2)} kPa) " \
|
|
154
156
|
"≈ Wind: gusts upto #{current.windGust} mph (#{gusts} km/h) ≈ Alerts: #{alerts} ∴"
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
return data
|
|
157
159
|
# rescue
|
|
158
160
|
# return nil
|
|
159
161
|
end
|
|
160
162
|
|
|
161
163
|
# NOAA - https://graphical.weather.gov/xml/
|
|
162
164
|
def noaa_src(location)
|
|
165
|
+
location = CGI.escape(location)
|
|
166
|
+
|
|
163
167
|
ac = JSON.parse(
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
open("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}").read,
|
|
169
|
+
object_class: OpenStruct
|
|
166
170
|
)
|
|
167
171
|
return nil if ac.results.nil? ## Unable to locate
|
|
168
172
|
|
|
169
173
|
ac = ac.results[0]
|
|
170
|
-
lat = ac.geometry.location.lat
|
|
171
|
-
lon = ac.geometry.location.lng
|
|
174
|
+
lat = CGI.escape(ac.geometry.location.lat)
|
|
175
|
+
lon = CGI.escape(ac.geometry.location.lng)
|
|
172
176
|
|
|
173
177
|
stations = JSON.parse(
|
|
174
|
-
|
|
178
|
+
open(URI.encode("https://api.weather.gov/points/#{lat},#{lon}/stations/")).read
|
|
175
179
|
) rescue nil
|
|
176
180
|
|
|
177
181
|
return nil if stations.nil? ## Unable to find station. probably not in the USA
|
|
178
182
|
|
|
179
183
|
parsed = JSON.parse(
|
|
180
|
-
|
|
181
|
-
|
|
184
|
+
open("#{CGI.escape(stations['observationStations'][0])}/observations/current").read,
|
|
185
|
+
object_class: OpenStruct
|
|
182
186
|
)
|
|
183
187
|
|
|
184
|
-
|
|
185
188
|
data = parsed.properties
|
|
186
189
|
data.ac = ac
|
|
187
|
-
f = data.temperature.value * 9/5
|
|
190
|
+
f = data.temperature.value * 9 / 5
|
|
188
191
|
temp = "#{f.round(2)} F (#{data.temperature.value.to_i.round(2)} C) "
|
|
189
192
|
wind = "Gusts: #{data.windGust.value} avg: #{data.windSpeed.value.to_i.round(2)}"
|
|
190
193
|
feelslike = "#{data.windChill.value.to_i.round(2)} C"
|
|
@@ -198,13 +201,11 @@ module Plugins
|
|
|
198
201
|
"(#{pressure.convert_to("kPa").to_f.round(2)} kPa) " \
|
|
199
202
|
"≈ Wind: #{wind} ≈ Alerts: ∴"
|
|
200
203
|
return data
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
# rescue
|
|
205
|
+
# data.reply = "Error fetching data"
|
|
203
206
|
end
|
|
204
|
-
|
|
205
207
|
end
|
|
206
208
|
end
|
|
207
209
|
|
|
208
|
-
|
|
209
210
|
# AutoLoad
|
|
210
211
|
Bot.config.plugins.plugins.push Plugins::Weather
|
data/lib/Zeta/plugins/wolfram.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'crack'
|
|
2
|
+
require 'cgi'
|
|
2
3
|
|
|
3
4
|
module Plugins
|
|
4
5
|
class Wolfram
|
|
@@ -18,8 +19,8 @@ module Plugins
|
|
|
18
19
|
def calculate(m, query)
|
|
19
20
|
# Rescue incase something goes wrong
|
|
20
21
|
begin
|
|
21
|
-
debug 'Query: ' + query
|
|
22
|
-
url =
|
|
22
|
+
debug 'Query: ' + Cgi.escape(query)
|
|
23
|
+
url = "http://api.wolframalpha.com/v2/query?input=#{CGI.escape(query)}&appid=#{Config.secrets[:wolfram]}&primary=true&format=plaintext"
|
|
23
24
|
request = open(url).read
|
|
24
25
|
data = Crack::XML.parse(request)
|
|
25
26
|
pod0 = data['queryresult']['pod'][0]['subpod']['plaintext'].strip
|
|
@@ -37,8 +38,6 @@ module Plugins
|
|
|
37
38
|
m.reply 'Unable to get a results'
|
|
38
39
|
end
|
|
39
40
|
end
|
|
40
|
-
|
|
41
|
-
####
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
|
data/lib/Zeta/version.rb
CHANGED
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.
|
|
4
|
+
version: 2.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Liothen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|