aboutsummaryrefslogtreecommitdiffstats
path: root/database.py
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2023-01-20 09:23:52 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2023-01-20 09:23:52 +0000
commit6f4e01ab94b82de3a946bb1d889f061fc8f837c9 (patch)
tree0aeefa222fa0b3d397c5afe38d166efd75c38816 /database.py
parent8a71a51664bdae98057c4ce0178c205047c2f2ed (diff)
downloadeda.gay-6f4e01ab94b82de3a946bb1d889f061fc8f837c9.tar.gz
eda.gay-6f4e01ab94b82de3a946bb1d889f061fc8f837c9.zip
Added getting different twitter accounts for the diary account
Diffstat (limited to 'database.py')
-rwxr-xr-xdatabase.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/database.py b/database.py
index ff769a0..d8cfe86 100755
--- a/database.py
+++ b/database.py
@@ -185,6 +185,9 @@ class Database:
cursor.execute("SELECT link FROM headerLinks WHERE name = 'twitter';")
return cursor.fetchone()[0]
+ def get_my_diary_twitter(self):
+ return self.config.get("twitter", "diary_account")
+
def get_iso_cd_options(self):
iso_dir = self.config.get("cds", "location")
return [
@@ -239,7 +242,7 @@ class Database:
cursor.execute("SELECT link FROM diaryimages WHERE tweet_id = %s;", (tweet_id, ))
return [i[0] for i in cursor.fetchall()]
- def get_child_tweets(self, parent_id, twitteracc = "FUCKEDUPTRANNY"):
+ def get_child_tweets(self, parent_id):
with self.__connection.cursor() as cursor:
cursor.execute("SELECT tweet_id, tweet FROM diary WHERE replying_to = %s;", (parent_id, ))
out = cursor.fetchall()
@@ -248,14 +251,22 @@ class Database:
out = out[0]
id_ = out[0]
- return {"text": out[1], "images": self.get_diary_image(id_), "link": "https://%s/%s/status/%d" % (self.config.get("nitter", "domain"), twitteracc, id_)}, id_
+ return {
+ "text": out[1],
+ "images": self.get_diary_image(id_),
+ "link": "https://%s/%s/status/%d" % (
+ self.config.get("nitter", "domain"), self.get_my_diary_twitter(), id_
+ )
+ }, id_
def get_newest_diary_tweet_id(self):
with self.__connection.cursor() as cursor:
cursor.execute("SELECT MAX(tweet_id) FROM diary;")
return cursor.fetchone()[0]
- def fetch_diary(self, twitteracc = "FUCKEDUPTRANNY"):
+ def fetch_diary(self):
+ twitteracc = self.get_my_diary_twitter()
+
twitter = twython.Twython(*dict(dict(self.config)["twitter"]).values())
for tweet in twitter.search(q = "(from:%s)" % twitteracc, since_id = self.get_newest_diary_tweet_id())["statuses"]:
tweet_id = tweet["id"]