Update main.py
Browse files
main.py
CHANGED
@@ -85,17 +85,30 @@ def reply_to_mentions():
|
|
85 |
return
|
86 |
|
87 |
for mention in reversed(mentions.data):
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
continue
|
100 |
|
101 |
try:
|
|
|
85 |
return
|
86 |
|
87 |
for mention in reversed(mentions.data):
|
88 |
+
try:
|
89 |
+
if mention.author_id == 1612106815096999936:
|
90 |
+
continue
|
91 |
+
|
92 |
+
if mention.referenced_tweets is None:
|
93 |
+
logger.info(f"Skipping {mention.id} as it is not a reply")
|
94 |
+
tweet_to_roast_id = mention.referenced_tweets[0].id
|
95 |
+
tweet_to_roast = client.get_tweet(id=tweet_to_roast_id)
|
96 |
+
text_to_roast = tweet_to_roast.data.text
|
97 |
+
|
98 |
+
text_out = None
|
99 |
+
text_in = mention.text.lower()
|
100 |
+
text_in.replace('@roastortoastgpt', '')
|
101 |
+
text_in.replace('roastortoastgpt','')
|
102 |
+
|
103 |
+
if "roast" in text_in:
|
104 |
+
text_out = roast(text_to_roast)
|
105 |
+
elif "toast" in text_in:
|
106 |
+
text_out = toast(text_to_roast)
|
107 |
+
|
108 |
+
if text_out is None:
|
109 |
+
continue
|
110 |
+
except Exception as e:
|
111 |
+
logger.error(e)
|
112 |
continue
|
113 |
|
114 |
try:
|