Skip to content

Commit 3e218ad

Browse files
Vamshi99gitmate-bot
authored andcommitted
filters.py: Filter required users
If RESP_ONLY_REQ_USERS configuration is true, then stop responding to users other than those in the REQUIRED_USERS list in config. Closes #515
1 parent c0acd51 commit 3e218ad

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

config.py

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
IGNORE_USERNAMES = os.environ.get("IGNORE_USERNAMES",
7676
'co-robo coala-bot').split()
7777

78+
RESP_ONLY_REQ_USERS = False
79+
80+
REQUIRED_USERS = []
81+
7882
DIVERT_TO_PRIVATE = ('help', )
7983

8084
ROOMS_TO_JOIN = (

utils/filters.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ def filters(self, msg, cmd, args, dry_run):
2323
return msg, cmd, args
2424

2525
@cmdfilter
26-
def filter_ignored_users(self, msg, cmd, args, dry_run):
26+
def filter_users(self, msg, cmd, args, dry_run):
2727
if msg.frm.nick in self.bot_config.IGNORE_USERNAMES:
2828
return None, None, None
29+
if msg.frm.nick not in self.bot_config.REQUIRED_USERS \
30+
and self.bot_config.RESP_ONLY_REQ_USER:
31+
return None, None, None
2932
return msg, cmd, args

0 commit comments

Comments
 (0)