Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DaCasBe/TwitchPy
TwitchPy is a Python package for using the Twitch's API and create bots for interacting with their IRC chats.
https://github.com/DaCasBe/TwitchPy
api bot irc irc-bot irc-client package python python-twitch-api python3 twitch twitch-api twitch-bot twitchpy
Last synced: 27 days ago
JSON representation
TwitchPy is a Python package for using the Twitch's API and create bots for interacting with their IRC chats.
- Host: GitHub
- URL: https://github.com/DaCasBe/TwitchPy
- Owner: DaCasBe
- License: gpl-3.0
- Created: 2020-10-31T19:36:32.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-15T19:31:08.000Z (3 months ago)
- Last Synced: 2024-09-24T09:23:41.649Z (3 months ago)
- Topics: api, bot, irc, irc-bot, irc-client, package, python, python-twitch-api, python3, twitch, twitch-api, twitch-bot, twitchpy
- Language: Python
- Homepage:
- Size: 1.08 MB
- Stars: 32
- Watchers: 6
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-twitch-dev - DaCasBe/TwitchPy - This is a package you can use to connect with the Twitch API, manage a channel, create bots, etc. (Libraries / Python)
README
# TwitchPy
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-green.svg)](https://github.com/DaCasBe/TwitchPy/blob/master/LICENSE)
[![Formatter: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Pypi downloads](https://img.shields.io/pypi/dm/twitchpy?color=blue)](https://pypi.org/project/twitchpy)TwitchPy is a Python package for using the Twitch's API and create bots for interacting with their IRC chats.
## Documentation
Click [here](https://dacasbe.github.io/TwitchPy/) to see the official documentation.
## Installation
TwitchPy requires Python 3.10 or higher. You can download the latest version of Python [here](https://www.python.org/downloads/).
~~~
pip install twitchpy
~~~## Getting started
A basic bot.
~~~```python
from datetime import datetimefrom twitchpy.bot import Bot
bot = Bot(
"your_oauth_token",
"your_client_id",
"your_client_secret",
"your_redirect_uri",
"tokens_file_path",
"login_of_your_bot",
["channels_list_to_read_from"],
"!",
)time = datetime.now()
def example_check():
global timetime_diff = datetime.now() - time
if time_diff.seconds >= 5:
bot.me("any_channel_login", "This message is sent every 5 seconds")
time = datetime.now()def example_listener(message):
if message.user is not None:
bot.me("any_channel_login", f"{message.user} said: {message.text}")def example_command(message):
bot.me("any_channel_login", f"{message.user} is who called me")bot.add_check("example_check", example_check)
bot.add_listener("example_listener", example_listener)
bot.add_command("example_command", example_command)bot.run()
~~~## Contributing
TwitchPy currently uses the Black formatter to enforce sensible style formatting.
Before creating a pull request it is encouraged you install and run black on your code.
The line length limit for TwitchPy is 88.
For installation and usage of Black visit: [Black Formatter](https://black.readthedocs.io/en/stable/usage_and_configuration/)
For integrating Black into your IDE visit: [Black IDE Usage](https://black.readthedocs.io/en/stable/integrations/editors.html)
## Contact
You can contact me through my [e-mail](mailto:[email protected]).