cleanup, starting on live listen

This commit is contained in:
muskit
2022-09-27 17:40:48 -07:00
committed by msk
parent 4f53bda1f8
commit 609e034063
4 changed files with 9 additions and 11 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
## The bot's listen mode ## The bot's listen mode
# Continuously listen for cross-company interactions. # Continuously listen for cross-company interactions.
def run(): import twapi
async def run():
pass pass
+1 -1
View File
@@ -47,7 +47,7 @@ async def async_main():
match PROGRAM_ARGS.mode.lower(): match PROGRAM_ARGS.mode.lower():
case 'l' | 'listen': case 'l' | 'listen':
print('RUNNING IN LISTEN MODE\n') print('RUNNING IN LISTEN MODE\n')
listen.run() await listen.run()
case 'c' | 'catchup': case 'c' | 'catchup':
print('RUNNING IN CATCH-UP MODE\n') print('RUNNING IN CATCH-UP MODE\n')
await catchup.run(PROGRAM_ARGS) await catchup.run(PROGRAM_ARGS)
-6
View File
@@ -1,6 +0,0 @@
from collections import namedtuple
class VTweet:
def __init__(self, tweet, users: list):
self.tweet = tweet
self.users = users
+5 -3
View File
@@ -171,15 +171,17 @@ class TwAPI:
REPLY = '{0} replied to {1}!\n' REPLY = '{0} replied to {1}!\n'
QUOTE_TWEET = '{0} quote tweeted {1}!\n' QUOTE_TWEET = '{0} quote tweeted {1}!\n'
MENTION = '{0} tweeted with ' MENTION = '{0} tweeted!\n'
def create_text(): def create_text():
author_username = f'@/{util.get_username_online(ttweet.author_id)}' author_username = f'@/{util.get_username_online(ttweet.author_id)}'
ret = str() ret = str()
if is_catchup: if is_catchup:
# ret += '[catch-up tweet]\n' # ret += '[catch-up tweet]\n'
pass
ret += f'{ttweet.get_datetime_str()}\n' ret += f'{ttweet.get_datetime_str()}\n'
pass
# Tweet types
if ttweet.reply_to is not None: # reply (w/ qrt; push it into mentions) if ttweet.reply_to is not None: # reply (w/ qrt; push it into mentions)
reply_username = f'@/{util.get_username_online(ttweet.reply_to)}' reply_username = f'@/{util.get_username_online(ttweet.reply_to)}'
ret += REPLY.format(author_username, reply_username) ret += REPLY.format(author_username, reply_username)
@@ -200,7 +202,7 @@ class TwAPI:
if len(mention_ids) > 0: if len(mention_ids) > 0:
mention_usernames = [f'@/{util.get_username_online(x)}' for x in mention_ids] mention_usernames = [f'@/{util.get_username_online(x)}' for x in mention_ids]
ret += ( ret += (
'mentions ' 'mentioning '
f'{" ".join(mention_usernames)}\n' f'{" ".join(mention_usernames)}\n'
) )
ret += f'\n{util.ttweet_to_url(ttweet)}' ret += f'\n{util.ttweet_to_url(ttweet)}'