Skip to main content

twitch-observer

twitchobserver makes interacting with Twitch chat super easy. It is built and tuned for realtime applications. You can make chatbots chat. You can build Twitch Plays video games.

Features

  • Pure Python: No extra dependencies. Just plain and simple Python.

  • Small API: With a few classes and a handful of methods, you can learn it over a coffee break.

  • Event Based: Makes writing apps easy and straightforward.

  • Context Manager: Further simplifies working with observers.

Installation

$ pip install twitchobserver

Usage

from twitchobserver import Observer

observer = Observer('Nick', 'oauth:abcdefghijklmnopqrstuvwxyz0123')
observer.start()
observer.join_channel('channel')
observer.send_message('Hello and goodbye', 'channel')
observer.leave_channel('channel')

Documentation

API documentation can be found over on ReadtheDocs.org.

Tests

$ python -m unittest discover -s tests

Examples

Echo bot

Whenever a message is sent, echo it back. The Observer is created as a context manager object which will implicitly handle calling start() and stop().

import time
from twitchobserver import Observer

with Observer('Nick', 'oauth:abcdefghijklmnopqrstuvwxyz0123') as observer:
    observer.join_channel('channel')

    while True:
        try:
            for event in observer.get_events():
                if event.type == 'TWITCHCHATMESSAGE':
                    observer.send_message(event.message, event.channel)

            time.sleep(1)

        except KeyboardInterrupt:
            observer.leave_channel('channel')
            break

More examples can be found in the Cookbook.

License

MIT

Metadata

Release files for twitchobserver 0.8.0

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

Source distribution (sdist)

Source distribution for twitchobserver 0.8.0
File Size Uploaded Provenance Actions
twitchobserver-0.8.0.tar.gz 7.6 kB Without provenance Details for twitchobserver-0.8.0.tar.gz

Release files / twitchobserver-0.8.0.tar.gz

Download URL twitchobserver-0.8.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
aaf04c9a104bf52032e71e82aa59a75fe79570006caaeaff65ee80c15e956856
BLAKE2b-256 checksum
How to use checksums
e53d57944a9bd44295d941c3b2d3bd4df1065bcf2ec493c3d3f616e89f1d0325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for twitchobserver 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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