Skip to main content

A Python IRC and API wrapper for Twitch.

Project description

https://i.imgur.com/B0nvk2w.png?raw=true https://img.shields.io/badge/Python-3.6%20%7C%203.7-blue.svg https://img.shields.io/github/license/TwitchIO/TwitchIO.svg https://api.codacy.com/project/badge/Grade/61e9d573b4af415a809068333d6b437b Maintainability

An Asynchronous IRC/API Wrapper currently in Development for TwitchBots made in Python!

Documentation

Official Documentation: Click Here!

Support

For support using TwitchIO, please join the official support server on Discord.

Installation

The following commands are currently the valid ways of installing TwitchIO.

TwitchIO requires Python 3.6 or higher.

Windows

py -version -m pip install twitchio

Linux

python3 -m pip install twitchio

Getting Started

TwitchIO uses many endpoints which may require different tokens and IDs.

  1. IRC endpoints which require an OAuth token.

    To get a token, log in to Twitch with the bot’s account and visit: https://twitchapps.com/tmi/

  2. HTTP endpoints which require a client ID.

    To be documented.

  3. HTTP endpoints which require an OAuth token and certain scopes.

    To be documented.

All 3 endpoints may be used at the same time. Otherwise, you may choose to use any or some of the endpoints.

Currently, TwitchIO’s development is at a phase which has emphasis on the IRC endpoint and creating a framework around it. Once this is implemented, the other 2 endpoints will be developed further.

A quick and easy bot example:

from twitchio.ext import commands


class Bot(commands.Bot):

    def __init__(self):
        super().__init__(irc_token='...', client_id='...', nick='...', prefix='!',
                         initial_channels=['...'])

    # Events don't need decorators when subclassed
    async def event_ready(self):
        print(f'Ready | {self.nick}')

    async def event_message(self, message):
        print(message.content)
        await self.handle_commands(message)

    # Commands use a different decorator
    @commands.command(name='test')
    async def my_command(self, ctx):
        await ctx.send(f'Hello {ctx.author.name}!')


bot = Bot()
bot.run()

Become a patron and help support TwitchIO’s development <3.

All Twitch logos used are owned by Twitch.tv respectively. Use of the Twitch logos does not imply any affiliation with or endorsement by them.

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

twitchio-1.1.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

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

twitchio-1.1.0-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

Details for the file twitchio-1.1.0.tar.gz.

File metadata

  • Download URL: twitchio-1.1.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for twitchio-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e8aae4ac6065f2a346108450e021df76042ba14ef262ee190608a8b4614055a3
MD5 06fec89e47bf7e9a03e46077a1eca75a
BLAKE2b-256 bab1b5f00fda2ffd7e4d36aa99ae0d06608499635ee6e6a176d840b8113186ff

See more details on using hashes here.

File details

Details for the file twitchio-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: twitchio-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for twitchio-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03bf880fdb41440dc82d8f636aa33948536266694dc98bfbbb599e918844e8cc
MD5 03e2672ed6dbb144b3213112592e361c
BLAKE2b-256 d54614dc67c86aff8a579027b5bab0cb00fb13469fb57818db5012c008ed8d6d

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