|
@@ -38,7 +38,7 @@ BOT_DATA_DEFAULT = { "client_id" : None,
|
38
|
38
|
"instance_url" : None,
|
39
|
39
|
"master_username" : None,
|
40
|
40
|
"master_instance" : None,
|
41
|
|
- "users_blacklist" : {},
|
|
41
|
+ "users_blacklist" : [],
|
42
|
42
|
"sources" : { "timeline" : {},
|
43
|
43
|
"hashtag" : {},
|
44
|
44
|
"mentions" : None } }
|
|
@@ -249,14 +249,15 @@ class Rule:
|
249
|
249
|
.format( author ) )
|
250
|
250
|
if not really_act:
|
251
|
251
|
return
|
252
|
|
- status = "Blacklisted."
|
|
252
|
+ status = "@{} ".format(author)
|
253
|
253
|
if not author in data["users_blacklist"]:
|
254
|
254
|
data["users_blacklist"].append(author)
|
255
|
|
- save_data( data, args.data_file )
|
|
255
|
+ status += "Blacklisted."
|
256
|
256
|
else:
|
257
|
|
- status = "Already blacklisted."
|
|
257
|
+ status += "Already blacklisted."
|
258
|
258
|
|
259
|
|
- mastodon.status_post( status = status )
|
|
259
|
+ mastodon.status_post( status = status,
|
|
260
|
+ in_reply_to_id = toot["id"] )
|
260
|
261
|
return
|
261
|
262
|
|
262
|
263
|
# WHITELIST ACTION
|
|
@@ -266,12 +267,12 @@ class Rule:
|
266
|
267
|
.format( author ) )
|
267
|
268
|
if not really_act:
|
268
|
269
|
return
|
269
|
|
- status = "Unblacklisted."
|
|
270
|
+ status = "@{} ".format(author)
|
270
|
271
|
if not author in data["users_blacklist"]:
|
271
|
|
- status = "Already not blacklisted."
|
|
272
|
+ status += "Already not blacklisted."
|
272
|
273
|
else:
|
273
|
274
|
data["users_blacklist"].remove(author)
|
274
|
|
- save_data( data, args.data_file )
|
|
275
|
+ status += "Unblacklisted."
|
275
|
276
|
|
276
|
277
|
mastodon.status_post( status = status )
|
277
|
278
|
return
|
|
@@ -837,8 +838,10 @@ def daemon_main_loop():
|
837
|
838
|
interacted_with = True
|
838
|
839
|
break
|
839
|
840
|
|
840
|
|
- except AttributeError: # No matches() function
|
841
|
|
- pass # Skipping action rules
|
|
841
|
+ except AttributeError as e: # No matches() function
|
|
842
|
+ if rule.debug:
|
|
843
|
+ raise e
|
|
844
|
+ # Else, skipping action rules...
|
842
|
845
|
|
843
|
846
|
# Mark toot as treated. We specify if a rule really matched the
|
844
|
847
|
# toot
|