Skip to main content

TwitchPy

License: GPL v3 Formatter: black Pypi downloads

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.

Metadata

Release files for twitchpy 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twitchpy 1.3.2
File Size Uploaded
twitchpy-1.3.2.tar.gz 101.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for twitchpy 1.3.2
File Interpreter ABI Platform
twitchpy-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 224.3 kB

Release files / twitchpy-1.3.2.tar.gz

Download URL twitchpy-1.3.2.tar.gz
Size 101.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e3adc71ff17c8f5e5113d3a3f519d0bcb267d81af7c71604fb470e7cb2de619a
BLAKE2b-256 checksum
How to use checksums
0df6c4b8b052608947ff94ee86dcaf7b42fea7884884f99d5faea4304901a817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / twitchpy-1.3.2-py3-none-any.whl

Download URL twitchpy-1.3.2-py3-none-any.whl
Size 122.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30f5b051464201afefa5646e33a17a8331830f5a38a673532a39bea37482be8b
BLAKE2b-256 checksum
How to use checksums
e6a5c3e6ca9b116631430e3047c75128e6973ca7506770c345b249c287ec6dc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

1 release file

1.2.2

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10.1

1 release file

0.10

1 release file

0.9

1 release file

0.8

1 release file

0.7.1

1 release file

0.7

1 release file

0.6

1 release file

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page