TwitchPy is a Python package for using the Twitch's API and create bots for interacting with their IRC chats.
Project description
TwitchPy
TwitchPy is a Python package for using the Twitch's API and create bots for interacting with their IRC chats.
Documentation
Click here to see the official documentation.
Installation
TwitchPy requires Python 3.10 or higher. You can download the latest version of Python here.
pip install twitchpy
Getting started
A basic bot.
from datetime import datetime
from 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 time
time_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
For integrating Black into your IDE visit: Black IDE Usage
Contact
You can contact me through my e-mail.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file twitchpy-1.3.1.tar.gz
.
File metadata
- Download URL: twitchpy-1.3.1.tar.gz
- Upload date:
- Size: 101.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d2e463e5de2771165d8b7c348f790c1e888912884fd0c1aba4cb024f77ed087 |
|
MD5 | d95b769f2bfc29a10d995939cee1df0e |
|
BLAKE2b-256 | 43f1a1ab1efef5dfcadc665327fee0c4be1302f978f27d2c4e28a3ae3c84e5b9 |
File details
Details for the file twitchpy-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: twitchpy-1.3.1-py3-none-any.whl
- Upload date:
- Size: 122.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4412b07bc192e2868a4a07c1914ff4e3c734583a4969c0afc0bbe76530464fbb |
|
MD5 | d662aeaf4a21efb13d94f7f426523bcc |
|
BLAKE2b-256 | 1c953f5eb6c4e23df4b7d8d9efdbd9dc3ccd07aafb3476129ccdfec0c93e3e8f |