{"id":21065270,"url":"https://github.com/anniedotexe/rnn-twitter-bot","last_synced_at":"2026-03-03T14:33:43.670Z","repository":{"id":125313633,"uuid":"290427795","full_name":"anniedotexe/RNN-Twitter-Bot","owner":"anniedotexe","description":"🤖✏️ A Twitter bot written in Python trained with a recurrent neural network. ","archived":false,"fork":false,"pushed_at":"2023-02-02T14:54:19.000Z","size":225,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T09:04:15.039Z","etag":null,"topics":["automation","bot","colaboratory","python","python-3","python3","recurrent-neural-network","recurrent-neural-networks","rnn","rnn-tensorflow","text-generation","textgenrnn","textgenrnn-colaboratory-notebook","tweet-bot","tweetbot","twitter","twitter-bot","twitterbot"],"latest_commit_sha":null,"homepage":"https://twitter.com/dickinson_rnn","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anniedotexe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-26T07:32:05.000Z","updated_at":"2023-03-04T02:23:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"40d6c6d2-a382-48b9-a55e-134a24fe27a8","html_url":"https://github.com/anniedotexe/RNN-Twitter-Bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anniedotexe/RNN-Twitter-Bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anniedotexe%2FRNN-Twitter-Bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anniedotexe%2FRNN-Twitter-Bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anniedotexe%2FRNN-Twitter-Bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anniedotexe%2FRNN-Twitter-Bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anniedotexe","download_url":"https://codeload.github.com/anniedotexe/RNN-Twitter-Bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anniedotexe%2FRNN-Twitter-Bot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262172368,"owners_count":23269993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","bot","colaboratory","python","python-3","python3","recurrent-neural-network","recurrent-neural-networks","rnn","rnn-tensorflow","text-generation","textgenrnn","textgenrnn-colaboratory-notebook","tweet-bot","tweetbot","twitter","twitter-bot","twitterbot"],"created_at":"2024-11-19T17:54:35.543Z","updated_at":"2026-03-03T14:33:43.658Z","avatar_url":"https://github.com/anniedotexe.png","language":"Python","funding_links":["https://www.buymeacoffee.com/anniedotexe"],"categories":[],"sub_categories":[],"readme":"# RNN Twitter Bot :robot::pencil2:\n\n[![Python 3.6 | 3.7](https://img.shields.io/badge/python-3.6%20|%203.7-yellowgreen)](https://www.python.org/downloads/release/python-379/)\n[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/Naereen/badges/)\n\nA Twitter bot written in Python. The recurrent neural network Twitter bot tweets generated text with a temperature of 0.7 from the trained model.\n\n### Important Notice\n\u003cblockquote class=\"twitter-tweet\" data-lang=\"en\"\u003e\u003cp lang=\"en\" dir=\"ltr\"\u003eStarting February 9, we will no longer support free access to the Twitter API, both v2 and v1.1. A paid basic tier will be available instead 🧵\u003c/p\u003e\u0026mdash; Twitter Dev (\u003ca href=\"https://twitter.com/TwitterDev/status/1621026986784337922?ref_src=twsrc%5Etfw\"\u003e@TwitterDev\u003c/a\u003e) February 2, 2023\u003c/blockquote\u003e\n\n---\n\n### Table of Contents\n\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n    - [To Train the Model](#to-train-the-model)\n    - [To Run the Bot](#to-run-the-bot)\n- [Instructions](#instructions)\n  - [File Structure](#file-structure)\n- [Contributing](#contributing)\n- [Creator / Maintainer](#creator--maintainer)\n- [Acknowledgments](#acknowledgments)\n- [Additional Information](#additional-information)\n\n---\n\n## Getting Started\n\nMake sure to follow [Twitter's Automation Rules](https://help.twitter.com/en/rules-and-policies/twitter-automation) to avoid getting your account banned.\n\n### Prerequisites\n\n#### To Train the Model\n\n- [textgenrnn Colaboratory Notebook](https://colab.research.google.com/drive/1mMKGnVxirJnqDViH7BDJxFqWrsXlPSoK) - easily train your own text-generating neural network of any size and complexity for free on a GPU using Colaboratory\n\n#### To Run the Bot\n\n- [Python 3.6 or 3.7](https://www.python.org/downloads/release/python-379/)\n- [Pip](https://pypi.org/project/pip/) - a python package manager\n  - Download this [file](https://bootstrap.pypa.io/get-pip.py), open a command prompt and navigate to the folder containing the `get-pip.py` installer, and run `python get-pip.py` to install\n    - Run `pip --version` to check if it has installed correctly\n- [Tweepy](http://docs.tweepy.org/en/latest/index.html) - an easy-to-use python library for accessing Twitter's API\n  - Run `pip install tweepy`\n- [textgenrnn](https://github.com/minimaxir/textgenrnn) - a python3 module to easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code, or quickly train on a text using a pretrained model\n  - Run `pip install textgenrnn`\n\n---\n\n## Instructions\n\n1. Apply for [Twitter Developer Access](https://developer.twitter.com/en/apply-for-access) with the account you want the bot to be used for.\n\n2. Create a new [Twitter Application](https://developer.twitter.com/app/new) to generate your private keys, secrets, and tokens.\n\n![Keys and Secrets](resources-for-readme/keys-secrets.png)\n\n- Make sure the app settings has _Read and Write_ permissions.\n\n![App Permissions](resources-for-readme/app-permissions.png)\n\n3. Create a file named `credentials.py` to hold your private information using the format below.\n   - See [File Structure](#file-structure).\n\n```\nTWITTER_API_KEY=\"xxxx\"\nTWITTER_API_KEY_SECRET=\"xxxx\"\nTWITTER_ACCESS_TOKEN=\"xxxx\"\nTWITTER_ACCESS_TOKEN_SECRET=\"xxxx\"\n```\n\n4. Adjustments you can make in `config.py` to tweak the bot to your liking. _(Make sure to follow [Twitter's Automation Rules](https://help.twitter.com/en/rules-and-policies/twitter-automation) to avoid getting your account banned.)_\n\n   - **model_name** - (_MUST CHANGE_) Name of the model used for the weights and configuration files you downloaded from Colaboratory.\n     ![Model Name](resources-for-readme/model-name.png)\n   - **temperature** - Level of randomness for the predicted text. Higher temperature will generate crazier text.\n   - **prefix** - Set a prefix if you want each generated text to start with a given seed text.\n   - **n** - Number of texts to generate.\n   - **max_gen_length** - Maximum number of characters for each text generated.\n   - **max_tweet_length** - Maximum number of characters for each tweet to have.\n     - If the generated text is too long, it will be split into multiple tweets at this length.\n     - Set to 280 (Twitter's character limit for tweets) if you are not adding anything to the end of the tweets.\n   - **add_to_tweet** - Optional if you want to add text to end of every tweet.\n     - Set to None if you do not want to use.\n   - **delay** - Time to wait in between each tweet in seconds.\n   - **min_tweet_length** - Minimum number of characters in the tweet, will ignore tweets that are not long enough.\n     - Set to 0 if this is not relevant to you.\n\n5. Use the [textgenrnn Colaboratory Notebook](https://colab.research.google.com/drive/1mMKGnVxirJnqDViH7BDJxFqWrsXlPSoK) to train your RNN.\n\n   - See [Additional Information](#additional-information) for more details.\n\n6. Download the weights and configuration files from the Colaboratory Notebook (as shown below) and put them in the `model` directory\n   - See [File Structure](#file-structure).\n\n![Download Weight and Config Files](resources-for-readme/download-files.png)\n\n7. Install all required packages needed to run the script\n\n```\npip install -r requirements.txt\n```\n\n8. Run the script. Enjoy your Twitter bot!\n\n```\npython twitter-ai-bot.py\n```\n\n### File Structure\n\n```\nRNN-Twitter-Bot\n|-- model\n|   |-- yourmodelname_config.json\n|   |-- yourmodelname_vocab.json\n|   `-- yourmodelname_weights.hdf5\n|-- credentials.py\n`-- twitter-ai-bot.py\n```\n\n---\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.\n\n### How To Contribute\n\n1. Fork the repository to your own Github account.\n2. Clone the project to your machine.\n3. Create a branch locally with a succinct but descriptive name.\n4. Commit changes to the branch.\n5. Following any formatting and testing guidelines specific to this repo.\n6. Push changes to your fork.\n7. Open a Pull Request in my repository.\n\n---\n\n## Creator\n\nAnnie Wu ([anniedotexe](https://github.com/anniedotexe))\n\nCopyright \u0026copy; 2021-2026 Annie Wu. All rights reserved.\n\nI do not maintain this code anymore and will not respond to any questions sent to me.\n\nIf you like my content or find this code useful, give it a ⭐ or support me by buying me a coffee ☕💙\n\n\u003ca href=\"https://www.buymeacoffee.com/anniedotexe\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n\n---\n\n## Acknowledgments\n\n- [Max Woolf](https://minimaxir.com/)\n  - creator of [textgenrnn](https://github.com/minimaxir/textgenrnn)\n  - creator of the [textgenrnn Colaboratory Notebook](https://colab.research.google.com/drive/1mMKGnVxirJnqDViH7BDJxFqWrsXlPSoK) that allows us to quickly train the RNN with a GPU for free\n\n---\n\n## Additional Information\n\n- textgenrnn\n  - [Max Woolf's YouTube Video on Training a Text-Generating Neural Network for Free with textgenrnn](https://www.youtube.com/watch?v=RW7mP6BfZuY)\n  - [Max Woolf's Blog Post on How to Quickly Train a Text-Generating Neural Network for Free](https://minimaxir.com/2018/05/text-neural-networks/)\n  - [Max Woolf's Demo of using the Colaboratory Notebook](https://github.com/minimaxir/textgenrnn/blob/master/docs/textgenrnn-demo.ipynb)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanniedotexe%2Frnn-twitter-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanniedotexe%2Frnn-twitter-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanniedotexe%2Frnn-twitter-bot/lists"}