import tmi from 'tmi.js' ; export interface TwitchChatConfig { channel : string ; botName : string ; botToken : string ; } export class TwitchChat { private client : tmi . Client ; private config : TwitchChatConfig ; constructor ( config ) { this . config = config ; this . client = tmi . client ( { identity : { username : this . config . botName , password : this . config . botToken , } , channels : [ this . config . channel ] , } ) ; } async send ( text ) { await this . client . connect ( ) ; await this . client . say ( this . config . channel , `/me ${ text }` ) ; await this . client . disconnect ( ) ; } }