-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
106 lines (78 loc) · 2.93 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from setuptools import setup
from twitchobserver import __version__
setup(name='twitchobserver',
version=__version__,
description='Turn Twitch chatter into Python events.',
long_description="""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""",
url='https://github.com/JoshuaSkelly/twitch-observer',
author='Joshua Skelton',
author_email='[email protected]',
license='MIT',
packages=['twitchobserver'],
keywords=['twitch.tv', 'twitch', 'video games', 'chatbot'],
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries :: Python Modules'
])