Skip to main content

TwitchPy is a Python package for using the Twitch's API and create bots for interacting with their IRC chats.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twitchpy-1.3.2.tar.gz (101.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twitchpy-1.3.2-py3-none-any.whl (122.8 kB view details)

Uploaded Python 3

File details

Details for the file twitchpy-1.3.2.tar.gz.

File metadata

  • Download URL: twitchpy-1.3.2.tar.gz
  • Upload date:
  • Size: 101.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for twitchpy-1.3.2.tar.gz
Algorithm Hash digest
SHA256 e3adc71ff17c8f5e5113d3a3f519d0bcb267d81af7c71604fb470e7cb2de619a
MD5 a383b69c5ef76f2c53131e55c1234446
BLAKE2b-256 0df6c4b8b052608947ff94ee86dcaf7b42fea7884884f99d5faea4304901a817

See more details on using hashes here.

File details

Details for the file twitchpy-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: twitchpy-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 122.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for twitchpy-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 30f5b051464201afefa5646e33a17a8331830f5a38a673532a39bea37482be8b
MD5 867a8342e3237c67e0a913828e727a84
BLAKE2b-256 e6a5c3e6ca9b116631430e3047c75128e6973ca7506770c345b249c287ec6dc1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page