Skip to main content

TMI (Twitch Messaging Interface) library for Python.

Project description

pytmi

package_version license python_version wheel

TMI (Twitch Messaging Interface) library for Python.

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 pytmi


def send_message() -> None:
    username = input("Insert your Twitch username: ").lstrip()
    token = input("Insert your Twitch OAuth token: ").lstrip()
    channel = input("Insert the channel to join: ").lstrip()

    client = pytmi.TmiClient()
    client.login_oauth(token, username)

    client.join(channel)
    client.privmsg("Hello, Twitch")

    client.logout()


if __name__ == "__main__":
    try:
        send_message()
    except:
        print("Something went wrong.")

You can find an extended example in the tests directory.

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

pytmi-0.1.1.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

pytmi-0.1.1-py3-none-any.whl (10.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page