kag-gather 1.3.3 → 1.3.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.
data/lib/kag/gather.rb CHANGED
@@ -148,7 +148,7 @@ module KAG
148
148
  unless is_banned?(m.user)
149
149
  u = User(nick)
150
150
  if u and !u.unknown
151
- KAG::Report.new(m,u)
151
+ KAG::Report.new(self,m,u)
152
152
  else
153
153
  reply m,"User #{nick} not found!"
154
154
  end
@@ -439,7 +439,7 @@ module KAG
439
439
  if is_admin(m.user)
440
440
  user = User(nick)
441
441
  if user and !user.unknown
442
- KAG::Report.remove(user,m,self)
442
+ KAG::Report.remove(self,m,user)
443
443
  else
444
444
  reply m,"Could not find user #{nick}"
445
445
  end
@@ -451,7 +451,7 @@ module KAG
451
451
  if is_admin(m.user)
452
452
  user = User(nick)
453
453
  if user and !user.unknown
454
- KAG::Report.ignore(user,m,self)
454
+ KAG::Report.ignore(self,m,user)
455
455
  else
456
456
  reply m,"Could not find user #{nick}"
457
457
  end
@@ -463,7 +463,7 @@ module KAG
463
463
  if is_admin(m.user)
464
464
  user = User(nick)
465
465
  if user and !user.unknown
466
- KAG::Report.unignore(user,m,self)
466
+ KAG::Report.unignore(self,m,user)
467
467
  else
468
468
  reply m,"Could not find user #{nick}"
469
469
  end
@@ -496,9 +496,9 @@ module KAG
496
496
 
497
497
  def is_banned?(user)
498
498
  d = KAG::Config.data
499
+ KAG::Config.data[:ignored] = {} unless KAG::Config.data[:ignored]
499
500
  if d
500
- false
501
- #d[:ignored].key?(user.host.to_sym)
501
+ d[:ignored].key?(user.host.to_sym)
502
502
  else
503
503
  false
504
504
  end
data/lib/kag/report.rb CHANGED
@@ -5,13 +5,13 @@ require 'kag/config'
5
5
  module KAG
6
6
  class Report < SymbolTable
7
7
 
8
- def initialize(m,user)
8
+ def initialize(gather,m,user)
9
9
  hash = {
10
10
  :nick => user.nick,
11
11
  :authname => user.authname,
12
12
  :host => user.host,
13
13
  :realname => user.realname,
14
- :gather => self,
14
+ :gather => gather,
15
15
  :message => m,
16
16
  :count => 1
17
17
  }
@@ -25,7 +25,7 @@ module KAG
25
25
  up_report_count
26
26
  end
27
27
  else
28
- self[:gather].reply self[:message],"You have already reported #{self[:nick]}. You can only report a user once."
28
+ self.gather.reply self.message,"You have already reported #{self[:nick]}. You can only report a user once."
29
29
  end
30
30
  else
31
31
  report
@@ -35,7 +35,7 @@ module KAG
35
35
  def can_report?
36
36
  r = _report
37
37
  if r and r[:reporters]
38
- !r[:reporters].include?(self[:message].user.authname)
38
+ !r[:reporters].include?(self.message.user.authname)
39
39
  else
40
40
  true
41
41
  end
@@ -51,15 +51,15 @@ module KAG
51
51
  end
52
52
 
53
53
  def report
54
- puts self[:message].inspect
54
+ puts self.message.inspect
55
55
  c = self.dup
56
56
  c.delete(:gather)
57
57
  c.delete(:message)
58
- c[:reporters] = [self[:message].user[:authname]]
58
+ c[:reporters] = [self.message.user.authname]
59
59
  data[:reported][self[:host].to_sym] = c
60
60
  data.save
61
61
 
62
- self[:gather].reply self[:message],"User #{self[:nick]} reported." if self[:gather].class == KAG::Gather
62
+ self.gather.reply self.message,"User #{self[:nick]} reported." if self.gather.class == KAG::Gather
63
63
  end
64
64
 
65
65
  def ignore
@@ -68,7 +68,7 @@ module KAG
68
68
  c.delete(:message)
69
69
  data[:ignored][self[:host].to_sym] = c
70
70
  data.save
71
- self[:gather].reply self[:message],"User #{self[:nick]} ignored." if gather.class == KAG::Gather
71
+ self.gather.reply self.message,"User #{self[:nick]} ignored." if self.gather.class == KAG::Gather
72
72
  end
73
73
 
74
74
  def past_threshold?
@@ -78,13 +78,13 @@ module KAG
78
78
  def up_report_count
79
79
  _report[:count] = _report[:count].to_i + 1
80
80
  _report[:reporters] = [] unless _report[:reporters]
81
- _report[:reporters] << self[:message].user.authname
81
+ _report[:reporters] << self.message.user.authname
82
82
  data.save
83
83
 
84
- gather.reply message,"User #{self[:nick]} reported. #{self[:nick]} has now been reported #{data[:reported][self[:host].to_sym][:count]} times." if gather.class == KAG::Gather
84
+ self.gather.reply message,"User #{self[:nick]} reported. #{self[:nick]} has now been reported #{data[:reported][self[:host].to_sym][:count]} times." if self.gather.class == KAG::Gather
85
85
  end
86
86
 
87
- def self.ignore(user,message,gather)
87
+ def self.ignore(gather,message,user)
88
88
  KAG::Config.data[:ignored] = {} unless KAG::Config.data[:ignored]
89
89
  if KAG::Config.data[:ignored] and !KAG::Config.data[:ignored].key?(user.host.to_sym)
90
90
  c = SymbolTable.new({
@@ -107,7 +107,7 @@ module KAG
107
107
  end
108
108
  end
109
109
 
110
- def self.remove(user,message,gather)
110
+ def self.remove(gather,message,user)
111
111
  if KAG::Config.data[:reported] and KAG::Config.data[:reported].key?(user.host.to_sym)
112
112
  KAG::Config.data[:reported].delete(user.host.to_sym)
113
113
  KAG::Config.data.save
@@ -120,7 +120,7 @@ module KAG
120
120
  end
121
121
  end
122
122
 
123
- def self.unignore(user,message,gather)
123
+ def self.unignore(gather,message,user)
124
124
  if KAG::Config.data[:ignored] and KAG::Config.data[:ignored].key?(user.host.to_sym)
125
125
  KAG::Config.data[:ignored].delete(user.host.to_sym)
126
126
  KAG::Config.data.save
data/lib/kag/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module KAG
2
- VERSION = '1.3.3'
2
+ VERSION = '1.3.4'
3
3
  def self.version
4
4
  VERSION
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kag-gather
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -123,7 +123,7 @@ dependencies:
123
123
  - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
- description: ''
126
+ description: A bot for starting and managing KAG Gather matches
127
127
  email:
128
128
  - splittingred@gmail.com
129
129
  executables: []