Migrating from V2#
This page lays out the changes you’ll need to make in your code to convert from TwitchIO V2 to V3.
Changes with PartialUser#
The following changes have been made to PartialUser.
These changes also apply to User, SearchUser, and UserBan
PartialUsernow inherits fromBaseUser
Additions#
The following have been added:
PartialUser.fetch_subscribed_to()(And its model,SubscribedEvent)
Removals#
The following functions have been removed due to their corresponding API routes being removed:
PartialUser.follow()PartialUser.unfollow()PartialUser.replace_tags()PartialUser.fetch_follow()PartialUser.fetch_following()PartialUser.fetch_followed()
Edits#
The following functions have had edits made to them:
PartialUser.fetch()Removed the
tokenparameter.Removed the
forceparameter.
PartialUser.edit()Removed the
tokenparameter.
PartialUser.get_custom_rewards()->PartialUser.fetch_custom_rewards()Renamed the method to follow fetch vs. get naming conventions.
Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_bits_leaderboard()Removed the
tokenparameter.
PartialUser.start_commercial()Removed the
tokenparameter.The
lengthparameter now specifies the allowed lengths throughLiteralinstead of a vagueint.
PartialUser.create_clip()Removed the
tokenparameter.
PartialUser.fetch_clips()This function now returns an Awaitable Async Iterator.
PartialUser.fetch_hypetrain_events()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_bans()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_ban_events()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_moderators()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_mod_events()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.automod_check()Removed the
tokenparameter.
PartialUser.fetch_stream_key()Removed the
tokenparameter.This function now returns the documented string instead of a raw response.
PartialUser.fetch_subscriptions()->PartialUser.fetch_subscribers()Renamed to avoid intent conflict with
PartialUser.fetch_subscribed().Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.create_marker()Removed the
tokenparameter.
PartialUser.fetch_markers()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
The return signature has changed to tuple[
PartialUser,VideoMarkers]
PartialUser.fetch_extensions()Removed the
tokenparameter.
PartialUser.fetch_active_extensions()Removed the
tokenparameter.Added the
use_app_tokenparameter, to specify what kind of token to use for the request.
PartialUser.update_extension()Removed the
tokenparameter.
PartialUser.fetch_videos()Removed the
languageparameter, as it was ineffective in this context.All parameters now have Literal typehints instead of
str.This function now returns an Awaitable Async Iterator.
PartialUser.end_prediction()Removed the
tokenparameter.The
statusparameter now has Literal typehints instead ofstrAdded an assert in the function body to ensure winning_outcode_id is set when status is RESOLVED
PartialUser.get_predictions()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.create_prediction()Removed the
tokenparameter.This function now takes a list of titles as outcomes, instead of blue and pink.
Added an assert in the function body to ensure 2 <= outcomes <= 10
Added an assert to the function body to ensure 30 <= prediction_window <= 1800
PartialUser.modify_stream()->PartialUser.modify_channel()Removed the
tokenparameter.
PartialUser.fetch_schedule()Removed the
utc_offsetparameter, as twitch no longer supports it.Removed the
firstparameter, it is superceded by the Awaitable Async Iterator.Added the
use_app_tokenparameter, to specify what kind of token to use for the request.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_channel_teams()Added
use_app_tokenparameter, to specify what kind of token to use for the request.
PartialUser.fetch_polls()Removed the
tokenparameter.This function now returns an Awaitable Async Iterator.
PartialUser.create_poll()Removed the
tokenparameter.
PartialUser.end_poll()Removed the
tokenparameter.The
statusparameter now takes a Literal instead ofstr
PartialUser.fetch_goals()Removed the
tokenparameter.
PartialUser.fetch_chat_settings()Removed the
tokenparameter.Changed the
moderator_idparameter tomoderatorof typeBaseUser
PartialUser.update_chat_settings()Removed the
tokenparameter.Changed the
moderator_idparameter tomoderatorof typeBaseUser
PartialUser.fetch_channel_following()Removed the
tokenparameter.Added the
targetparameter.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_channel_followed()Removed the
tokenparameter.Added the
targetparameter.This function now returns an Awaitable Async Iterator.
PartialUser.fetch_channel_followed_count()Removed the
tokenparameter.Added the
targetparameter.
Client Changes#
The following changes have been made to Client
(and ext.commands.Bot by extension).
Client now takes a required parameter: token_handler. Please see token handlers for more information.
Additions#
Client.fetch_user()Shorthand to
Client.fetch_users()that returnsUser | None.
Removals#
Client.from_client_credentials()(no longer needed, see token handling).Client.connect()(useClient.start()instead).Client.fetch_channel()(useClient.fetch_channels()instead).Client.fetch_webhook_subscriptions()(webhooks are gone).
Edits#
Client.run()Now uses
asyncio.run()as the underlying runner.
Client.add_event()->Client.add_event_listener()This is now documented for public use.
Client.remove_event()->Client.remove_event_listener()This is now documented for public use.
@Client.event->@Client.listenerRenamed function for clarity.
The decorator can be used without the event name in it now (see the
example).
Client.run_event()->Client.dispatch_listeners()Renamed function for clarity.
This is now documented for public use.
Removed *args.
Client.fetch_users()This function now returns an Awaitable Async Iterator.
This function no longer has a cache.
Removed the
forceparameter.
Client.create_user()->Client.get_partial_user()Renamed function for clarity.
Client.fetch_channels()->Client.fetch_channel_info()Renamed function for clarity.
Client.fetch_videos()This function now returns an Awaitable Async Iterator.
Parameters have been reordered to match typical usage.
Client.fetch_chatter_colors()Removed the
tokenparameter.Added the
targetparameter.
Client.update_chatter_color()Removed the
tokenparameter.Removed the
user_idparameter.Added the
targetparameter (combines the removed parameters).The
colorparameter now specifies Literals that can be used, along with more specific docstrings.
Client.fetch_games()This function now returns an Awaitable Async Iterator.
Added the
targetparameter.
Client.fetch_streams()This function now returns an Awaitable Async Iterator.
Removed the
tokenparameter.Added the
targetparameter.
Client.fetch_top_games()This function now returns an Awaitable Async Iterator.
Added the
targetparameter.
Client.fetch_tags()This function now returns an Awaitable Async Iterator.
Added the
targetparameter.
Client.fetch_team()Added the
targetparameter.
Client.delete_videos()Removed the
tokenparameter.Added the
targetparameter.
Client.fetch_global_chat_badges()Added the
targetparameter.
Event Changes#
Due to changes in the dispatching mechanism, all events now take one argument.
This affects all events that used to take two arguments, and also affects Client/Bot.wait_for.
The following events have changed:
event_join- removed thechannelargument, useChatter.channel()instead.event_part- removed thechannelargument, useChatter.channel()instead.event_ready- Added a dummy argument, this can be ignored and set to_.
The following event has been removed:
event_ready- this event has been removed in favour ofevent_shard_ready()andClient.setup.
The following events have been added: