-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub.auto.reply.py
25 lines (20 loc) · 1020 Bytes
/
github.auto.reply.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from replybot.reply_prompt import generate_gpt_prompt
from gpt.gpt_client import use_gpt
from bot.tweet_poster import reply_to_tweet
from accounts.get_credentials import get_twitter_account_details
from bot.auth_provider import get_twitter_client
from replybot.fetch_tweets_to_reply import get_single_elon_tweet
def reply_to_user_tweet(username):
credentials = get_twitter_account_details(username=username)
client = get_twitter_client(account_data=credentials)
elon_tweet=get_single_elon_tweet()
message_content = elon_tweet["message"]
tweet_id = elon_tweet["tweet_id"]
posted_by = elon_tweet["user"]
print(f"\n{posted_by} tweeted: {message_content}\n")
prompt = generate_gpt_prompt(tweet=message_content)
reply_tweet= use_gpt(prompt=prompt)
print(f"Reply message : {reply_tweet}")
reply_to_tweet(client=client, tweet=reply_tweet, tweet_id=tweet_id)
if __name__ == "__main__":
reply_to_user_tweet("poojan_goyani")