You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open for discussion, but the idea is that we implement the bot as a time-based cloud function that can read tweets @ it every n seconds. It then formulates a reply based on the open AI assistant and sends that back, mentioning the original x user
here is a a very poor man's idea to get tweets @ numaindapk every 5 minutes:
fromdatetimeimportdatetime, timedelta# Twitter API v2 endpoint for recent searchurl='https://api.twitter.com/2/tweets/search/recent'end_time=datetime.utcnow() -timedelta(minutes=5)
end_time_str=end_time.strftime('%Y-%m-%dT%H:%M:%SZ')
# Replace 'your_bot_username' with your bot's actual username without @params= {
'query': '@numaindapk',
'tweet.fields': 'author_id,created_at',
# Use a fixed start time'start_time': '2024-02-08T00:00:00Z',
# Dynamically calculated end_time based on current time'end_time': end_time_str,
}
response=oauth.get(url, params=params)
tweets=response.json()
# Print the tweets to verifyprint(json.dumps(tweets, indent=4))
The text was updated successfully, but these errors were encountered:
Open for discussion, but the idea is that we implement the bot as a time-based cloud function that can read tweets @ it every n seconds. It then formulates a reply based on the open AI assistant and sends that back, mentioning the original x user
here is a a very poor man's idea to get tweets @ numaindapk every 5 minutes:
The text was updated successfully, but these errors were encountered: