twitch-js
Version:
Javascript library for the Twitch Messaging Interface.
49 lines (48 loc) • 1.27 kB
TypeScript
import Chat, * as ChatTypes from './Chat';
import Api, * as ApiTypes from './Api';
import { LoggerOptions } from './utils/logger';
export { Chat, ChatTypes };
export { Api, ApiTypes };
export * from './twitch';
declare type BaseTwitchJsOptions = {
clientId?: string;
token?: string;
username?: string;
log?: LoggerOptions;
onAuthenticationFailure?: () => Promise<string>;
};
declare type IndividualClassOptions = {
chat?: ChatTypes.ChatOptions;
api?: ApiTypes.ApiOptions;
};
export declare type TwitchJsOptions = BaseTwitchJsOptions & IndividualClassOptions;
/**
* Interact with chat and make requests to Twitch API.
*
* ## Initializing
* ```
* const token = 'cfabdegwdoklmawdzdo98xt2fo512y'
* const username = 'ronni'
* const twitchJs = new TwitchJs({ token, username })
*
* twitchJs.chat.connect().then(globalUserState => {
* // Do stuff ...
* })
*
* twitchJs.api.get('channel').then(response => {
* // Do stuff ...
* })
* ```
*/
declare class TwitchJs {
chat: Chat;
api: Api;
static Chat: typeof Chat;
static Api: typeof Api;
constructor(options: TwitchJsOptions);
/**
* Update client options.
*/
updateOptions(options: IndividualClassOptions): void;
}
export default TwitchJs;