zetabot 0.0.11 → 0.0.12

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: b1fb2672260cce23a53495ccdf9c1d9c9b6f0e54
4
- data.tar.gz: 82c52214d64fbad96b97c80f90da5b432177b26c
3
+ metadata.gz: 68d78754e661e90b35e886c10b1d8ef7b21b7f9d
4
+ data.tar.gz: 4fa6fce72cc93effcae2f371a3cf7e2ea6ced806
5
5
  SHA512:
6
- metadata.gz: f7dc2e90e6a816c06d46b16a33f914c6bea7aa93f091b5386b90e24f17e1eb26b601a77fa87992ecbebd0c78b7081fd8dff6c2c7809897dbe267d433216e7fd4
7
- data.tar.gz: 98735bd31c85d9d101fcaa7adc1806d5a4def525b6f7687d9590be79c1fbe198a5dae7eee23a1203f33b1279723a5c15742b57aae63fa821af20d55a76e5a7a1
6
+ metadata.gz: 76fc0c344ecfe0361ffd282444b387e8d521a0ed8c81aa7d481a390f13964a533b69a10f5e01cf2f74ced191a035f8bd7215733c8ff6b5018800db34eb0ba448
7
+ data.tar.gz: 1d8319db93efffd615e206e38bfa5dd72e69c5e5d503baa3ee84911fba90d6ec27281c099b19280aae90f193ca4b5611efec2a570f23dc2e2cbd9e901f689978
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zetabot (0.0.10)
4
+ zetabot (0.0.11)
5
5
  actionview
6
6
  chronic
7
7
  chronic_duration
data/lib/Zeta/access.rb CHANGED
@@ -7,6 +7,8 @@ module Cinch
7
7
  end
8
8
  end
9
9
 
10
+ Spam = Struct.new(:nick, :time)
11
+
10
12
  def check?(m, lvl, secure_chan)
11
13
  # Make sure we are actually getting a channel object
12
14
  if m.class == Cinch::Channel
data/lib/Zeta/admin.rb CHANGED
@@ -7,4 +7,5 @@ require 'Zeta/admin/plugins'
7
7
  require 'Zeta/admin/users'
8
8
  require 'Zeta/admin/autojoin'
9
9
  require 'Zeta/admin/ignore'
10
- require 'Zeta/admin/bot'
10
+ require 'Zeta/admin/bot'
11
+ require 'Zeta/admin/blacklister'
@@ -0,0 +1,73 @@
1
+ module Admin
2
+ class Blacklister
3
+ include Cinch::Plugin
4
+
5
+ enable_acl(:oper)
6
+
7
+ set(
8
+ plugin_name: "Bot_Eval",
9
+ help: "Bot administrator-only private commands.\nUsage: `?er <code>`;",
10
+ )
11
+
12
+ # Regex
13
+ match /bl channel (\S+)/, method: :bl_channel
14
+ match /bl url (\S+)/, method: :bl_url
15
+ match /bl mask (\S+)/, method: :bl_mask
16
+ # match /bl plugin (\S+)/, method: :bl_plugin
17
+
18
+ # Load the defaults
19
+ match 'bl defaults', method: :bl_defaults
20
+
21
+ # Sync
22
+ match 'sync', method: :sync
23
+ match 'bl sync', method: :sync
24
+
25
+
26
+ def bl_channel(m, chan)
27
+ m.reply "#{chan} is already on BlackList" if Blacklist.channels.include? chan
28
+ Blacklist.channels << chan
29
+ save_blacklist()
30
+ m.reply "#{chan} is now on the BlackList"
31
+ end
32
+
33
+ def bl_url(m, url)
34
+ m.reply "#{url} is already on BlackList" if Blacklist.channels.include? url
35
+ Blacklist.urls << url
36
+ save_blacklist()
37
+ m.reply "#{url} is now on the BlackList"
38
+ end
39
+
40
+ def bl_mask(m, mask)
41
+ m.reply "#{mask} is already on BlackList" if Blacklist.masks.include? mask
42
+ Blacklist.masks << url
43
+ save_blacklist()
44
+ m.reply "#{mask} is now on the BlackList"
45
+ end
46
+
47
+ def bl_plugin(m, plugin)
48
+ # TODO: This needs alot more work because i need to disable by channel
49
+ end
50
+
51
+ def bl_defaults(m)
52
+ clear_blacklist()
53
+ Blacklist.urls = Config.options[:blacklist][:urls]
54
+ Blacklist.users = Config.options[:blacklist][:users]
55
+ Blacklist.masks = Config.options[:blacklist][:masks]
56
+ Blacklist.channels = Config.options[:blacklist][:channels]
57
+ save_blacklist()
58
+ m.reply 'Default Blacklist Loaded'
59
+ end
60
+
61
+ def sync(m)
62
+ save_blacklist()
63
+ m.action_reply 'Blacklist is now synced!'
64
+ end
65
+
66
+
67
+
68
+ end
69
+ end
70
+
71
+
72
+ # AutoLoad
73
+ Bot.config.plugins.plugins.push Admin::Blacklister
@@ -21,8 +21,6 @@ module Admin
21
21
 
22
22
  match 'ignorelist', method: :ignore_list
23
23
 
24
- match 'sync', method: :sync
25
-
26
24
  def finalize
27
25
  save_blacklist()
28
26
  end
@@ -99,10 +97,6 @@ module Admin
99
97
  m.reply "Currently ignored users are: #{Blacklist.users.join(', ')}"
100
98
  end
101
99
 
102
- def sync(m)
103
- save_blacklist()
104
- m.action_reply 'is now synced!'
105
- end
106
100
 
107
101
  end
108
102
  end
@@ -1,4 +1,4 @@
1
- BlackListStruct = Struct.new :channels, :users, :plugins
1
+ BlackListStruct = Struct.new :channels, :users, :plugins, :urls, :masks
2
2
 
3
3
  # Load Cached
4
4
  if File.exists?(File.join(Dir.home, '.zeta', 'cache', 'blacklist.rb'))
@@ -6,7 +6,7 @@ if File.exists?(File.join(Dir.home, '.zeta', 'cache', 'blacklist.rb'))
6
6
  Blacklist = Marshal.load(file)
7
7
  end
8
8
  else
9
- Blacklist = BlackListStruct.new([], [], [])
9
+ Blacklist = BlackListStruct.new([], [], [], [], [])
10
10
  end
11
11
 
12
12
 
@@ -21,5 +21,7 @@ def clear_blacklist()
21
21
  Blacklist.users = []
22
22
  Blacklist.plugins = []
23
23
  Blacklist.channels = []
24
+ Blacklist.urls = []
25
+ Blacklist.masks = []
24
26
  File.delete(File.join(Dir.home, '.zeta', 'cache', 'blacklist.rb'))
25
27
  end
@@ -64,6 +64,9 @@ module Plugins
64
64
  # Parse URI
65
65
  p = URI(url)
66
66
 
67
+ # Disregaurd on blacklist
68
+ return if Blacklist.urls.include? p.host
69
+
67
70
  # API key lookup
68
71
  VideoInfo.provider_api_keys = { youtube: Config.secrets[:google] }
69
72
 
data/lib/Zeta/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zeta
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
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: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liothen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -552,6 +552,7 @@ files:
552
552
  - lib/Zeta/access.rb
553
553
  - lib/Zeta/admin.rb
554
554
  - lib/Zeta/admin/autojoin.rb
555
+ - lib/Zeta/admin/blacklister.rb
555
556
  - lib/Zeta/admin/bot.rb
556
557
  - lib/Zeta/admin/channels.rb
557
558
  - lib/Zeta/admin/eval.rb