TwitchIO is an asynchronous Python wrapper around the Twitch API and IRC, with a powerful command extension for creating Twitch Chat Bots. TwitchIO covers almost all of the new Twitch API and features support for commands, PubSub, Webhooks, and EventSub.
For the Official Documentation: Click Here!
For support using TwitchIO, please join the official support server on Discord.
TwitchIO requires Python 3.7+. You can download the latest version of Python here.
Windows
py -m pip install -U twitchio
Linux
python -m pip install -U twitchio
Visit Token Generator for a simple way to generate tokens for use with TwitchIO.
A simple Chat Bot.
from twitchio.ext import commands
class Bot(commands.Bot):
def __init__(self):
# Initialise our Bot with our access token, prefix and a list of channels to join on boot...
super().__init__(token='ACCESS_TOKEN', prefix='?', initial_channels=['...'])
async def event_ready(self):
# We are logged in and ready to chat and use commands...
print(f'Logged in as | {self.nick}')
print(f'User id is | {self.user_id}')
@commands.command()
async def hello(self, ctx: commands.Context):
# Send a hello back!
await ctx.send(f'Hello {ctx.author.name}!')
bot = Bot()
bot.run()
TwitchIO 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 TwitchIO is 120.
For installation and usage of Black visit: Black Formatter
For integrating Black into your IDE visit: Black IDE Usage
Thank you to all those who contribute and help TwitchIO grow.
Special thanks to:
If I have forgotten anyone please let me know <3: EvieePy