From 6b34a7077a1ef0c0280302dafdb3c5f161432d53 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Wed, 14 Aug 2024 20:53:16 -0400 Subject: [PATCH] removed twitter integration --- twitHandler.py | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 twitHandler.py diff --git a/twitHandler.py b/twitHandler.py deleted file mode 100644 index 32f9b8d..0000000 --- a/twitHandler.py +++ /dev/null @@ -1,45 +0,0 @@ -import tweepy, os, json, player - -dataDir = "Data" - -class TwitHandler(object): - """Twitter connection handler class""" - api = tweepy.Client() - - def __init__(self): - path = os.path.join(dataDir, "Twitter.keys") - if os.path.exists(path): - with open(path) as keysFile: - bearerToken, consumerKey, consumerSecret, accessKey, accessSecret = [line.strip() for line in keysFile.readlines()] - else: - raise FileNotFoundError - self.api = tweepy.Client(bearerToken, consumerKey, consumerSecret, accessKey, accessSecret) - - def scanForMention(self, lastRepliedID): - mentions = self.api.get_users_mentions(1479541275862908928, since_id=lastRepliedID, max_results=20) - if mentions.data is None or len(mentions.data) == 0: - return - - for mention in reversed(mentions.data): #do oldest first - lastID = mention.id - - if "rate " in mention.text.lower(): - try: - name = mention.text.split("rate ",1)[1] - self.sendTextReply(player.Player(name).twitterString(), mention) - except: - print("Tweet already replied to.") - - with open(os.path.join(dataDir, "lastID.twt"), 'w') as file: - file.write(str(lastID+1)) - - - - def sendTextTweet(self, text:str): - self.api.create_tweet(text=text) - - def sendTextReply(self, text:str, prevTweet): - self.api.create_tweet(in_reply_to_tweet_id=prevTweet.id, text=text) - - def changeBio(self, newText): - pass #awaiting API v1 permission \ No newline at end of file