diff --git a/b0bot/app.py b/b0bot/app.py new file mode 100644 index 0000000..7984ee2 --- /dev/null +++ b/b0bot/app.py @@ -0,0 +1,33 @@ +from flask import Flask, request +import tweepy + +app = Flask(__name__) + +# Twitter API credentials +consumer_key = "your_consumer_key" +consumer_secret = "your_consumer_secret" +access_token = "your_access_token" +access_token_secret = "your_access_token_secret" + +# Authenticate with Twitter API +auth = tweepy.OAuthHandler(consumer_key, consumer_secret) +auth.set_access_token(access_token, access_token_secret) +api = tweepy.API(auth) + +# Define endpoint for bot +@app.route('/bot', methods=['POST']) +def twitter_bot(): + # Get request data + data = request.get_json() + + # Extract tweet text from data + tweet = data['tweet'] + + # Post tweet + api.update_status(tweet) + + # Return success message + return {"message": "Tweet posted successfully!"} + +if __name__ == '__main__': + app.run(debug=True) diff --git a/b0bot/requirements.txt b/b0bot/requirements.txt new file mode 100644 index 0000000..1d05f08 --- /dev/null +++ b/b0bot/requirements.txt @@ -0,0 +1,17 @@ +certifi==2022.12.7 +charset-normalizer==3.0.1 +click==8.1.3 +colorama==0.4.6 +Flask==2.2.3 +idna==3.4 +importlib-metadata==6.0.0 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.2 +oauthlib==3.2.2 +requests==2.28.2 +requests-oauthlib==1.3.1 +tweepy==4.12.1 +urllib3==1.26.14 +Werkzeug==2.2.3 +zipp==3.15.0 \ No newline at end of file diff --git a/b0bot/run.sh b/b0bot/run.sh new file mode 100644 index 0000000..d01b10f --- /dev/null +++ b/b0bot/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export FLASK_APP=app.py +flask run \ No newline at end of file