Dart library for the Twitch Messaging Interface. (Twitch.tv)
🚨 Work In Progress - this package may have bugs unsuitable for production 🚨
Original repository by Ricardo Markiewicz // @gazeria.
This project is heavily inspired by the TMI.js project, a Node.js Package for Twitch Chat.
Install the dependency, create a client and start listening for chat events:
import 'package:tmi_dart_dart/tmi.dart' as tmi;
var client = tmi.Client(
channels: ['nodinawe', 'androidedelvalle'],
options: tmi.Options(
clientID: 'optional-client-id',
debug: true,
),
connection: tmi.Connection(secure: true, reconnect: true),
identity: tmi.Identity('username', 'oauth:access_token'),
);
client.connect();
client.on('message', (channel, userstate, message, self) {
if (self) return;
print('${channel}| ${userstate['display-name']}: ${message}');
});
Each event type can have different type por parameters. Check the current documentation to see how many events have the event.
In the future we may change this syntax to use a more type-safe event registration but for now this will work.
This is the current supported events. To know which parameters you will receive please check the source code or the TMI.js Documentation as a good reference.
This is the events that this library currently support (more will be added in the future):
- connecting
- logon
- ping
- pong
- connected
- disconnected
- resub
- subanniversary
- subscription
- subgift
- anonsubgift
- submysterygift
- anonsubmysterygift
- primepaidupgrade
- giftpaidupgrade
- anongiftpaidupgrade
- raided
- unhost
- hosting
- messagedeleted
- roomstate
- slow/slowmode
- followersonly/followersmode
- names
- join
- part
- whisper
- message
- hosted
- cheer
- action
- chat
- raw_message
- timeout
- ban
- vip
- vips
- mod
- mods
- notice
- globaluserstate
- emotesets