Metadata-Version: 2.1
Name: twitchobserver
Version: 0.8.0
Summary: Turn Twitch chatter into Python events.
Home-page: https://github.com/JoshuaSkelly/twitch-observer
Author: Joshua Skelton
Author-email: joshua.skelton@gmail.com
License: MIT
Keywords: twitch.tv,twitch,video games,chatbot
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules

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
-----

.. code:: python

    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()``.

.. code:: python

    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

.. _ReadtheDocs.org: http://twitch-observer.readthedocs.io/en/latest
.. _context manager object: https://docs.python.org/3/reference/datamodel.html#context-managers
.. _Cookbook: https://github.com/JoshuaSkelly/twitch-observer/wiki/Cookbook

