EventSub Ext#
The EventSub ext is made to receive eventsub webhook notifications from twitch. For those not familiar with eventsub, it allows you to subscribe to certain events, and when these events happen, Twitch will send you an HTTP request containing information on the event. This ext abstracts away the complex portions of this, integrating seamlessly into the twitchio Client event dispatching system.
Warning
This ext requires you to have a public facing ip AND domain, and to be able to receive inbound requests.
Note
Twitch requires EventSub targets to have TLS/SSL enabled (https). TwitchIO does not support this, as such you should
use a reverse proxy such as nginx
to handle TLS/SSL.
A Quick Example#
import twitchio
from twitchio.ext import eventsub, commands
bot = commands.Bot(token="...")
eventsub_client = eventsub.EventSubClient(bot, "some_secret_string", "https://your-url.here/callback")
# when subscribing (you can only await inside coroutines)
await eventsub_client.subscribe_channel_subscriptions(channel_ID)
@bot.event()
async def eventsub_notification_subscription(payload: eventsub.ChannelSubscribeData):
...
bot.loop.create_task(eventsub_client.listen(port=4000))
bot.loop.create_task(bot.start())
bot.loop.run_forever()
Running Eventsub Inside a Commands Bot#
import twitchio
from twitchio.ext import commands, eventsub
esbot = commands.Bot.from_client_credentials(client_id='...',
client_secret='...')
esclient = eventsub.EventSubClient(esbot,
webhook_secret='...',
callback_route='https://your-url.here/callback')
class Bot(commands.Bot):
def __init__(self):
super().__init__(token='...', prefix='!', initial_channels=['channel'])
async def __ainit__(self) -> None:
self.loop.create_task(esclient.listen(port=4000))
try:
await esclient.subscribe_channel_follows_v2(broadcaster=some_channel_ID, moderator=a_channel_mod_ID)
except twitchio.HTTPException:
pass
async def event_ready(self):
print('Bot is ready!')
bot = Bot()
bot.loop.run_until_complete(bot.__ainit__())
@esbot.event()
async def event_eventsub_notification_followV2(payload: eventsub.ChannelFollowData) -> None:
print('Received event!')
channel = bot.get_channel('channel')
await channel.send(f'{payload.data.user.name} followed woohoo!')
bot.run()
Event Reference#
This is a list of events dispatched by the eventsub ext.
- twitchio.ext.eventsub.event_eventsub_notification_user_authorization_grant(event: UserAuthorizationGrantedData)#
Called when your app has had access granted on a channel.
- twitchio.ext.eventsub.event_eventsub_revokation(event: RevokationEvent)#
Called when your app has had access revoked on a channel.
- twitchio.ext.eventsub.event_eventsub_webhook_callback_verification(event: ChallengeEvent)#
Called when Twitch sends a challenge to your server.
Note
You generally won’t need to interact with this event. The ext will handle responding to the challenge automatically.
- twitchio.ext.eventsub.event_eventsub_keepalive(event: KeepaliveEvent)#
Called when a Twitch sends a keepalive event. You do not need to use this in daily usage.
Note
You generally won’t need to interact with this event.
- twitchio.ext.eventsub.event_eventsub_reconnect(event: ReconnectEvent)#
Called when a Twitch wishes for us to reconnect.
Note
You generally won’t need to interact with this event. The library will automatically handle reconnecting.
- twitchio.ext.eventsub.event_eventsub_notification_follow(event: ChannelFollowData)#
Called when someone creates a follow on a channel you’ve subscribed to.
Warning
Twitch has removed this, please use
event_eventsub_notification_followV2()
- twitchio.ext.eventsub.event_eventsub_notification_followV2(event: ChannelFollowData)#
Called when someone creates a follow on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_subscription(event: ChannelSubscribeData)#
Called when someone subscribes to a channel that you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_subscription_end(event: ChannelSubscriptionEndData)#
Called when a subscription to a channel that you’ve subscribed to ends.
- twitchio.ext.eventsub.event_eventsub_notification_subscription_gift(event: ChannelSubscriptionGiftData)#
Called when someone gifts a subscription to a channel that you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_subscription_message(event: ChannelSubscriptionMessageData)#
Called when someone resubscribes with a message to a channel that you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_cheer(event: ChannelCheerData)#
Called when someone cheers on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_raid(event: ChannelRaidData)#
Called when someone raids a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_poll_begin(event: PollBeginProgressData)#
Called when a poll begins on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_poll_progress(event: PollBeginProgressData)#
Called repeatedly while a poll is running on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_poll_end(event: PollEndData)#
Called when a poll ends on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_prediction_begin(event: PredictionBeginProgressData)#
Called when a prediction starts on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_prediction_progress(event: PredictionBeginProgressData)#
Called repeatedly while a prediction is running on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_prediction_lock(event: PredictionLockData)#
Called when a prediction locks on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_prediction_end(event: PredictionEndData)#
Called when a prediction ends on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_stream_start(event: StreamOnlineData)#
Called when a stream starts on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_stream_end(event: StreamOfflineData)#
Called when a stream ends on a channel you’ve subscribed to.
- twitchio.ext.eventsub.event_eventsub_notification_channel_goal_begin(event: ChannelGoalBeginProgressData)#
Called when a streamer starts a goal on their channel.
- twitchio.ext.eventsub.event_eventsub_notification_channel_goal_progress(event: ChannelGoalBeginProgressData)#
Called when there is an update event to a channel’s goal.
- twitchio.ext.eventsub.event_eventsub_notification_channel_goal_end(event: ChannelGoalEndData)#
Called when someone ends a goal on their channel.
- twitchio.ext.eventsub.event_eventsub_notification_hypetrain_begin(event: HypeTrainBeginProgressData)#
Called when a hype train starts on their channel.
- twitchio.ext.eventsub.event_eventsub_notification_hypetrain_progress(event: HypeTrainBeginProgressData)#
Called when a hype train receives an update on their channel.
- twitchio.ext.eventsub.event_eventsub_notification_hypetrain_end(event: HypeTrainEndData)#
Called when a hype train ends on their channel.
- twitchio.ext.eventsub.event_eventsub_notification_channel_shield_mode_begin(event: ChannelShieldModeBeginData)#
Called when a channel’s Shield Mode status is activated.
- twitchio.ext.eventsub.event_eventsub_notification_channel_shield_mode_end(event: ChannelShieldModeEndData)#
Called when a channel’s Shield Mode status is deactivated.
- twitchio.ext.eventsub.event_eventsub_notification_channel_shoutout_create(event: ChannelShoutoutCreateData)#
Called when a channel sends a shoutout.
- twitchio.ext.eventsub.event_eventsub_notification_channel_shoutout_receive(event: ChannelShoutoutReceiveData)#
Called when a channel receives a shoutout.
- twitchio.ext.eventsub.event_eventsub_notification_channel_charity_donate(event: ChannelCharityDonationData)#
Called when a user donates to an active charity campaign.
- twitchio.ext.eventsub.event_eventsub_notification_channel_ad_break_begin(event: ChannelAdBreakBeginData)#
Called when a user runs a midroll commercial break, either manually or automatically via ads manager.
API Reference#
- asyncdelete_all_active_subscriptions
- asyncdelete_subscription
- asyncget_subscriptions
- asynclisten
- defstop
- defsubscribe_automod_message_hold
- defsubscribe_automod_message_update
- defsubscribe_automod_settings_update
- defsubscribe_automod_terms_update
- defsubscribe_channel_ad_break_begin
- defsubscribe_channel_auto_reward_redeem
- defsubscribe_channel_bans
- defsubscribe_channel_charity_donate
- defsubscribe_channel_cheers
- defsubscribe_channel_follows
- defsubscribe_channel_follows_v2
- defsubscribe_channel_goal_begin
- defsubscribe_channel_goal_end
- defsubscribe_channel_goal_progress
- defsubscribe_channel_hypetrain_begin
- defsubscribe_channel_hypetrain_end
- defsubscribe_channel_hypetrain_progress
- defsubscribe_channel_moderate
- defsubscribe_channel_moderators_add
- defsubscribe_channel_moderators_remove
- defsubscribe_channel_points_redeem_updated
- defsubscribe_channel_points_redeemed
- defsubscribe_channel_points_reward_added
- defsubscribe_channel_points_reward_removed
- defsubscribe_channel_points_reward_updated
- defsubscribe_channel_poll_begin
- defsubscribe_channel_poll_end
- defsubscribe_channel_poll_progress
- defsubscribe_channel_prediction_begin
- defsubscribe_channel_prediction_end
- defsubscribe_channel_prediction_lock
- defsubscribe_channel_prediction_progress
- asyncsubscribe_channel_raid
- defsubscribe_channel_shield_mode_begin
- defsubscribe_channel_shield_mode_end
- defsubscribe_channel_shoutout_create
- defsubscribe_channel_shoutout_receive
- defsubscribe_channel_stream_end
- defsubscribe_channel_stream_start
- defsubscribe_channel_subscription_end
- defsubscribe_channel_subscription_gifts
- defsubscribe_channel_subscription_messages
- defsubscribe_channel_subscriptions
- defsubscribe_channel_unban_request_create
- defsubscribe_channel_unban_request_resolve
- defsubscribe_channel_unbans
- defsubscribe_channel_update
- defsubscribe_channel_vip_add
- defsubscribe_channel_vip_remove
- defsubscribe_suspicious_user_update
- asyncsubscribe_user_authorization_granted
- asyncsubscribe_user_authorization_revoked
- asyncsubscribe_user_updated
- class twitchio.ext.eventsub.EventSubClient(client: Client, webhook_secret: str, callback_route: str, token: Optional[str] = None)#
- coroutine delete_all_active_subscriptions()#
- coroutine get_subscriptions(status: Optional[str] = None, sub_type: Optional[str] = None, user_id: Optional[int] = None)#
- coroutine listen(**kwargs)#
- stop()#
- subscribe_automod_message_hold(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_automod_message_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_automod_settings_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_automod_terms_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_ad_break_begin(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_auto_reward_redeem(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_bans(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_charity_donate(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_cheers(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_follows(broadcaster: Union[PartialUser, str, int])#
Warning
This endpoint is deprecated, use
subscribe_channel_follows_v2()
- subscribe_channel_follows_v2(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_goal_begin(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_goal_end(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_goal_progress(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_hypetrain_begin(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_hypetrain_end(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_hypetrain_progress(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_moderate(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_moderators_add(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_moderators_remove(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_points_redeem_updated(broadcaster: Union[PartialUser, str, int], reward_id: Optional[str] = None)#
- subscribe_channel_points_redeemed(broadcaster: Union[PartialUser, str, int], reward_id: Optional[str] = None)#
- subscribe_channel_poll_begin(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_poll_end(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_poll_progress(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_prediction_begin(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_prediction_end(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_prediction_lock(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_prediction_progress(broadcaster: Union[PartialUser, str, int])#
- coroutine subscribe_channel_raid(from_broadcaster: Optional[Union[PartialUser, str, int]] = None, to_broadcaster: Optional[Union[PartialUser, str, int]] = None)#
- subscribe_channel_shield_mode_begin(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_shield_mode_end(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_shoutout_create(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_shoutout_receive(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_stream_end(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_stream_start(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_subscription_end(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_subscription_gifts(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_subscription_messages(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_subscriptions(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_unban_request_create(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_unban_request_resolve(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- subscribe_channel_unbans(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_update(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_vip_add(broadcaster: Union[PartialUser, str, int])#
- subscribe_channel_vip_remove(broadcaster: Union[PartialUser, str, int])#
- subscribe_suspicious_user_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int])#
- coroutine subscribe_user_authorization_granted()#
- coroutine subscribe_user_authorization_revoked()#
- coroutine subscribe_user_updated(user: Union[PartialUser, str, int])#
- asyncsubscribe_automod_message_hold
- asyncsubscribe_automod_message_update
- asyncsubscribe_automod_settings_update
- asyncsubscribe_automod_terms_update
- asyncsubscribe_channel_ad_break_begin
- asyncsubscribe_channel_auto_reward_redeem
- asyncsubscribe_channel_bans
- asyncsubscribe_channel_charity_donate
- asyncsubscribe_channel_cheers
- asyncsubscribe_channel_follows
- asyncsubscribe_channel_follows_v2
- asyncsubscribe_channel_goal_begin
- asyncsubscribe_channel_goal_end
- asyncsubscribe_channel_goal_progress
- asyncsubscribe_channel_hypetrain_begin
- asyncsubscribe_channel_hypetrain_end
- asyncsubscribe_channel_hypetrain_progress
- asyncsubscribe_channel_moderate
- asyncsubscribe_channel_moderators_add
- asyncsubscribe_channel_moderators_remove
- asyncsubscribe_channel_points_redeem_updated
- asyncsubscribe_channel_points_redeemed
- asyncsubscribe_channel_points_reward_added
- asyncsubscribe_channel_points_reward_removed
- asyncsubscribe_channel_points_reward_updated
- asyncsubscribe_channel_poll_begin
- asyncsubscribe_channel_poll_end
- asyncsubscribe_channel_poll_progress
- asyncsubscribe_channel_prediction_begin
- asyncsubscribe_channel_prediction_end
- asyncsubscribe_channel_prediction_lock
- asyncsubscribe_channel_prediction_progress
- asyncsubscribe_channel_raid
- asyncsubscribe_channel_shield_mode_begin
- asyncsubscribe_channel_shield_mode_end
- asyncsubscribe_channel_shoutout_create
- asyncsubscribe_channel_shoutout_receive
- asyncsubscribe_channel_stream_end
- asyncsubscribe_channel_stream_start
- asyncsubscribe_channel_subscription_end
- asyncsubscribe_channel_subscription_gifts
- asyncsubscribe_channel_subscription_messages
- asyncsubscribe_channel_subscriptions
- asyncsubscribe_channel_unban_request_create
- asyncsubscribe_channel_unban_request_resolve
- asyncsubscribe_channel_unbans
- asyncsubscribe_channel_update
- asyncsubscribe_channel_vip_add
- asyncsubscribe_channel_vip_remove
- asyncsubscribe_suspicious_user_update
- asyncsubscribe_user_updated
- class twitchio.ext.eventsub.EventSubWSClient(client: Client)#
- coroutine subscribe_automod_message_hold(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_automod_message_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_automod_settings_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_automod_terms_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_auto_reward_redeem(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_follows_v2(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_hypetrain_progress(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_moderate(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_moderators_remove(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_points_redeem_updated(broadcaster: Union[PartialUser, str, int], token: str, reward_id: Optional[str] = None)#
- coroutine subscribe_channel_points_redeemed(broadcaster: Union[PartialUser, str, int], token: str, reward_id: Optional[str] = None)#
- coroutine subscribe_channel_points_reward_added(broadcaster: Union[PartialUser, str, int], reward_id: str, token: str)#
- coroutine subscribe_channel_points_reward_removed(broadcaster: Union[PartialUser, str, int], reward_id: str, token: str)#
- coroutine subscribe_channel_points_reward_updated(broadcaster: Union[PartialUser, str, int], reward_id: str, token: str)#
- coroutine subscribe_channel_prediction_begin(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_prediction_progress(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_raid(token: str, from_broadcaster: Optional[Union[PartialUser, str, int]] = None, to_broadcaster: Optional[Union[PartialUser, str, int]] = None)#
- coroutine subscribe_channel_shield_mode_begin(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_shield_mode_end(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_shoutout_create(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_shoutout_receive(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_subscription_end(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_subscription_gifts(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_subscription_messages(broadcaster: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_unban_request_create(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_channel_unban_request_resolve(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- coroutine subscribe_suspicious_user_update(broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int], token: str)#
- class twitchio.ext.eventsub.Headers(request: Request)#
The headers of the inbound EventSub message
- timestamp#
The timestamp the message was sent at
- Type
- class twitchio.ext.eventsub.WebsocketHeaders(frame: dict)#
The headers of the inbound Websocket EventSub message
- timestamp#
The timestamp the message was sent at
- Type
- class twitchio.ext.eventsub.ChannelBanData(client: EventSubClient, data: dict)#
A Ban event
- user#
The user that was banned
- Type
- broadcaster#
The broadcaster who’s channel the ban occurred in
- Type
- moderator#
The moderator responsible for the ban
- Type
- ends_at#
When the ban ends at. Could be
None
- Type
Optional[
datetime.datetime
]
- class twitchio.ext.eventsub.ChannelShieldModeBeginData(client: EventSubClient, data: dict)#
Represents a Shield Mode activation status.
- broadcaster#
The broadcaster whose Shield Mode status was updated.
- Type
- moderator#
The moderator that updated the Shield Mode staus.
- Type
- started_at#
The UTC datetime of when Shield Mode was last activated.
- Type
- class twitchio.ext.eventsub.ChannelShieldModeEndData(client: EventSubClient, data: dict)#
Represents a Shield Mode activation status.
- broadcaster#
The broadcaster whose Shield Mode status was updated.
- Type
- moderator#
The moderator that updated the Shield Mode staus.
- Type
- ended_at#
The UTC datetime of when Shield Mode was last deactivated.
- Type
- class twitchio.ext.eventsub.ChannelShoutoutCreateData(client: EventSubClient, data: dict)#
Represents a Shoutout event being sent.
Requires the
moderator:read:shoutouts
ormoderator:manage:shoutouts
scope.- broadcaster#
The broadcaster from who sent the shoutout event.
- Type
- moderator#
The moderator who sent the shoutout event.
- Type
- to_broadcaster#
The broadcaster who the shoutout was sent to.
- Type
- started_at#
The datetime the shoutout was sent.
- Type
- cooldown_ends_at#
The datetime the broadcaster can send another shoutout.
- Type
- target_cooldown_ends_at#
The datetime the broadcaster can send another shoutout to the same broadcaster.
- Type
- class twitchio.ext.eventsub.ChannelShoutoutReceiveData(client: EventSubClient, data: dict)#
Represents a Shoutout event being received.
Requires the
moderator:read:shoutouts
ormoderator:manage:shoutouts
scope.- broadcaster#
The broadcaster receiving shoutout event.
- Type
- from_broadcaster#
The broadcaster who sent the shoutout.
- Type
- started_at#
The datetime the shoutout was sent.
- Type
- class twitchio.ext.eventsub.ChannelSubscribeData(client: EventSubClient, data: dict)#
A Subscription event
- user#
The user who subscribed
- Type
- broadcaster#
The channel that was subscribed to
- Type
- class twitchio.ext.eventsub.ChannelSubscriptionGiftData(client: EventSubClient, data: dict)#
A Subscription Gift event Explicitly, the act of giving another user a Subscription. Receiving a gift-subscription uses ChannelSubscribeData above, with is_gift is
True
- user#
The user that gifted subs. Will be
None
ifis_anonymous
isTrue
- Type
Optional[
twitchio.PartialUser
]
- broadcaster#
The channel that was subscribed to
- Type
- class twitchio.ext.eventsub.ChannelSubscriptionMessageData(client: EventSubClient, data: dict)#
A Subscription Message event. A combination of resubscriptions + the messages users type as part of the resub.
- user#
The user who subscribed
- Type
- broadcaster#
The channel that was subscribed to
- Type
- emote_data#
emote data within the user’s resubscription message. Not the emotes themselves
- Type
- class twitchio.ext.eventsub.ChannelCheerData(client: EventSubClient, data: dict)#
A Cheer event
- user#
The user that cheered. Will be
None
ifis_anonymous
isTrue
- Type
Optional[
twitchio.PartialUser
]
- broadcaster#
The channel the cheer happened on
- Type
- class twitchio.ext.eventsub.ChannelUpdateData(client: EventSubClient, data: dict)#
A Channel Update event
- broadcaster#
The channel that was updated
- Type
- class twitchio.ext.eventsub.ChannelFollowData(client: EventSubClient, data: dict)#
A Follow event
- user#
The user that followed
- Type
- broadcaster#
The channel that was followed
- Type
- followed_at#
When the follow occurred
- Type
- class twitchio.ext.eventsub.ChannelRaidData(client: EventSubClient, data: dict)#
A Raid event
- raider#
The person initiating the raid
- Type
- reciever#
The person recieving the raid
- Type
- class twitchio.ext.eventsub.ChannelModeratorAddRemoveData(client: EventSubClient, data: dict)#
A Moderator Add/Remove event
- user#
The user being added or removed from the moderator status
- Type
- broadcaster#
The channel that is having a moderator added/removed
- Type
- class twitchio.ext.eventsub.ChannelGoalBeginProgressData(client: EventSubClient, data: dict)#
A goal begin event
- user#
The broadcaster that started the goal
- Type
- started_at#
The datetime the goal was started
- Type
- class twitchio.ext.eventsub.ChannelGoalEndData(client: EventSubClient, data: dict)#
A goal end event
- user#
The broadcaster that ended the goal
- Type
- started_at#
The datetime the goal was started
- Type
- ended_at#
The datetime the goal was ended
- Type
- class twitchio.ext.eventsub.CustomReward(data, broadcaster)#
A Custom Reward
- broadcaster#
The channel that has this reward
- Type
- enabled#
Whether or not the reward is enabled. Will be None for Redemption events.
- Type
Optional[
bool
]
- paused#
Whether or not the reward is paused. Will be None for Redemption events.
- Type
Optional[
bool
]
- in_stock#
Whether or not the reward is in stock. Will be None for Redemption events.
- Type
Optional[
bool
]
- cooldown_until#
How long until the reward is off cooldown and can be redeemed again. Will be None for Redemption events.
- Type
Optional[
datetime.datetime
]
- input_required#
Whether or not the reward requires an input. Will be None for Redemption events.
- Type
Optional[
bool
]
- redemptions_skip_queue#
Whether or not redemptions for this reward skips the queue. Will be None for Redemption events.
- Type
Optional[
bool
]
- redemptions_current_stream#
How many redemptions of this reward have been redeemed for this stream. Will be None for Redemption events.
- Type
Optional[
int
]
- max_per_stream#
Whether or not a per-stream redemption limit is in place, and if so, the maximum number of redemptions allowed per stream. Will be None for Redemption events.
- max_per_user_per_stream#
Whether or not a per-user-per-stream redemption limit is in place, and if so, the maximum number of redemptions allowed per user per stream. Will be None for Redemption events.
- cooldown#
Whether or not a global cooldown is in place, and if so, the number of seconds until the reward can be redeemed again. Will be None for Redemption events.
- class twitchio.ext.eventsub.CustomRewardAddUpdateRemoveData(client: EventSubClient, data: dict)#
A Custom Reward Add/Update/Remove event
- broadcaster#
The channel the custom reward was modified in
- Type
- reward#
The reward object
- Type
- class twitchio.ext.eventsub.CustomRewardRedemptionAddUpdateData(client: EventSubClient, data: dict)#
A Custom Reward Redemption event
- broadcaster#
The channel the redemption occurred in
- Type
- user#
The user that redeemed the reward
- Type
- redeemed_at#
When the reward was redeemed at
- Type
- reward#
The reward object
- Type
- class twitchio.ext.eventsub.HypeTrainContributor(client: EventSubClient, data: dict)#
A Contributor to a Hype Train
- user#
The user
- Type
- class twitchio.ext.eventsub.HypeTrainBeginProgressData(client: EventSubClient, data: dict)#
A Hype Train Begin/Progress event
- broadcaster#
The channel the Hype Train occurred in
- Type
- started#
When the Hype Train started
- Type
- expires#
When the Hype Train ends
- Type
- top_contributions#
The top contributions of the Hype Train
- Type
List[
HypeTrainContributor
]
- last_contribution#
The last contributor to the Hype Train
- Type
- class twitchio.ext.eventsub.HypeTrainEndData(client: EventSubClient, data: dict)#
A Hype Train End event
- broadcaster#
The channel the Hype Train occurred in
- Type
- started#
When the Hype Train started
- Type
- top_contributions#
The top contributions of the Hype Train
- Type
List[
HypeTrainContributor
]
- cooldown_ends_at#
When another Hype Train can begin
- Type
- class twitchio.ext.eventsub.PollChoice(data)#
A Poll Choice
- bits_votes#
How many votes were cast using Bits
Warning
Twitch have removed support for voting with bits. This will return as 0
- Type
- class twitchio.ext.eventsub.BitsVoting(data)#
Information on voting on a poll with Bits
- class twitchio.ext.eventsub.ChannelPointsVoting(data)#
Information on voting on a poll with Channel Points
- class twitchio.ext.eventsub.PollStatus(value)#
The status of a poll.
ACTIVE: Poll is currently in progress. COMPLETED: Poll has reached its ended_at time. TERMINATED: Poll has been manually terminated before its ended_at time. ARCHIVED: Poll is no longer visible on the channel. MODERATED: Poll is no longer visible to any user on Twitch. INVALID: Something went wrong determining the state.
- class twitchio.ext.eventsub.PollBeginProgressData(client: EventSubClient, data: dict)#
A Poll Begin/Progress event
- broadcaster#
The channel the poll occured in
- Type
- choices#
The choices in the poll
- Type
List[
PollChoice
]
- bits_voting#
Information on voting on the poll with Bits
Warning
Twitch have removed support for voting with bits.
- Type
- channel_points_voting#
Information on voting on the poll with Channel Points
- Type
- started_at#
When the poll started
- Type
- ends_at#
When the poll is set to end
- Type
- ...
- class twitchio.ext.eventsub.PollEndData(client: EventSubClient, data: dict)#
A Poll End event
- broadcaster#
The channel the poll occured in
- Type
- choices#
The choices in the poll
- Type
List[
PollChoice
]
- bits_voting#
Information on voting on the poll with Bits
Warning
Twitch have removed support for voting with bits.
- Type
- channel_points_voting#
Information on voting on the poll with Channel Points
- Type
- status#
How the poll ended
- Type
- started_at#
When the poll started
- Type
- ended_at#
When the poll is set to end
- Type
- class twitchio.ext.eventsub.Predictor(client: EventSubClient, data: dict)#
A Predictor
- user#
The user who predicted an outcome
- Type
- class twitchio.ext.eventsub.PredictionOutcome(client: EventSubClient, data: dict)#
A Prediction Outcome
- class twitchio.ext.eventsub.PredictionStatus(value)#
The status of a Prediction.
ACTIVE: Prediction is active and viewers can make predictions. LOCKED: Prediction has been locked and viewers can no longer make predictions. RESOLVED: A winning outcome has been chosen and the Channel Points have been distributed to the users who guessed the correct outcome. CANCELED: Prediction has been canceled and the Channel Points have been refunded to participants.
- class twitchio.ext.eventsub.PredictionBeginProgressData(client: EventSubClient, data: dict)#
A Prediction Begin/Progress event
- broadcaster#
The channel the prediction occured in
- Type
- outcomes#
The outcomes for the prediction
- Type
List[
PredictionOutcome
]
- started_at#
When the prediction started
- Type
- locks_at#
When the prediction is set to be locked
- Type
- class twitchio.ext.eventsub.PredictionLockData(client: EventSubClient, data: dict)#
A Prediction Begin/Progress event
- broadcaster#
The channel the prediction occured in
- Type
- outcomes#
The outcomes for the prediction
- Type
List[
PredictionOutcome
]
- started_at#
When the prediction started
- Type
- locked_at#
When the prediction was locked
- Type
- class twitchio.ext.eventsub.PredictionEndData(client: EventSubClient, data: dict)#
A Prediction Begin/Progress event
- broadcaster#
The channel the prediction occured in
- Type
- outcomes#
The outcomes for the prediction
- Type
List[
PredictionOutcome
]
- status#
How the prediction ended
- Type
- started_at#
When the prediction started
- Type
- ended_at#
When the prediction ended
- Type
- class twitchio.ext.eventsub.StreamOnlineData(client: EventSubClient, data: dict)#
A Stream Start event
- broadcaster#
The channel that went live
- Type
- type#
One of “live”, “playlist”, “watch_party”, “premier”, or “rerun”. The type of live event.
- Type
- started_at#
- Type
- class twitchio.ext.eventsub.StreamOfflineData(client: EventSubClient, data: dict)#
A Stream End event
- broadcaster#
The channel that stopped streaming
- Type
- class twitchio.ext.eventsub.UserAuthorizationRevokedData(client: EventSubClient, data: dict)#
An Authorization Revokation event
- user#
The user that has revoked authorization for your app
- Type
- class twitchio.ext.eventsub.UserUpdateData(client: EventSubClient, data: dict)#
A User Update event
- user#
The user that was updated
- Type
- class twitchio.ext.eventsub.ChannelCharityDonationData(client: EventSubClient, data: dict)#
Represents a donation towards a charity campaign.
Requires the
channel:read:charity
scope.- broadcaster#
The broadcaster running the campaign.
- Type
- user#
The user who donated.
- Type
- class twitchio.ext.eventsub.ChannelUnbanRequestCreateData(client: EventSubClient, data: dict)#
Represents an unban request created by a user.
- broadcaster#
The broadcaster from which the user was banned.
- Type
- user#
The user that was banned.
- Type
- created_at#
When the user submitted the request.
- Type
- class twitchio.ext.eventsub.ChannelUnbanRequestResolveData(client: EventSubClient, data: dict)#
Represents an unban request that has been resolved by a moderator.
- broadcaster#
The broadcaster from which the user was banned.
- Type
- user#
The user that was banned.
- Type
- moderator#
The moderator that handled this unban request.
- Type
- class twitchio.ext.eventsub.AutomodMessageHoldData(client: EventSubClient, data: dict)#
Represents a message being held by automod for manual review.
- broadcaster#
The broadcaster from which the message was held.
- Type
- user#
The user that sent the message.
- Type
- created_at#
When this message was held.
- Type
- message_fragments#
The fragments of this message. This includes things such as emotes and cheermotes. An example from twitch is provided:
{ "emotes": [ { "text": "badtextemote1", "id": "emote-123", "set-id": "set-emote-1" }, { "text": "badtextemote2", "id": "emote-234", "set-id": "set-emote-2" } ], "cheermotes": [ { "text": "badtextcheermote1", "amount": 1000, "prefix": "prefix", "tier": 1 } ] }
- Type
- class twitchio.ext.eventsub.AutomodMessageUpdateData(client: EventSubClient, data: dict)#
Represents a message that was updated by a moderator in the automod queue.
- broadcaster#
The broadcaster from which the message was held.
- Type
- user#
The user that sent the message.
- Type
- moderator#
The moderator that updated the message status.
- Type
- created_at#
When this message was held.
- Type
- message_fragments#
The fragments of this message. This includes things such as emotes and cheermotes. An example from twitch is provided:
{ "emotes": [ { "text": "badtextemote1", "id": "emote-123", "set-id": "set-emote-1" }, { "text": "badtextemote2", "id": "emote-234", "set-id": "set-emote-2" } ], "cheermotes": [ { "text": "badtextcheermote1", "amount": 1000, "prefix": "prefix", "tier": 1 } ] }
- Type
- class twitchio.ext.eventsub.AutomodSettingsUpdateData(client: EventSubClient, data: dict)#
Represents a channels automod settings being updated.
- broadcaster#
The broadcaster for which the settings were updated.
- Type
- moderator#
The moderator that updated the settings.
- Type
- overall :class:`int` | ``None``
The overall level of automod aggressiveness.
- class twitchio.ext.eventsub.AutomodTermsUpdateData(client: EventSubClient, data: dict)#
Represents a channels automod terms being updated.
Note
Private terms are not sent.
- broadcaster#
The broadcaster for which the terms were updated.
- Type
- moderator#
The moderator who updated the terms.
- Type
- class twitchio.ext.eventsub.SuspiciousUserUpdateData(client: EventSubClient, data: dict)#
Represents a suspicious user update event.
- broadcaster#
The channel where the treatment for a suspicious user was updated.
- Type
- moderator#
The moderator who updated the terms.
- Type
- user#
The the user that sent the message.
- Type
- trust_status#
The status set for the suspicious user. Can be the following: “none”, “active_monitoring”, or “restricted”.
- Type
Literal["active_monitoring", "restricted", "none"]
- class twitchio.ext.eventsub.ChannelModerateData(client: EventSubClient, data: dict)#
Represents a channel moderation event.
- broadcaster#
The channel where the moderation event occurred.
- Type
- moderator#
The moderator who performed the action.
- Type
- mod#
Metadata associated with the mod command.
- Type
Optional[
ModeratorStatus
]
- unmod#
Metadata associated with the mod command.
- Type
Optional[
ModeratorStatus
]
- timeout#
Metadata associated with the timeout command.
- Type
Optional[
TimeoutStatus
]
- untimeout#
Metadata associated with the untimeout command.
- Type
Optional[
TimeoutStatus
]
- raid#
Metadata associated with the raid command.
- Type
Optional[
RaidStatus
]
- unraid#
Metadata associated with the unraid command.
- Type
Optional[
RaidStatus
]
- automod_terms#
Metadata associated with the automod terms changes.
- Type
Optional[
AutoModTerms
]
- unban_request#
Metadata associated with an unban request.
- Type
Optional[
UnBanRequest
]
- class AutoModTerms(data: dict)#
Metadata associated with the automod terms change.
- action#
Either “add” or “remove”.
- Type
Literal["add", "remove"]
- list#
Either “blocked” or “permitted”.
- Type
Literal["blocked", "permitted"]
- class BanStatus(client: EventSubClient, data: dict)#
Metadata associated with the ban / unban command.
- user#
The user who is banned / unbanned.
- Type
- class Delete(client: EventSubClient, data: dict)#
Metadata associated with the delete command.
- user#
The user who is timedout / untimedout.
- Type
- class ModeratorStatus(client: EventSubClient, data: dict)#
Metadata associated with the mod / unmod command.
- user#
The user who is gaining or losing moderator access.
- Type
- class RaidStatus(client: EventSubClient, data: dict)#
Metadata associated with the raid / unraid command.
- user#
The user who is timedout / untimedout.
- Type
- class TimeoutStatus(client: EventSubClient, data: dict)#
Metadata associated with the timeout / untimeout command.
- user#
The user who is timedout / untimedout.
- Type
- expires_at#
Datetime the timeout expires.
- Type
Optional[
datetime.datetime
]
- class UnBanRequest(client: EventSubClient, data: dict)#
Metadata associated with the slow command.
- user#
The user who is requesting an unban.
- Type
- class VIPStatus(client: EventSubClient, data: dict)#
Metadata associated with the vip / unvip command.
- user#
The user who is gaining or losing VIP access.
- Type
- class twitchio.ext.eventsub.ChannelAdBreakBeginData(client: EventSubClient, data: dict)#
An ad begin event.
- broadcaster#
The channel where a midroll commercial break has started running.
- Type
- requester#
The user who started the ad break. Will be
None
ifis_automatic
isTrue
.- Type
Optional[
twitchio.PartialUser
]
- started_at#
When the ad began.
- Type
- class twitchio.ext.eventsub.ChannelVIPAddRemove(client: EventSubClient, data: dict)#
Represents a VIP being added/removed from a channel.
- broadcaster#
The channel that the VIP was added/removed from.
- Type
- user#
The user that was added/removed as a VIP.
- Type
- class twitchio.ext.eventsub.AutoCustomReward(data: dict)#
A reward object for an Auto Reward Redeem.
- type#
The type of the reward. One of
single_message_bypass_sub_mode
,send_highlighted_message
,random_sub_emote_unlock
,chosen_sub_emote_unlock
,chosen_modified_sub_emote_unlock
,message_effect
,gigantify_an_emote
,celebration
.- Type
- class twitchio.ext.eventsub.AutoRewardRedeem(client: EventSubClient, data: dict)#
Represents an automatic reward redemption.
- broadcaster#
The channel where the reward was redeemed.
- Type
- user#
The user that redeemed the reward.
- Type
- reward#
The reward that was redeemed.
- Type
- redeemed_at#
When the reward was redeemed.
- Type