kag-gather 1.5.6 → 1.5.7

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.
@@ -87,8 +87,9 @@ module KAG
87
87
  end
88
88
 
89
89
  def self.ignore(gather,message,user)
90
+ user.refresh
90
91
  KAG::Config.data[:ignored] = {} unless KAG::Config.data[:ignored]
91
- if KAG::Config.data[:ignored] and !KAG::Config.data[:ignored].key?(user.authname.to_sym)
92
+ if KAG::Config.data[:ignored] and user.authname and !KAG::Config.data[:ignored].key?(user.authname.to_sym)
92
93
  c = SymbolTable.new({
93
94
  :nick => user.nick,
94
95
  :authname => user.authname,
@@ -101,16 +102,17 @@ module KAG
101
102
  KAG::Config.data[:ignored][user.authname.to_sym] = c
102
103
  KAG::Config.data.save
103
104
 
104
- gather.reply message,"User #{user.nick} added to ignore list." if gather.class == KAG::Gather
105
+ gather.reply message,"User #{user.authname} added to ignore list." if gather.class == KAG::Gather
105
106
  true
106
107
  else
107
- gather.reply message,"User #{user.nick} already in ignore list!" if gather.class == KAG::Gather
108
+ gather.reply message,"User #{user.authname} already in ignore list!" if gather.class == KAG::Gather
108
109
  false
109
110
  end
110
111
  end
111
112
 
112
113
  def self.remove(gather,message,user)
113
- if KAG::Config.data[:reported] and KAG::Config.data[:reported].key?(user.authname.to_sym)
114
+ user.refresh
115
+ if KAG::Config.data[:reported] and user.authname and KAG::Config.data[:reported].key?(user.authname.to_sym)
114
116
  KAG::Config.data[:reported].delete(user.authname.to_sym)
115
117
  KAG::Config.data.save
116
118
 
@@ -123,7 +125,8 @@ module KAG
123
125
  end
124
126
 
125
127
  def self.unignore(gather,message,user)
126
- if KAG::Config.data[:ignored] and KAG::Config.data[:ignored].key?(user.authname.to_sym)
128
+ user.refresh
129
+ if KAG::Config.data[:ignored] and user.authname and KAG::Config.data[:ignored].key?(user.authname.to_sym)
127
130
  KAG::Config.data[:ignored].delete(user.authname.to_sym)
128
131
  KAG::Config.data.save
129
132
 
@@ -136,7 +139,8 @@ module KAG
136
139
  end
137
140
 
138
141
  def self.reports(user)
139
- if KAG::Config.data[:reported] and KAG::Config.data[:reported].key?(user.authname.to_sym)
142
+ user.refresh
143
+ if KAG::Config.data[:reported] and user.authname and KAG::Config.data[:reported].key?(user.authname.to_sym)
140
144
  KAG::Config.data[:reported][user.authname.to_sym][:count]
141
145
  else
142
146
  false
@@ -88,48 +88,73 @@ module KAG
88
88
  end
89
89
  end
90
90
 
91
- command :op,{nick: :string},
91
+ command :op,{nick: :string,channel: :string},
92
92
  summary: "Op a user",
93
93
  admin: true
94
- def op(m,nick)
94
+ def op(m,nick,channel = nil)
95
95
  if is_admin(m.user)
96
- m.channel.op(nick)
96
+ if channel
97
+ c = Channel(channel)
98
+ c.op(nick) if c
99
+ else
100
+ m.channel.op(nick)
101
+ end
97
102
  end
98
103
  end
99
104
 
100
- command :deop,{nick: :string},
105
+ command :deop,{nick: :string,channel: :string},
101
106
  summary: "Deop a user",
102
107
  admin: true
103
- def deop(m,nick)
108
+ def deop(m,nick,channel = nil)
104
109
  if is_admin(m.user)
105
- m.channel.deop(nick)
110
+ if channel
111
+ c = Channel(channel)
112
+ c.deop(nick) if c
113
+ else
114
+ m.channel.deop(nick)
115
+ end
106
116
  end
107
117
  end
108
118
 
109
- command :voice,{nick: :string},
119
+ command :voice,{nick: :string,channel: :string},
110
120
  summary: "Voice a user",
111
121
  admin: true
112
- def voice(m,nick)
122
+ def voice(m,nick,channel = nil)
113
123
  if is_admin(m.user)
114
- m.channel.voice(nick)
124
+ if channel
125
+ c = Channel(channel)
126
+ c.voice(nick) if c
127
+ else
128
+ m.channel.voice(nick)
129
+ end
115
130
  end
116
131
  end
117
132
 
118
- command :devoice,{nick: :string,reason: :string},
133
+ command :devoice,{nick: :string,channel: :string},
119
134
  summary: "Devoice a user",
120
135
  admin: true
121
- def devoice(m,nick,reason = '')
136
+ def devoice(m,nick,channel = nil)
122
137
  if is_admin(m.user)
123
- m.channel.devoice(nick)
138
+ if channel
139
+ c = Channel(channel)
140
+ c.devoice(nick) if c
141
+ else
142
+ m.channel.devoice(nick)
143
+ end
124
144
  end
125
145
  end
126
146
 
127
- command :kick,{nick: :string,reason: :string},
147
+ command :kick,{nick: :string,reason: :string,channel: :string},
128
148
  summary: "Kick a user",
129
149
  admin: true
130
- def kick(m,nick,reason)
150
+ def kick(m,nick,reason = "",channel = nil)
131
151
  if is_admin(m.user)
132
- m.channel.kick(nick,reason)
152
+ if channel
153
+ c = Channel(channel)
154
+ c.kick(nick,reason) if c
155
+ else
156
+ m.channel.kick(nick,reason)
157
+ end
133
158
  end
134
159
  end
135
160
  end
@@ -1,5 +1,5 @@
1
1
  module KAG
2
- VERSION = '1.5.6'
2
+ VERSION = '1.5.7'
3
3
  def self.version
4
4
  VERSION
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kag-gather
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.5.6
5
+ version: 1.5.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Shaun McCormick