Skip to content

Commit

Permalink
greylist
Browse files Browse the repository at this point in the history
  • Loading branch information
4shadoww committed Jul 9, 2017
1 parent a5047df commit 8714aad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions conf/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
},
"greylist": {
"list_path": "Käyttäjä:VakauttajaBot/greylist.json",
"score": 1,
"expiry": 24
}
}
8 changes: 5 additions & 3 deletions core/rules/greylist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class YunoModule:
api = yapi.MWAPI
config = {
"expiry": 24,
"score": 1,
"list_path": "Käyttäjä:VakauttajaBot/greylist.json"
}
greylist = None
Expand All @@ -29,9 +30,10 @@ def run(self, rev):
self.greylist = json.loads(self.api.getText(self.config["list_path"]))
self.list_ver = lastrev

for user in self.greylist:
if user == rev["user"] and self.greylist[user] > score:
score = self.greylist[user]
for user in self.greylist["values"]:
if user == rev["user"]:
score = self.config["score"]
expiry = self.config["expiry"]
break

return score, expiry

0 comments on commit 8714aad

Please sign in to comment.