laying down the groundwork

This commit is contained in:
msk
2022-09-10 01:21:19 -05:00
parent 335d73a77e
commit 79fdf9431d
3 changed files with 29 additions and 18 deletions
+19 -14
View File
@@ -1,23 +1,18 @@
import sys
import argparse
from argparse import RawTextHelpFormatter
import TwitterAPI as api
import catchup as catchup
HELP_TEXT = \
'''OPTIONS:
-h Displays this help text.
-c, --catchup Scan all tweets from all accounts and makes posts all cross-company
interactions found.
-l, --listern Listen for all new tweets from all accounts.
'''
import secrets
import catchup
import listen
def init_argparse():
p = argparse.ArgumentParser(description='Twitter bot that follows interactions between Nijisanji EN/ID and hololive EN/ID members.', formatter_class=RawTextHelpFormatter)
p.add_argument('mode', nargs='?', \
help='mode to run the bot at:\n\
l,listen: (default) listen for new tweets from all accounts; will not terminate unless error occurs\n\
l,listen: listen for new tweets from all accounts; will not terminate unless error occurs\n\
c,catchup: scan all tweets from all accounts; will terminate when done')
p.add_argument('--show-tokens', action='store_true', help='[DO NOT USE IN PUBLIC SETTING] print stored tokens from secrets.ini')
return p
def main():
@@ -27,13 +22,23 @@ def main():
return
args = parser.parse_args()
print(args.mode)
match args.mode:
if args.show_tokens:
print(secrets.get_all_secrets())
if args.mode is None: return
# determine running mode
match args.mode.lower():
case 'l' | 'listen':
print('LISTEN MODE')
print('LISTEN MODE\n')
catchup.run()
case 'c' | 'catchup':
print('CATCH-UP MODE')
print('CATCH-UP MODE\n')
listen.run()
case _:
print('\ninvalid mode. run with no arguments for help page, including mode list.')
return
if __name__ == "__main__":