{"id":13338914,"url":"https://github.com/HandcartCactus/nlp-bot","last_synced_at":"2025-03-11T11:31:15.915Z","repository":{"id":174503328,"uuid":"350678047","full_name":"HandcartCactus/nlp-bot","owner":"HandcartCactus","description":"An interactive twitter bot that runs a variety of profile analysis commands. Used to be live at https://twitter.com/WhatDoITweetBot. Temporarily offline.","archived":false,"fork":false,"pushed_at":"2021-04-08T15:03:24.000Z","size":131,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-30T20:57:12.016Z","etag":null,"topics":["bot","python","twitter","twitter-bot"],"latest_commit_sha":null,"homepage":"https://twitter.com/WhatDoITweetBot","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HandcartCactus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-03-23T10:58:18.000Z","updated_at":"2022-02-12T21:08:53.000Z","dependencies_parsed_at":"2023-07-28T06:45:32.272Z","dependency_job_id":null,"html_url":"https://github.com/HandcartCactus/nlp-bot","commit_stats":null,"previous_names":["ejjaffe/nlp-bot","handcartcactus/nlp-bot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HandcartCactus%2Fnlp-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HandcartCactus%2Fnlp-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HandcartCactus%2Fnlp-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HandcartCactus%2Fnlp-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HandcartCactus","download_url":"https://codeload.github.com/HandcartCactus/nlp-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221222906,"owners_count":16779888,"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":["bot","python","twitter","twitter-bot"],"created_at":"2024-07-29T19:17:53.025Z","updated_at":"2024-10-23T18:31:58.919Z","avatar_url":"https://github.com/HandcartCactus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TwitterBot\nCode relating to my twitter bot, which can be found [here](https://twitter.com/WhatDoITweetBot).\n\n## Interacting with the bot\nFor more information on interacting with the bot, see `USERGUIDE.md`.\n\n## Setup\n### Fork it!\nFork it.\n### API Tokens\nGet your [Twitter api tokens](https://developer.twitter.com/en/support/twitter-api).\n### Config File\nCreate a copy of `configs/template.ini` as `configs/config.ini` and store your credentials in it.\n### Conda Env\nIn the root directory of the project, create your conda env with `conda env create -f twitterbot.yml`.\n\n### Running The Code\n```bash\nconda activate twitterbot\npython client.py --config configs/config.ini\n```\n\n## Development\n### The Command Class\nTo create commands for your bot:\n1. Create a `Command` subclass using the `Command` Abstract Base Class.\n2. Import the command into `client.py`\n3. Add the command to the `commands_dict` in `client.py` along with a string alias for twitter users.\n\nYour `Command` subclass will recieve:\n1. The Twitter API\n2. The Tweet ID\n3. The User ID\n4. Any text following the command, for parameters.\n\nYour subclass should implement a `reply_tweet()` method that probably calls another method to do a thing, then prepares a response and tweets it back at the user.\n\nFor Example, you might make a class like this:\n\n```python\nclass MyCommand (Command):\n    def _do_something(self):\n        #do something\n        return 100\n\n    def _format_output(self, result):\n        # string format it or whatever\n        return str(result)\n    \n    def reply_tweet(self):\n        something = self._do_something()\n        text = self._format_output(something)\n        self.api.PostUpdate(\n            status=text, \n            in_reply_to_status_id=self.tweet_id, \n            auto_populate_reply_metadata=True\n        )\n```\n\nThen you can add it to `client.py`'s `commands_dict` like this:\n```python\nfrom my_commands import MyCommand\n\ncommands_dict = {\n    'my_command': MyCommand,\n}\n\n```\nAnd you should be good to go!\n## Use\nTweet at your bot using the following format: \"@bot command (params)\"\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHandcartCactus%2Fnlp-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHandcartCactus%2Fnlp-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHandcartCactus%2Fnlp-bot/lists"}