{"id":13660904,"url":"https://github.com/russss/polybot","last_synced_at":"2025-07-26T11:31:11.930Z","repository":{"id":19681326,"uuid":"87641636","full_name":"russss/polybot","owner":"russss","description":"A framework for building robust social media bots for multiple networks in Python","archived":false,"fork":false,"pushed_at":"2024-12-08T11:37:01.000Z","size":2334,"stargazers_count":53,"open_issues_count":3,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-02T11:15:02.907Z","etag":null,"topics":["bluesky","bot","mastodon","python","python3","twitter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/russss.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-08T14:56:28.000Z","updated_at":"2025-03-12T20:04:33.000Z","dependencies_parsed_at":"2024-11-12T18:03:51.947Z","dependency_job_id":"34d3eafb-595d-48bc-939e-2553f1b9a6ad","html_url":"https://github.com/russss/polybot","commit_stats":{"total_commits":53,"total_committers":5,"mean_commits":10.6,"dds":"0.28301886792452835","last_synced_commit":"22021efe6409e815a4f67c37f8b6b797aa0665ef"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/russss/polybot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russss%2Fpolybot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russss%2Fpolybot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russss%2Fpolybot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russss%2Fpolybot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/russss","download_url":"https://codeload.github.com/russss/polybot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russss%2Fpolybot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502387,"owners_count":23618587,"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":["bluesky","bot","mastodon","python","python3","twitter"],"created_at":"2024-08-02T05:01:27.235Z","updated_at":"2025-07-26T11:31:11.872Z","avatar_url":"https://github.com/russss.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![PyPI version](https://badge.fury.io/py/polybot.svg)](https://badge.fury.io/py/polybot)\n\n# Polybot\n\nPolybot is a simple framework for building robust social media bots for multiple networks in Python.\n\n## Features\n\n* Automatically post to X/Twitter, Mastodon, Bluesky.\n* A friendly command-line setup interface to handle the authentication hassle for you.\n* Automatic state persistence - just put your state in the `self.state`\n  dict and it'll get saved/restored across runs.\n* Graceful handling of different post length limits and image upload sizes between services.\n\nX/Twitter support is no longer regularly tested as the authors no longer use it. Reliability can't\nbe guaranteed but pull requests are welcome.\n\n## Limitations/Wishlist\n\n* Polybot currently doesn't have support for receiving messages, so it's only useful for post-only\n  bots.\n\n## Getting started\nInstall Polybot [from PyPi](https://pypi.org/project/polybot/) using your package manager of choice.\n\n```python\nfrom polybot import Bot\n\nclass HelloWorldBot(Bot):\n  def main(self):\n    while True:\n      self.post(\"Hello World\")\n      sleep(300)\n\nHelloWorldBot('helloworldbot').run()\n```\n\nTo configure the accounts the bot uses, just run:\n\n    ./helloworldbot.py --setup\n\nYou'll be guided through authenticating and a config file will be automatically created.\n\nUse the `--profile [name]` to save and use a specific state/config.\n\nBy default, the bot will run in development mode, where it doesn't actually post to services. To run\nin live mode, pass the `--live` flag.\n\n### Images\n\nOne or more images can be attached by creating an [`Image` object](./polybot/image.py), which can be\ncreated from a path, a file object, or `bytes`.\n\n```python\nfrom polybot import Image\n\nself.post(\"Hello World\",\n  images=[Image(path=\"/path/to/image\", mime_type=\"image/png\", description=\"Alt text\")]\n)\n```\n\nImages are automatically resized to below the maximum allowable size on each platform.\n\n### Handling post length limitations\n\nServices have differing post length limits, so a list of messages can be passed to the `post` method,\nand Polybot will choose the longest message which is supported by each configured service.\n\n```python\nself.post([\"This is a short message\", \"This is a much longer message......\"])\n```\n\nAlternatively, the `wrap` argument can be used to split a message into multiple posts:\n\n```python\nself.post(\"Long message...\", wrap=True)\n```\n\n## State management\n\nPolybot provides a dictionary at `self.state` where your bot can store any data which needs to be\npersisted, to avoid repeating posts.\n\nThe state dictionary is serialised to a file called `\u003cbot_name\u003e.state` in the local directory.\nThis automatically happens when the process is terminated, but you can also trigger this\nby calling `self.save_state()`, or by sending the process a `SIGHUP` signal.\n\n## Bots which use Polybot\n\n* [@dscovr_epic](https://bot.country/@dscovr_epic)\n* [Matthew's bots](https://github.com/dracos/scheduler)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussss%2Fpolybot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frussss%2Fpolybot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussss%2Fpolybot/lists"}