AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
twitter_send_tweets_command
DaoAdvocatecfba3d0a606d
diff --git a/autogpt/app.py b/autogpt/app.pyindex e84241c549..40a71c8e37 100644--- a/autogpt/app.py+++ b/autogpt/app.py@@ -23,6 +23,7 @@ from autogpt.processing.text import summarize_textfrom autogpt.speech import say_textfrom autogpt.commands.web_selenium import browse_websitefrom autogpt.commands.git_operations import clone_repository+from autogpt.commands.twitter import send_tweetCFG = Config()@@ -181,6 +182,8 @@ def execute_command(command_name: str, arguments):)elif command_name == "generate_image":return generate_image(arguments["prompt"])+ elif command_name == "send_tweet":+ return send_tweet(arguments['text'])elif command_name == "do_nothing":return "No action performed."elif command_name == "task_complete":diff --git a/autogpt/commands/twitter.py b/autogpt/commands/twitter.pynew file mode 100644index 0000000000..31781ee31b--- /dev/null+++ b/autogpt/commands/twitter.py@@ -0,0 +1,25 @@+import tweepy+import os+from dotenv import load_dotenv++load_dotenv()++def send_tweet(tweet_text):++ consumer_key = os.environ.get("TW_CONSUMER_KEY")+ consumer_secret= os.environ.get("TW_CONSUMER_SECRET")+ access_token= os.environ.get("TW_ACCESS_TOKEN")+ access_token_secret= os.environ.get("TW_ACCESS_TOKEN_SECRET")+ # Authenticate to Twitter+ auth = tweepy.OAuthHandler(consumer_key, consumer_secret)+ auth.set_access_token(access_token, access_token_secret)++ # Create API object+ api = tweepy.API(auth)++ # Send tweet+ try:+ api.update_status(tweet_text)+ print("Tweet sent successfully!")+ except tweepy.TweepError as e:+ print("Error sending tweet: {}".format(e.reason))diff --git a/autogpt/prompt.py b/autogpt/prompt.pyindex 6c51f33e96..a760bd7274 100644--- a/autogpt/prompt.py+++ b/autogpt/prompt.py@@ -82,6 +82,8 @@ def get_prompt() -> str:),("Execute Python File", "execute_python_file", {"file": "<file>"}),("Generate Image", "generate_image", {"prompt": "<prompt>"}),+ ("Send Tweet", "send_tweet", {"text": "<text>"}),+]# Only add shell command to the prompt if the AI is allowed to execute it