api, talent list structures
This commit is contained in:
+21
-9
@@ -2,19 +2,22 @@ import sys
|
||||
import argparse
|
||||
from argparse import RawTextHelpFormatter
|
||||
|
||||
import talent_lists
|
||||
import secrets
|
||||
import catchup
|
||||
import listen
|
||||
|
||||
from api import API
|
||||
import util
|
||||
from api import TwAPI
|
||||
from util import is_cross_company, print_tweet
|
||||
|
||||
MODES_HELP_STR = '''mode to run the bot at:
|
||||
l,listen: listen for new tweets from all accounts; will not terminate unless error occurs
|
||||
c,catchup: scan all tweets from all accounts; will terminate when done'''
|
||||
|
||||
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: 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')
|
||||
help=MODES_HELP_STR)
|
||||
p.add_argument('--show-tokens', action='store_true', help='[DO NOT USE IN PUBLIC SETTING] print stored tokens from secrets.ini')
|
||||
return p
|
||||
|
||||
@@ -31,11 +34,20 @@ def main():
|
||||
|
||||
if args.mode is None: return
|
||||
|
||||
util.twAPI = API()
|
||||
resp = util.twAPI.get_user_tweets(1390620618001838086, count=5)
|
||||
print(resp.data)
|
||||
## We expect to run in some mode now.
|
||||
|
||||
# determine running mode
|
||||
# Initialize shared API instance
|
||||
twApi = TwAPI.instance = TwAPI()
|
||||
|
||||
# Initialize talent account lists
|
||||
talent_lists.init()
|
||||
|
||||
## TEST CODE ##
|
||||
cross_pairs = twApi.get_users_cross_tweets_mentions(1390620618001838086)
|
||||
for pair in cross_pairs:
|
||||
print_tweet(pair)
|
||||
|
||||
## Determine running mode
|
||||
match args.mode.lower():
|
||||
case 'l' | 'listen':
|
||||
print('RUNNING IN LISTEN MODE\n')
|
||||
|
||||
Reference in New Issue
Block a user