Skip to content

Commit 83a2283

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 faafb25 commit 83a2283

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@
8787
IGNORE_USERNAMES = os.environ.get("IGNORE_USERNAMES",
8888
'co-robo coala-bot').split()
8989

90+
RESP_ONLY_REQ_USERS = False
91+
92+
REQUIRED_USERS = []
93+
9094
DIVERT_TO_PRIVATE = ('help', )
9195

9296
ROOMS_TO_JOIN = (

utils/filters.py

Lines changed: 4 additions & 1 deletion
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)