PyTwitchAPI Versions Save

A Python 3.7 compatible implementation of the Twitch API, EventSub, PubSub and Chat

v4.2.0

3 months ago

Twitch

  • Fixed Endpoint Twitch.get_stream_key() (thanks @moralrecordings )
  • Added the following new Endpoints:
    • "Get Ad Schedule"
    • "Snooze Next Ad"
    • "Send Chat Message"
    • "Get Moderated Channels"

EventSub

  • Fixed EventSubWebsocket.stop() not raising RuntimeException when called and socket not running.
  • Added the following new Topics:
    • "Channel Ad Break Begin"
    • "Channel Chat Message"

OAuth

  • Added the following new AuthScopes:
    • AuthScope.USER_WRITE_CHAT
    • AuthScope.CHANNEL_READ_ADS
    • AuthScope.CHANNEL_MANAGE_ADS
    • AuthScope.USER_READ_MODERATED_CHANNELS

v4.1.0

5 months ago

Twitch

  • Removed the deprecated Endpoint "Get Users Follows"
  • Removed the deprecated bits related fields from Poll Endpoint data

EventSub

  • Duplicate Webhook messages will now be ignored

  • EventSub will now recover properly from a disconnect when auth token is expired

  • Added the following new Topics:

    • "Channel Chat Clear"
    • "Channel Chat Clear User Messages"
    • "Channel Chat Message Delete"
    • "Channel Chat Notification"
  • Removed the deprecated version 1 of topic "Channel Follow"

Chat

  • Improved recovery from broken network connection (thanks @Latent-Logic )
  • Added ChatMessage.is_me flag
  • Fixed parsing of messages using the /me chat command

OAuth

  • Added the following new AuthScopes:
    • AuthScope.CHANNEL_BOT
    • AuthScope.USER_BOT
    • AuthScope.USER_READ_CHAT

v4.0.1

7 months ago

Chat

  • Fixed RuntimeWarning when handling chat commands

v4.0.0

7 months ago

This is a major release, please see https://pytwitchapi.dev/en/v4.0.0/v4-migration.html for a migration guide!

Keystone Features

Twitch

  • Added new fields ChannelInformation.is_branded_content and ChannelInformation.content_classification_labels to response of get_channel_information()

  • Added new parameters modify_channel_information.is_branded_content and modify_channel_information.content_classification_labels to modify_channel_information()

  • Added new Endpoint "Get Content Classification Labels" get_content_classification_labels()

  • Removed the following deprecated Endpoints:

    • "Get Soundstrack Current Track"
    • "Get SoundTrack Playlist"
    • "Get Soundtrack Playlists"
  • get_polls() now allows up to 20 poll IDs

  • get_channel_followers() can now also be used without the required Scope or just with App Authentication

  • Added new parameter get_clips.is_featured to get_clips() and added object.api.Clip.is_featured to result.

EventSub

  • Moved old EventSub from twitchAPI.eventsub to new package twitchAPI.eventsub.webhook and renamed it to EventSubWebhook
  • Added new EventSub Websocket transport EventSubWebsocket
  • All EventSub callbacks now use object.base.TwitchObject based Payloads instead of raw dictionaries. See :ref:eventsub-available-topics for a list of all available Payloads
  • Added EventSubBase.listen_channel_update_v2()
  • Added option for EventSubWebhook to specify a asyncio loop via EventSubWebhook.callback_loop in which to run all callbacks in
  • Added option for EventSubWebsocket to specify a asyncio loop via EventSubWebsocket.callback_loop in which to run all callbacks in
  • Added automatical removal of tailing / in EventSubWebhook.callback_url if present
  • Fixed broken handling of malformed HTTP requests made to the callback endport of EventSubWebhook
  • Made EventSubWebhook more easily mockable via twitch-cli by adding EventSubWebhook.subscription_url
  • Added optional subscription revokation handler via EventSubWebhook.revocation_handler to EventSubWebhook

PubSub

  • Handle Authorization Revoked messages (Thanks @Braastos )
  • Added option to specify a asyncio loop via pubsub.PubSub.callback_loop in which to run all callbacks in

Chat

  • Added Chat Command Middleware, a way to decide if a command should run, see https://pytwitchapi.dev/en/v4.0.0/tutorial/chat-use-middleware.html for more info.

  • Added the following default Chat Command Middleware:

    • ChannelRestriction
    • UserRestriction
    • StreamerOnly
    • ChannelCommandCooldown
    • ChannelUserCommandCooldown
    • GlobalCommandCooldown
  • Added option to specify a asyncio loop via callback_loop in which to run all callbacks in

  • Fixed errors raised in callbacks not being properly reported

  • Added Hype Chat related fields to ChatMessage

  • Improved logging

  • Fixed KeyError when encountering some Notice events

  • Added new reply tags ChatMessage.reply_thread_parent_msg_id and ChatMessage.reply_thread_parent_user_login to ChatMessage

  • Reconnects no longer duplicate the channel join list

  • Chat.start() now thows an error should Chat() not have been awaited

OAuth

  • Added UserAuthenticationStorageHelper, a easy plug and play way to generate user auth tokens only on demand
  • Made it possible to mock all auth flows with twitch-cli

Other

  • Added AsyncIterTwitchObject.current_cursor()
  • Renamed module twitchAPI.types to twitchAPI.type
  • Moved all API related TwitchObjects from module twitchAPI.object to twitchAPI.object.api
  • Removed default imports from module twitchAPI

v3.11.0

11 months ago

Twitch

Chat

  • Fixed timing based AttributeError: 'NoneType' object has no attribute 'get' in NoticeEvent during reconnect
  • Ensured that only Chat Messages will ever be parsed as chat commands
  • Added functionality to set per channel based prefixes (https://github.com/Teekeks/pyTwitchAPI/issues/229):
    • Chat.set_channel_prefix() to set a custom prefix for the given channel(s)
    • Chat.reset_channel_prefix() to remove a custom set prefix for the given channel(s)

v3.10.0

1 year ago

Twitch

  • Added new ChatBadgeVersion related fields to the following Endpoints: (Thanks @stolenvw )

    • Twitch.get_chat_badges()
    • Twitch.get_global_chat_badges()
  • Twitch.set_user_authentication() now tries to refresh the given token set if it seems to be out of date

  • removed the following deprecated endpoints:

    • "Replace Stream Tags"
    • "Get Stream Tags"
    • "Get All Stream Tags"
    • "Redeem Code"
    • "Get Code Status"
  • Fixed condition logic when parameter first was given for the following Endpoints:

    • Twitch.get_chatters() (Thanks @d7415 )
    • Twitch.get_soundtrack_playlist()
    • Twitch.get_soundtrack_playlists()

PubSub

  • PubSub now cleanly reestablishes the connection when the websocket was unexpectedly closed

v3.9.0

1 year ago

Twitch

  • Added the following new Endpoints:

    • "Get Channel Followers" Twitch.get_channel_followers()
    • "Get Followed Channels"Twitch.get_followed_channels()
  • Fixed TypeError: __api_get_request() got an unexpected keyword argument 'body' (Thanks @JC-Chung )

EventSub

  • Added new Topic EventSub.listen_channel_follow_v2()

Chat

  • Bot is now correctly reconnecting and rejoining channels after losing connection
  • added Chat.is_subscriber() (Thanks @stolenvw )
  • added new Event ChatEvent.NOTICE - Triggered when server sends a notice message (Thanks @stolenvw )

v3.8.0

1 year ago

Twitch

  • Added the new Endpoint "Send a Shoutout" Twitch.send_a_shoutout()
  • Twitch.get_users_follows() is now marked as deprecated
  • Added missing parameter type to Twitch.get_streams()

Helper

  • Added new Async Generator helper limit(), with this you can limit the amount of results returned from the given AsyncGenerator to a maximum number

EventSub

  • Added the following new Topics:
    • "Channel Shoutout Create" EventSub.listen_channel_shoutout_create()
    • "Channel Shoutout Receive" EventSub.listen_channel_shoutout_receive()

PubSub

  • Added new Topic "Low trust Users" PubSub.listen_low_trust_users()

Chat

  • Improved rate limit handling of Chat.join_room() when joining multiple rooms per call
  • The following functions now all ignore the capitalization of the given chat room:
    • Chat.join_room()
    • Chat.leave_room()
    • Chat.is_mod()
    • Chat.send_message()
  • Added initial_channel to Chat.__init__(), with this you can auto join channels on bot startup
  • Added Chat.is_in_room()
  • Added Chat.log_no_registered_command_handler, with this you can control if the "no registered handler for event" warnings should be logged or not

OAuth

  • Added the following new AuthScopes:
    • AuthScope.MODERATOR_MANAGE_SHOUTOUTS
    • AuthScope.MODERATOR_READ_SHOUTOUTS
    • AuthScope.MODERATOR_READ_FOLLOWERS
  • Improved async handling of UserAuthenticator

v3.7.0

1 year ago

Twitch

  • Added the following Endpoints:
    • "Get AutoMod Settings" Twitch.get_automod_settings()
    • "Update AutoMod Settings" Twitch.update_automod_settings()
  • Added Twitch.session_timeout config. With this you can optionally change the timeout behavior across the entire library

OAuth

  • Added the following new AuthScopes:
    • MODERATOR_READ_AUTOMOD_SETTINGS
    • MODERATOR_MANAGE_AUTOMOD_SETTINGS

v3.6.2

1 year ago
  • Added py.typed file to comply with PEP-561

Twitch

  • Fixed all Endpoints that use AsyncIterTwitchObject yielding some items multiple times
  • added missing field to_login to Twitch.get_users_follows()