bynect / pytmi

TMI (Twitch Messaging Interface) library for Python
https://pypi.org/project/pytmi/
MIT License
9 stars 0 forks source link
asynchronous asyncio client irc-client irc-library irc-protocol python python3 tmi twitch twitch-chat twitch-irc

pytmi

package_version license python_version wheel

TMI (Twitch Messaging Interface) library for Python.

You can get your OAuth token with the site https://twitchapps.com/tmi/.

Example

Here's a little application that logs in the user using OAuth, joins the Twitch channel requested by the user, sends the message Hello, Twitch! to the chat and then leaves the channel.

import asyncio
import pytmi

async def main() -> None:
    nick = input("Insert your Twitch nickname: ").strip()
    token = input("Insert your Twitch OAuth token: ").strip()
    channel = input("Insert the channel to join: ").strip()

    async with pytmi.Client() as client:
        await client.login_oauth(token, nick, channel)
        await client.join(channel)
        await client.send_message("Hello, Twitch!")

if __name__ == "__main__":
    try:
        loop = asyncio.new_event_loop()
        loop.run_until_complete(main())
    except:
        print("Something went wrong.")

You can find others usage example inside the test directory.

Known bugs

Todos

Changelog

v1.0.0

v0.3.0

v0.2.3

v0.2.2

v0.2.1

v0.2.0

v0.1.1

v0.1.0