AutonomousKoi - Module: Twitch

The twitch module provides access to Twitch on behalf of other modules; it's not very useful on its own. There are three facets to Twitch access. The Twitch API allows tools to request information about the state of Twitch and to request for actions to be taken. Twitch EventSub provides notification about events, such as a streamer going live or a new follower. Twitch Chat provides access to real-time chat with stream participants.

Features

Token Management
A token is a secret value, similar to a password, that allows a program like AutonomousKoi to interact with Twitch on your behalf. The twitch module can obtain tokens for your accounts and warn you when they will expire soon and need to be refreshed. Other modules do not have access to these tokens; they ask the twitch module to perform actions using a specific token.
Chat Access
The module will connect to Twitch chat making those messages available to other modules. Other modules can ask the twitch module to send messages to chat. Messages sent by the module can feature a prefix (e.g. [bot]) to make it clear to other chatters that the message is coming from a bot. Additionally, the controls provide an interface to read and send messages to chat.
EventSub Access
Twitch's EventSub is a system that notifies programs when certain things happen, like chat messages arriving, raids, follows, subs, and much more. This module can receive EventSub messages and send them to other modules that are interested. It can optionally save a log of all events it receives which is primarily useful to developers.
Shoutout Queue
Twitch only lets you send shoutouts (/so) ones every two minutes and once per streamer every hour. This is a pain to keep track of. This module can receive requests from other modules to send shoutouts and it maintains a queue of such requests. Requests referring to a streamer that has received a shoutout less than an hour ago are ignored. Requests that can be fulfilled are remembered and processed as soon as possible, waiting 125 seconds between shoutouts.