|
1 | | -EventSub - Coming Soon |
2 | | -=========================== |
| 1 | +.. currentmodule:: twitchio.ext.eventsub |
| 2 | + |
| 3 | +.. _eventsub_ref: |
| 4 | + |
| 5 | +EventSub Ext |
| 6 | +============= |
| 7 | + |
| 8 | +The EventSub ext is made to receive eventsub webhook notifications from twitch. |
| 9 | +For those not familiar with eventsub, it allows you to subscribe to certain events, and when these events happen, |
| 10 | +Twitch will send you an HTTP request containing information on the event. This ext abstracts away the complex portions of this, |
| 11 | +integrating seamlessly into the twitchio Client event dispatching system. |
| 12 | + |
| 13 | +.. warning:: |
| 14 | + This ext requires you to have a public facing ip, and to be able to receive inbound requests. |
| 15 | + |
| 16 | +.. note:: |
| 17 | + Twitch requires EventSub targets to have TLS/SSL enabled (https). TwitchIO does not support this, as such you should |
| 18 | + use a reverse proxy such as ``nginx`` to handle TLS/SSL. |
| 19 | + |
| 20 | + |
| 21 | +A Quick Example |
| 22 | +================ |
| 23 | + |
| 24 | +.. code-block:: python3 |
| 25 | +
|
| 26 | + import twitchio |
| 27 | + from twitchio.ext import eventsub, commands |
| 28 | + bot = commands.Bot(token="...") |
| 29 | + eventsub_client = eventsub.EventSubClient(bot, "some_secret_string", "/callback") |
| 30 | + # when subscribing |
| 31 | +
|
| 32 | + await eventsub_client.subscribe_channel_subscribtions("channel_name") |
| 33 | +
|
| 34 | + @bot.event() |
| 35 | + async def eventsub_notification_subscription(payload: eventsub.ChannelSubscribeData): |
| 36 | + ... |
| 37 | +
|
| 38 | + bot.loop.create_task(eventsub_client.listen(port=4000)) |
| 39 | + bot.loop.create_task(bot.start()) |
| 40 | + bot.loop.run_forever() |
| 41 | +
|
| 42 | +Event Reference |
| 43 | +================ |
| 44 | +This is a list of events dispatched by the eventsub ext. |
| 45 | + |
| 46 | +.. function:: event_eventsub_revokation(event: RevokationEvent) |
| 47 | + |
| 48 | + Called when your app has had access revoked on a channel. |
| 49 | + |
| 50 | +.. function:: event_eventsub_webhook_callback_verification(event: ChallengeEvent) |
| 51 | + |
| 52 | + Called when Twitch sends a challenge to your server. |
| 53 | + |
| 54 | + .. note:: |
| 55 | + You generally won't need to interact with this event. The ext will handle responding to the challenge automatically. |
| 56 | + |
| 57 | +.. function:: event_eventsub_notification_follow(event: ChannelFollowData) |
| 58 | + |
| 59 | + Called when someone creates a follow on a channel you've subscribed to. |
| 60 | + |
| 61 | +.. function:: event_eventsub_notification_subscription(event: ChannelSubscribeData) |
| 62 | + |
| 63 | + Called when someone subscribes to a channel that you've subscribed to. |
| 64 | + |
| 65 | +.. function:: event_eventsub_notification_cheer(event: ChannelCheerData) |
| 66 | + |
| 67 | + Called when someone cheers on a channel you've subscribed to. |
| 68 | + |
| 69 | +.. function:: event_eventsub_notification_raid(event: Channel) |
| 70 | + |
| 71 | + Called when someone raids a channel you've subscribed to. |
| 72 | + |
| 73 | + |
| 74 | +API Reference |
| 75 | +================ |
| 76 | + |
| 77 | +.. attributetable:: EventSubClient |
| 78 | + |
| 79 | +.. autoclass:: EventSubClient |
| 80 | + :members: |
| 81 | + |
| 82 | +(The above is broken, and does not show members) |
| 83 | + |
| 84 | +.. attributetable:: Subscription |
| 85 | + |
| 86 | +.. autoclass:: Subscription |
| 87 | + :members: |
| 88 | + :inherited-members: |
| 89 | + |
| 90 | +.. attributetable:: Headers |
| 91 | + |
| 92 | +.. autoclass:: Headers |
| 93 | + :members: |
| 94 | + :inherited-members: |
| 95 | + |
| 96 | +.. attributetable::: ChannelBanData |
| 97 | +
|
| 98 | +.. autoclass:: ChannelBanData |
| 99 | + :members: |
| 100 | + :inherited-members: |
| 101 | + |
| 102 | +.. attributetable::: ChannelSubscribeData |
| 103 | +
|
| 104 | +.. autoclass:: ChannelSubscribeData |
| 105 | + :members: |
| 106 | + :inherited-members: |
| 107 | + |
| 108 | +.. attributetable::: ChannelCheerData |
| 109 | +
|
| 110 | +.. autoclass:: ChannelCheerData |
| 111 | + :members: |
| 112 | + :inherited-members: |
| 113 | + |
| 114 | +.. attributetable::: ChannelUpdateData |
| 115 | +
|
| 116 | +.. autoclass:: ChannelUpdateData |
| 117 | + :members: |
| 118 | + :inherited-members: |
| 119 | + |
| 120 | +.. attributetable::: ChannelFollowData |
| 121 | +
|
| 122 | +.. autoclass:: ChannelFollowData |
| 123 | + :members: |
| 124 | + :inherited-members: |
| 125 | + |
| 126 | +.. attributetable::: ChannelRaidData |
| 127 | +
|
| 128 | +.. autoclass:: ChannelRaidData |
| 129 | + :members: |
| 130 | + :inherited-members: |
| 131 | + |
| 132 | +.. attributetable::: ChannelModeratorAddRemoveData |
| 133 | +
|
| 134 | +.. autoclass:: ChannelModeratorAddRemoveData |
| 135 | + :members: |
| 136 | + :inherited-members: |
| 137 | + |
| 138 | +.. attributetable::: ChannelModeratorAddRemoveData |
| 139 | +
|
| 140 | +.. autoclass:: ChannelModeratorAddRemoveData |
| 141 | + :members: |
| 142 | + :inherited-members: |
| 143 | + |
| 144 | +.. attributetable::: CustomRewardAddUpdateRemoveData |
| 145 | +
|
| 146 | +.. autoclass:: CustomRewardAddUpdateRemoveData |
| 147 | + :members: |
| 148 | + :inherited-members: |
| 149 | + |
| 150 | +.. attributetable::: CustomRewardRedemptionAddUpdateData |
| 151 | +
|
| 152 | +.. autoclass:: CustomRewardRedemptionAddUpdateData |
| 153 | + :members: |
| 154 | + :inherited-members: |
| 155 | + |
| 156 | +.. attributetable::: HypeTrainContributor |
| 157 | +
|
| 158 | +.. autoclass:: HypeTrainContributor |
| 159 | + :members: |
| 160 | + :inherited-members: |
| 161 | + |
| 162 | +.. attributetable::: HypeTrainBeginProgressData |
| 163 | +
|
| 164 | +.. autoclass:: HypeTrainBeginProgressData |
| 165 | + :members: |
| 166 | + :inherited-members: |
| 167 | + |
| 168 | +.. attributetable::: HypeTrainEndData |
| 169 | +
|
| 170 | +.. autoclass:: HypeTrainEndData |
| 171 | + :members: |
| 172 | + :inherited-members: |
| 173 | + |
| 174 | +.. attributetable::: StreamOnlineData |
| 175 | +
|
| 176 | +.. autoclass:: StreamOnlineData |
| 177 | + :members: |
| 178 | + :inherited-members: |
| 179 | + |
| 180 | +.. attributetable::: StreamOfflineData |
| 181 | +
|
| 182 | +.. autoclass:: StreamOfflineData |
| 183 | + :members: |
| 184 | + :inherited-members: |
| 185 | + |
| 186 | +.. attributetable::: UserAuthorizationRevokedData |
| 187 | +
|
| 188 | +.. autoclass:: UserAuthorizationRevokedData |
| 189 | + :members: |
| 190 | + :inherited-members: |
| 191 | + |
| 192 | +.. attributetable::: UserUpdateData |
| 193 | +
|
| 194 | +.. autoclass:: UserUpdateData |
| 195 | + :members: |
| 196 | + :inherited-members: |
| 197 | + |
0 commit comments