{"id":21980045,"url":"https://github.com/parafoxia/chatto","last_synced_at":"2025-04-30T04:35:21.867Z","repository":{"id":45079305,"uuid":"442895432","full_name":"parafoxia/chatto","owner":"parafoxia","description":"A unified API wrapper for YouTube and Twitch chat bots.","archived":false,"fork":false,"pushed_at":"2022-01-22T17:27:31.000Z","size":227,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-17T14:42:39.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://parafoxia.github.io/chatto/chatto/","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/parafoxia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-29T21:33:05.000Z","updated_at":"2024-10-26T18:35:08.000Z","dependencies_parsed_at":"2022-09-05T16:41:33.484Z","dependency_job_id":null,"html_url":"https://github.com/parafoxia/chatto","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parafoxia%2Fchatto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parafoxia%2Fchatto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parafoxia%2Fchatto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parafoxia%2Fchatto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parafoxia","download_url":"https://codeload.github.com/parafoxia/chatto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644262,"owners_count":21620617,"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":[],"created_at":"2024-11-29T17:09:23.690Z","updated_at":"2025-04-30T04:35:21.840Z","avatar_url":"https://github.com/parafoxia.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chatto\n\n[![PyPi version](https://img.shields.io/pypi/v/chatto.svg)](https://pypi.python.org/pypi/chatto/)\n[![Downloads](https://pepy.tech/badge/chatto)](https://pepy.tech/project/chatto)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/parafoxia/chatto/CI?label=ci)](https://github.com/parafoxia/chatto/actions/workflows/ci.yml)\n[![Docs](https://img.shields.io/badge/docs-up-green)](https://parafoxia.github.io/chatto/chatto/)\n[![License](https://img.shields.io/github/license/parafoxia/chatto.svg)](https://github.com/parafoxia/chatto/blob/main/LICENSE)\n\nA unified API wrapper for YouTube and Twitch chat bots.\n\nCPython versions 3.8 through 3.10 and PyPy version 3.8 are officially supported.\n\nWindows, MacOS, and Linux are all supported.\n\n## Installation\n\nTo install the latest stable version of *Chatto*:\n\n```sh\npip install chatto\n\n# If you need types:\npip install \"chatto[types]\"\n```\n\nTo install the latest development version:\n\n```sh\npip install git+https://github.com/parafoxia/chatto\n```\n\nYou may need to prefix these commands with a call to the Python interpreter depending on your OS and Python configuration.\n\n## Setup\n\nBefore you begin, you will need to have a Google Developers project with the YouTube Data API V3 enabled. You need an API key, and if you want to send and delete messages, you will need an OAuth client ID.\n\nI [made a video](https://www.youtube.com/watch?v=1Xday10ZWeg) walking through all the necessary steps.\n\n## Creating a YouTube bot\n\nTo create a simple YouTube bot, you could do something like this:\n\n```py\nimport os\n\nfrom chatto import YouTubeBot\nfrom chatto.events import MessageCreatedEvent\n\nbot = YouTubeBot(\n    # Your project's API key.\n    os.environ[\"API_KEY\"],\n    # The ID of the channel whose stream you want to connect to.\n    os.environ[\"CHANNEL_ID\"],\n    # Your OAuth client ID secrets file.\n    secrets_file=\"secrets.json\",\n)\n\n\n# Listen for MessageCreatedEvents, and run this awaitable whenever a\n# new message is received.\n@bot.listen(MessageCreatedEvent)\nasync def on_message_created(event):\n    # Ignore messages sent by the broadcaster.\n    if event.message.channel.is_owner:\n        return\n\n    # Respond to messages starting with \"!hello\".\n    if event.message.content.startswith(\"!hello\"):\n        await bot.send_message(f\"Hi {event.message.channel.name}!\")\n\n\nif __name__ == \"__main__\":\n    # This is blocking, so should be the last thing you call.\n    bot.run()\n```\n\nChatto relies on the `/search` endpoint to find a live broadcast from a channel, which is not 100% reliable. If you are having major issues getting Chatto to find your channel's live stream, you can pass the stream ID directly:\n\n```py\nbot.run(with_stream_id=os.environ[\"STREAM_ID\"])\n```\n\nIf you don't want to use OAuth, you can launch Chatto in read-only mode. Note that your bot will not be able to send or delete messages in this mode:\n\n```py\nbot.run(read_only=True)\n```\nTo learn how to make more advanced bots, check the [documentation](https://parafoxia.github.io/chatto/chatto/).\n\n## Creating a Twitch bot\n\nTwitch bots are not yet supported.\n\n## Contributing\n\nContributions are very much welcome! To get started:\n\n* Familiarise yourself with the [code of conduct](https://github.com/parafoxia/chatto/blob/main/CODE_OF_CONDUCT.md)\n* Have a look at the [contributing guide](https://github.com/parafoxia/chatto/blob/main/CONTRIBUTING.md)\n\n## License\n\nThe *Chatto* module for Python is licensed under the [BSD 3-Clause License](https://github.com/parafoxia/chatto/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparafoxia%2Fchatto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparafoxia%2Fchatto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparafoxia%2Fchatto/lists"}