Event Reference#

Introduction#

This page contains all events that the library will dispatch, including ext.commands and ext.eventsub. This page is a reference guide, and contains up-to-date information on all events the library can dispatch that are intended for public use.

How do I make an event listener#

events can be created using the @client.listener decorator, to which you can provide an event name, or you can name your function using the event name. You can check the examples for more information.

Alternatively, if using the commands ext, you can use @commands.listener decorator inside a Cog to create an event listener.

Can I make my own events?#

Sure! To make your own events, first make a listener using the steps above. Your event will have to take exactly one argument (you can make it None if you don’t need an argument).

Next, call Client.dispatch_listeners() with your event name (remove the event_ prefix when dispatching), and the argument. All of your listeners will run with the provided argument.

Core library events#

twitchio.event_shard_ready(shard_name: str)#

This event is called whenever a shard receives confirmation of authorization from twitch.

New in version 3.0.

Parameters#

shard_name: str

The name of the shard that is ready to receive data.

twitchio.event_shard_connect(shard_name: str)#

This event is called whenever a shard makes a connection to twitch.

New in version 3.0.

Parameters#

shard_name: str

The name of the shard that has connected.

twitchio.event_message(message: Message)#

This event is called whenever a chatter sends a message to a channel.

Changed in version 3.0: Removed ECHO messages.

Parameters#

message: Message

The message sent to the channel.

twitchio.event_join(chatter: PartialChatter)#

This event is called any time twitch sends a JOIN message. This indicates that a chatter has joined a channel (the specific channel can be accessed through chatter.channel).

Note

Typically these are sent in batches every few minutes. They are not very precise in timing.

Changed in version 3.0: Removed the channel argument.

Parameters#

chatter: PartialChatter

The chatter that joined.

twitchio.event_part(chatter: PartialChatter)#

This event is called any time twitch sends a PART message. This indicates that a chatter has left a channel (the specific channel can be accessed through chatter.channel).

Note

Typically these are sent in batches every few minutes. They are not very precise in timing.

Changed in version 3.0: Removed the channel argument.

Parameters#

chatter: PartialChatter

The chatter that left.

twitchio.event_raw_data(data: str)#

This event is a debug event, and should not be used for anything other than debugging.

Parameters#

data: str

The raw payload received from twitch.

Eventsub events#

TODO

Commands events#

TODO

pubsub events#

TODO