zetabot 2.0.9 → 2.1.1

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: 5ca813b62e8520169331f3e978e82d7ae782c96727362bc21125cd973e164b8a
4
- data.tar.gz: f34bf6917e3015268b7dfd16684731a79ba27f987810b1fcd2ad59a9d4609071
3
+ metadata.gz: 0b53140618ee18e26da975b11636994b8e2e1d1b0a706d2f71bf4a5056d6bbec
4
+ data.tar.gz: 72d919a4e0df285f135ebc1aece8077cf8de4e44fb2fe990bbae98decb5ab173
5
5
  SHA512:
6
- metadata.gz: 2965b9a7c3858b703d606cb444bf76ce707a105dda0c2a51335d255b209264cf94abe44e626658d55baab6da14e4274764edda230da117c2a7a60dedd6ab67fb
7
- data.tar.gz: b632e398611d098b88ac692f88c0c7833900a1117e773685c8c869926b0c4832c14b1052904a235677b65aea85131851d1b9b85ab224d12fab62f6c1c1e8d86b
6
+ metadata.gz: db34a813f6c4770564e2b68f30be17f677269c9e175952464693e817376e69564bbc1f28880c05ef2cf96e1792d7bcb531cab5f63d605dcec7f377e32a01a116
7
+ data.tar.gz: 88078ed8cfa8bb1beae4d5b56bb103ed6aabfbb527c5c80a3d261b64da3a2b3a4040b90b20cbca7e82bb14617eb1ecde3823fa7dbf1b9e691a63e4ed1793cec0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zetabot (2.0.9)
4
+ zetabot (2.1.0)
5
5
  actionview
6
6
  chronic
7
7
  chronic_duration
data/README.md CHANGED
@@ -3,23 +3,31 @@ Cinch IRC bot written with plenty of help. I will not claim any of the plugins
3
3
  And will try to get the correct credits in source
4
4
 
5
5
  # Installation
6
- Zeta requires ruby >= 2.5.0 and rubygems. Installation beyond that is simple
6
+ Zeta requires ruby >= 2.7.6 and rubygems. Installation beyond that is simple
7
7
 
8
8
  _Steps_
9
9
  * gem install zetabot
10
10
  * zetabot
11
11
 
12
+
13
+ _Docker_
14
+
15
+ Zeta will need its config file mounted in the `.zeta/config.rb` image for her to function.
16
+
17
+ ```dockerfile
18
+ FROM docker.io/ruby:2.7.6
19
+ RUN useradd zeta -m
20
+ USER zeta
21
+ WORKDIR /home/zeta/
22
+ RUN mkdir .zeta .zeta/cache .zeta/log && \
23
+ gem install zetabot
24
+ # Run zeta
25
+ CMD [ "zetabot"]
26
+ ```
27
+
12
28
  _Plugins_
13
29
  All plugins are automatically loaded that are in the plugins directory
14
30
 
15
- # Upgrade
16
- _Steps_
17
- * git pull
18
- * bundle
19
- * update config files to new examples
20
- * ruby ./migrate.rb
21
- * ruby ./zeta.rb
22
-
23
31
  ## Commands
24
32
  roles: owner,admin,operator,halfop,voice,nobody
25
33
  prefix: ?
data/lib/Zeta/config.rb CHANGED
@@ -27,6 +27,8 @@ ConfigStruct = Struct.new(
27
27
  :secure_host,
28
28
  :options,
29
29
  :debug,
30
+ :quotes_api_key,
31
+ :quotes_api_url,
30
32
  :secrets
31
33
  )
32
34
  # Initialize Config
@@ -34,7 +34,7 @@ module Plugins
34
34
  RestClient.post(
35
35
  'https://darchoods.net/api/irc/channel/view',
36
36
  {
37
- auth_token: Config.secrets[:darkscience],
37
+ auth_token: Config.quotes_api_key,
38
38
  channel: chan,
39
39
  }
40
40
  )
@@ -67,7 +67,7 @@ module Plugins
67
67
  RestClient.post(
68
68
  'https://darchoods.net/api/irc/user/view',
69
69
  {
70
- auth_token: Config.secrets[:darkscience],
70
+ auth_token: Config.quotes_api_key,
71
71
  username: nick,
72
72
  }
73
73
  )
@@ -106,9 +106,9 @@ module Plugins
106
106
  begin
107
107
  data = JSON.parse(
108
108
  RestClient.post(
109
- 'https://darchoods.net/api/irc/user/view',
109
+ "https://#{Config.quotes_api_url}/api/irc/user/view",
110
110
  {
111
- auth_token: Config.secrets[:darkscience],
111
+ auth_token: Config.quotes_api_key,
112
112
  username: nick,
113
113
  }
114
114
  )
@@ -141,9 +141,9 @@ module Plugins
141
141
  begin
142
142
  request = JSON.parse(
143
143
  RestClient.post(
144
- 'https://darchoods.net/api/qdb/create',
144
+ "https://#{Config.quotes_api_url}/api/qdb/create",
145
145
  {
146
- auth_token: Config.secrets[:darkscience],
146
+ auth_token: Config.quotes_api_key,
147
147
  channel: m.channel,
148
148
  author: m.user,
149
149
  quote: quote
@@ -164,9 +164,9 @@ module Plugins
164
164
  begin
165
165
  request = JSON.parse(
166
166
  RestClient.post(
167
- 'https://darchoods.net/api/qdb/search/byId',
167
+ "https://#{Config.quotes_api_url}/api/qdb/search/byId",
168
168
  {
169
- auth_token: Config.secrets[:darkscience],
169
+ auth_token: Config.quotes_api_key,
170
170
  channel: m.channel,
171
171
  quote_id: search
172
172
  }
@@ -189,8 +189,8 @@ module Plugins
189
189
  begin
190
190
  request = JSON.parse(
191
191
  RestClient.post(
192
- 'https://darchoods.net/api/qdb/random',
193
- { auth_token: Config.secrets[:darkscience],
192
+ "https://#{Config.quotes_api_url}/api/qdb/random",
193
+ { auth_token: Config.quotes_api_key,
194
194
  channel: m.channel
195
195
  }
196
196
  )
@@ -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(RestClient.get(url).body).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
@@ -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
@@ -29,7 +29,7 @@ module Plugins
29
29
 
30
30
  #####
31
31
  def initialize(*args)
32
- @api_src = %w{wu noaa darksky owm}
32
+ @api_src = %w{noaa owm}
33
33
  @store = Persist.new(File.join(Dir.home, '.zeta', 'cache', 'weather.pstore'))
34
34
  super
35
35
  end
@@ -40,17 +40,17 @@ module Plugins
40
40
  # Lookup user from pstore
41
41
  if !@store[msg.user.to_s].nil? && query.nil?
42
42
  stored_location, stored_source = @store[msg.user.to_s].split('::')
43
- stored_source = @api_src.include?(stored_source) ? stored_source : 'darksky'
43
+ stored_source = @api_src.include?(stored_source) ? stored_source : 'owm'
44
44
  data = send("#{stored_source}_src", stored_location)
45
45
  # location = geolookup(@store[msg.user.to_s])
46
46
  # data = wunderground_src(stored_location, false)
47
47
  elsif query.nil?
48
- return msg.reply 'No location set. ?setw <location> :(darksky|noaa|apixu|owm)'
48
+ return msg.reply 'No location set. ?setw <location> :(noaa|owm)'
49
49
  else
50
50
  # data = wu_src(query, true)
51
51
  src = query[/:\w+/].gsub(/:/, '') if query[/:\w+/]
52
52
  query = query.gsub(/:\w+/, '').strip if query
53
- true_src = @api_src.include?(src) ? src : 'darksky'
53
+ true_src = @api_src.include?(src) ? src : 'owm'
54
54
  data = send("#{true_src}_src", query)
55
55
  end
56
56
 
@@ -67,7 +67,7 @@ module Plugins
67
67
  query = query.gsub(/:\w+/, '').strip if query
68
68
 
69
69
  # Sanity Check
70
- true_src = @api_src.include?(src) ? src : 'darksky'
70
+ true_src = @api_src.include?(src) ? src : 'owm'
71
71
  data = send("#{true_src}_src", query)
72
72
 
73
73
  # Error
@@ -119,47 +119,6 @@ module Plugins
119
119
  return data
120
120
  end
121
121
 
122
- # DarkSky - https://darksky.net/dev
123
- def darksky_src(location)
124
- location = CGI.escape(location)
125
-
126
- ac = JSON.parse(
127
- RestClient.get("https://maps.googleapis.com/maps/api/geocode/json?address=#{location}&key=#{Config.secrets[:google]}").body,
128
- object_class: OpenStruct
129
- )
130
- return nil if ac.results.nil? ## Unable to locate
131
-
132
- ac = ac.results[0]
133
- lat = ac.geometry.location.lat
134
- lon = ac.geometry.location.lng
135
-
136
- data = JSON.parse(
137
- RestClient.get("https://api.darksky.net/forecast/#{Config.secrets[:darksky]}/#{lat},#{lon}").body,
138
- object_class: OpenStruct
139
- )
140
- data.ac = ac
141
- current = data.currently
142
- alerts = data.alerts.count rescue 0
143
- c = Unitwise(current.temperature, '[degF]').convert_to('Cel').to_i
144
- c_feels = Unitwise(current.apparentTemperature, '[degF]').convert_to('Cel').to_i
145
- p = Unitwise(current.pressure.to_f, 'mbar')
146
- gusts = Unitwise(current.windGust, 'mile').convert_to('kilometer').to_i
147
-
148
- tempstring = "#{current.temperature.to_i} F (#{c} C)"
149
-
150
- data.reply = "DS ∴ #{ac.formatted_address} " \
151
- "≈ #{TZInfo::Timezone.get(data.timezone).now.strftime("%c")} " \
152
- "≈ #{current.summary} #{tempstring} " \
153
- "≈ Humidity: #{(current.humidity * 100).round(2)}% " \
154
- "≈ Pressure: #{p.convert_to('[in_i\'Hg]').to_f.round(2)} in/Hg " \
155
- "(#{p.convert_to("kPa").to_f.round(2)} kPa) " \
156
- "≈ Wind: gusts upto #{current.windGust} mph (#{gusts} km/h) ≈ Alerts: #{alerts} ∴"
157
-
158
- return data
159
- # rescue
160
- # return nil
161
- end
162
-
163
122
  # NOAA - https://graphical.weather.gov/xml/
164
123
  def noaa_src(location)
165
124
  location = CGI.escape(location)
data/lib/Zeta/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zeta
2
- VERSION = '2.0.9'
2
+ VERSION = '2.1.1'
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.9
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liothen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-12 00:00:00.000000000 Z
11
+ date: 2023-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -658,7 +658,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
658
658
  - !ruby/object:Gem::Version
659
659
  version: '0'
660
660
  requirements: []
661
- rubygems_version: 3.1.6
661
+ rubygems_version: 3.3.7
662
662
  signing_key:
663
663
  specification_version: 4
664
664
  summary: Zeta is a IRC bot written in ruby using the Cinch Framework