Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

Commit e07b8d6

Browse files
author
Ruoshi.Ling
committed
Add IRC Banned Nicks feature
1 parent c421f1a commit e07b8d6

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ config.users = {
9090
'ircuser': 'slackuser'
9191
};
9292

93+
// Baned list of IRC Nicks
94+
config.bannedIRCNicks = [
95+
'<IRC Nick>',
96+
'ircNick'
97+
];
98+
9399
// -- Setting end on this line
94100

95101
App( config ).start();

README_zh-tw.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ config.users = {
9191
'ircuser': 'slackuser'
9292
};
9393

94+
// IRC 暱稱黑名單
95+
config.bannedIRCNicks = [
96+
'<IRC 暱稱>',
97+
'ircNick'
98+
];
99+
94100
// -- 到此行結束設定。
95101

96102
App( config ).start();

config.js.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ config.users = {
1919
'ircAccount': 'slackUser'
2020
};
2121

22+
config.bannedIRCNicks = [
23+
'ircNick'
24+
];
25+
2226
App( config ).start();

lib/irc-to-slack.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var IrcToSlack = function(config) {
1010
}
1111

1212
this.config = _.defaults(config, {
13+
'bannedIRCNicks': []
1314
});
1415

1516
return this;
@@ -29,6 +30,10 @@ IrcToSlack.prototype._sentToSlack = function(type, from, to, message) {
2930
var hasAvatar = false;
3031
var isNickExist = !!this.nameMap.getSlackNameByIrcNick(from);
3132

33+
if (_.contains(this.config.bannedIRCNicks, username)) {
34+
return;
35+
}
36+
3237
if (this.config.isMapName && isNickExist) {
3338
username = this.nameMap.getSlackNameByIrcNick(from);
3439
hasAvatar = typeof avatars[username] !== 'undefined';

0 commit comments

Comments
 (0)