Skip to content

tomaspavlic/twitch-chat-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitch Chat Client

build downloads nuget

Twitch offers an IRC interface to our chat functionality. This allows you to, for instance:

Develop one or more bots for your channel. Connect to a channel’s chat with an IRC client instead of using the Web interface. Some developers prefer IRC because it fits their existing workflow - for example, when they already have several non-Twitch IRC channels. Other developers prefer IRC because it is lighter weight (for machines that are less powerful than the web interface).

The library currently support WebSocket only. The IRC will be implemented as well.

Installation

## .NET CLI
dotnet add package Topdev.Twitch.Chat.Client

## Package Manager
Install-Package Topdev.Twitch.Chat.Client

Usage

Connect

var client = new TwitchChatClient();

Subscribe for events

client.ConnectionClose += OnConnectionClosed;

Connect and receive messages

await client.ConnectAsync("oauth:bzccixdfsdf5uwz2qrlkad390jz1cp", "username", cts.Token);
var channel = await client.JoinChannelAsync("onscreen", cts.Token);
channel.MessageReceived += OnMessageReceived;

Get channel chat information

Get information like number of viewers, list of viewers, admins, staff, global mods, etc..

var info = await channel.GetChatInformationAsync();

How to generate OAuth token

To authenticate, your password (PASS) should be an OAuth token authorized through our API with the chat:read scope (to read messages) and the chat:edit scope (to send messages).

The token must have the prefix oauth:. For example, if your token is abcd, you send oauth:abcd. To quickly get a token for your account, use this Twitch Chat OAuth Password Generator.

Donations

Please feel free to donate to me. I'm not going to force you to donate, you can use my software completely free of charge and without limitation for any purpose you want. If you really want to give something to me then you are welcome to do so. I don't expect donations, nor do I insist that you give them.

ETH - 22a99ed4ebe631ff87332e6bcdcc6ef5ec01289f

Releases

No releases published

Packages

No packages published

Languages