@@ -136,6 +136,7 @@ class IrcBot extends Adapter
136
136
realName : process .env .HUBOT_IRC_REALNAME
137
137
port : process .env .HUBOT_IRC_PORT
138
138
rooms : process .env .HUBOT_IRC_ROOMS .split (" ," )
139
+ ignoreUsers : process .env .HUBOT_IRC_IGNORE_USERS ? .split (" ," ) or []
139
140
server : process .env .HUBOT_IRC_SERVER
140
141
password : process .env .HUBOT_IRC_PASSWORD
141
142
nickpass : process .env .HUBOT_IRC_NICKSERV_PASSWORD
@@ -201,6 +202,11 @@ class IrcBot extends Adapter
201
202
# this is a private message, let the 'pm' listener handle it
202
203
return
203
204
205
+ if from in options .ignoreUsers
206
+ console .log (' Ignoring user: %s' , from )
207
+ # we'll ignore this message if it's from someone we want to ignore
208
+ return
209
+
204
210
console .log " From #{ from } to #{ to} : #{ message} "
205
211
206
212
user = self .createUser to, from
@@ -215,6 +221,12 @@ class IrcBot extends Adapter
215
221
216
222
bot .addListener ' action' , (from , to , message ) ->
217
223
console .log " * From #{ from } to #{ to} : #{ message} "
224
+
225
+ if from in options .ignoreUsers
226
+ console .log (' Ignoring user: %s' , from )
227
+ # we'll ignore this message if it's from someone we want to ignore
228
+ return
229
+
218
230
user = self .createUser to, from
219
231
if user .room
220
232
console .log " #{ to} * #{ from } #{ message} "
@@ -232,6 +244,11 @@ class IrcBot extends Adapter
232
244
if process .env .HUBOT_IRC_PRIVATE
233
245
return
234
246
247
+ if nick in options .ignoreUsers
248
+ console .log (' Ignoring user: %s' , nick)
249
+ # we'll ignore this message if it's from someone we want to ignore
250
+ return
251
+
235
252
nameLength = options .nick .length
236
253
if message .slice (0 , nameLength).toLowerCase () != options .nick .toLowerCase ()
237
254
message = " #{ options .nick } #{ message} "
@@ -254,6 +271,11 @@ class IrcBot extends Adapter
254
271
bot .addListener ' invite' , (channel , from ) ->
255
272
console .log (' %s invited you to join %s' , from , channel)
256
273
274
+ if from in options .ignoreUsers
275
+ console .log (' Ignoring user: %s' , from )
276
+ # we'll ignore this message if it's from someone we want to ignore
277
+ return
278
+
257
279
if not process .env .HUBOT_IRC_PRIVATE or process .env .HUBOT_IRC_IGNOREINVITE
258
280
bot .join channel
259
281
0 commit comments