From 65b554f014d15e2e09601a224f62c29bb70169b4 Mon Sep 17 00:00:00 2001 From: msk <15199219+muskit@users.noreply.github.com> Date: Sat, 1 Oct 2022 14:09:14 -0700 Subject: [PATCH] remove unneccessary/misplaced error check --- README.md | 18 +++++++----------- {twitter profile => images}/banner.png | Bin {twitter profile => images}/banner.xcf | Bin {twitter profile => images}/logo.xcf | Bin src/listen.py | 12 +++++------- src/twapi.py | 3 ++- 6 files changed, 14 insertions(+), 19 deletions(-) rename {twitter profile => images}/banner.png (100%) rename {twitter profile => images}/banner.xcf (100%) rename {twitter profile => images}/logo.xcf (100%) diff --git a/README.md b/README.md index 690916b..cfc1055 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # NijiHolo EN/ID Bot -*Twitter bot that follows interactions between Nijisanji EN/ID and hololive EN/ID members.* -...because some folks are that desperate. Like me! +*Twitter bot that tracks interactions between Nijisanji EN/ID and hololive EN/ID members.* + +![The project banner](images/banner.png) **This project is intended to run [this account](https://twitter.com/NijiHolo_EN_ID).** @@ -11,15 +12,8 @@ The bot will be runnable in three modes: * may implement short-term catch-up function * Command-line (`cmd`): an interactive mode for manual control (TBA; currently drops into Python interpretor) -## Roadmap -* ~~Read past tweets of members from both companies~~ -* ~~Create screenshot of tweet~~ -* ~~Track tweets in queue files~~ -* ~~Post tweets along with screenshot of tweet~~ - * Include screenshot of tweet being replied to? -* ~~Combine image with quote tweet~~ -* ~~Don't tweet already-existing tweets (check our past quote tweets; might be saved in a file for quicker access)~~ -* Track posted tweets in a history file +## Extra TODOs +* Include screenshot of tweet being replied to ## Notes * Tweets should only occur if involved parties are cross-company @@ -28,3 +22,5 @@ The bot will be runnable in three modes: * Our tweets should include: * involved names (w/o @) and the tweet (as a quote tweet) * screenshot of the tweet (+ maybe image of tweet being replied to when applicable) + +**This project was created for entertainment purposes. It is not to be used for malicious purposes.** diff --git a/twitter profile/banner.png b/images/banner.png similarity index 100% rename from twitter profile/banner.png rename to images/banner.png diff --git a/twitter profile/banner.xcf b/images/banner.xcf similarity index 100% rename from twitter profile/banner.xcf rename to images/banner.xcf diff --git a/twitter profile/logo.xcf b/images/logo.xcf similarity index 100% rename from twitter profile/logo.xcf rename to images/logo.xcf diff --git a/src/listen.py b/src/listen.py index e0b64da..b3cec26 100644 --- a/src/listen.py +++ b/src/listen.py @@ -10,16 +10,14 @@ import api_secrets import talent_lists as tl def on_response(resp): - try: - ttweet = TalentTweet.create_from_v2api_response(resp) - except ValueError as e: - if "insufficient other parties" in str(e): - print('Tweet has no other parties, probably not a cross-company interaction.') - return + id = resp.data.id + ttweet = TalentTweet.create_from_v2api_response(resp) if ttweet.is_cross_company(): - print('Tweet is cross-company! Creating post...') + print(f'Tweet {id} is cross-company! Creating post...') asyncio.run(TwAPI.instance.post_ttweet(ttweet)) + else: + print(f'Tweet {id} is not cross-company.') def run(): sc = tweepy.StreamingClient(api_secrets.bearer_token()) diff --git a/src/twapi.py b/src/twapi.py index ca4aa3a..5fdc126 100644 --- a/src/twapi.py +++ b/src/twapi.py @@ -1,4 +1,3 @@ -import asyncio import datetime import traceback @@ -48,6 +47,8 @@ class TwAPI: try: mentions.remove(reply_to) + except: pass + try: mentions.remove(qrt) except: pass