From 609e03406388dd6753b27a9b75b77e5dfa3e9412 Mon Sep 17 00:00:00 2001 From: muskit <15199219+muskit@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:40:48 -0700 Subject: [PATCH] cleanup, starting on live listen --- src/listen.py | 4 +++- src/main.py | 2 +- src/structs.py | 6 ------ src/twapi.py | 8 +++++--- 4 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 src/structs.py diff --git a/src/listen.py b/src/listen.py index e2b8dd3..dcaf2f6 100644 --- a/src/listen.py +++ b/src/listen.py @@ -1,5 +1,7 @@ ## The bot's listen mode # Continuously listen for cross-company interactions. -def run(): +import twapi + +async def run(): pass \ No newline at end of file diff --git a/src/main.py b/src/main.py index c45857c..2db1fde 100644 --- a/src/main.py +++ b/src/main.py @@ -47,7 +47,7 @@ async def async_main(): match PROGRAM_ARGS.mode.lower(): case 'l' | 'listen': print('RUNNING IN LISTEN MODE\n') - listen.run() + await listen.run() case 'c' | 'catchup': print('RUNNING IN CATCH-UP MODE\n') await catchup.run(PROGRAM_ARGS) diff --git a/src/structs.py b/src/structs.py deleted file mode 100644 index ed96681..0000000 --- a/src/structs.py +++ /dev/null @@ -1,6 +0,0 @@ -from collections import namedtuple - -class VTweet: - def __init__(self, tweet, users: list): - self.tweet = tweet - self.users = users \ No newline at end of file diff --git a/src/twapi.py b/src/twapi.py index bc14261..c68fc9d 100644 --- a/src/twapi.py +++ b/src/twapi.py @@ -171,15 +171,17 @@ class TwAPI: REPLY = '{0} replied to {1}!\n' QUOTE_TWEET = '{0} quote tweeted {1}!\n' - MENTION = '{0} tweeted with ' + MENTION = '{0} tweeted!\n' def create_text(): author_username = f'@/{util.get_username_online(ttweet.author_id)}' ret = str() if is_catchup: # ret += '[catch-up tweet]\n' + ret += f'{ttweet.get_datetime_str()}\n' pass - ret += f'{ttweet.get_datetime_str()}\n' + + # Tweet types if ttweet.reply_to is not None: # reply (w/ qrt; push it into mentions) reply_username = f'@/{util.get_username_online(ttweet.reply_to)}' ret += REPLY.format(author_username, reply_username) @@ -200,7 +202,7 @@ class TwAPI: if len(mention_ids) > 0: mention_usernames = [f'@/{util.get_username_online(x)}' for x in mention_ids] ret += ( - 'mentions ' + 'mentioning ' f'{" ".join(mention_usernames)}\n' ) ret += f'\n{util.ttweet_to_url(ttweet)}'