Browse Source

Add a nopost argument

Like --simulate, but still save data. Useful for a first run.
Lertsenem 6 months ago
parent
commit
2210464e75
1 changed files with 7 additions and 3 deletions
  1. 7 3
      main.py

+ 7 - 3
main.py

@@ -60,6 +60,10 @@ parser.add_argument ( "-s", "--simulate",
60 60
                       action = "store_true",
61 61
                       help = "do not actually post anything or save anything" )
62 62
 
63
+parser.add_argument ( "-S", "--nopost",
64
+                      action = "store_true",
65
+                      help = "do not actually post anything (but still save data)" )
66
+
63 67
 parser.add_argument ( "-F", "--foreground",
64 68
                       action = "store_true",
65 69
                       help = "run in foreground" )
@@ -833,7 +837,7 @@ def daemon_main_loop():
833 837
                                      context = bot_ctx,
834 838
                                      data = bot_data,
835 839
                                      toot = t,
836
-                                     really_act = not args.simulate ):
840
+                                     really_act = not args.simulate and not args.nopost ):
837 841
                         logger.debug("rule '{}' matched!".format(rule))
838 842
                         interacted_with = True
839 843
                         break
@@ -845,7 +849,7 @@ def daemon_main_loop():
845 849
 
846 850
             # Mark toot as treated. We specify if a rule really matched the
847 851
             # toot
848
-            if not args.simulate:
852
+            if not args.simulate and not args.nopost:
849 853
                 mark_toot_as_treated( bot_mstdn, t, interacted_with )
850 854
 
851 855
         # Save timelines last_ids
@@ -886,7 +890,7 @@ def daemon_main_loop():
886 890
                                   context = bot_ctx,
887 891
                                   data  = bot_data,
888 892
                                   sleep = sleep_time,
889
-                                  really_act = not args.simulate ):
893
+                                  really_act = not args.simulate and not args.nopost ):
890 894
                     logger.debug("rule '{}' triggered!".format(rule))
891 895
 
892 896
             except AttributeError: # No triggers() function