Skip to content

Event driven Twitch IRC library written in .NET 5

License

Notifications You must be signed in to change notification settings

JokkeeZ/Twitchie

Repository files navigation

Twitchie

Event driven Twitch IRC library written in .NET 5

MIT License

How to use it?

  1. Clone or download repository
  2. Build solution with Visual Studio
  3. Add built library to your project
  4. Obtain required chat oauth token. You can get it easily from here!
  5. Have fun

Example?

static async Task Main()
{
	// Initialize Twitchie instance, it will be disposed after ListenAsync ends.
	using var twitchie = new Twitchie();
	
	// Subscribe to events.
	twitchie.OnMessage += OnMessage;

	// Connect to Twitch IRC.
	await twitchie.ConnectAsync();
	
	// Login to Twitch IRC with lowercase username and OAuth token.
	await twitchie.LoginAsync(new("username", "oauth:password"));

	// Join some channel.
	await twitchie.JoinChannelAsync(new("#channel"));

	// Start loop which will receive messages until disposed/cancelled.
	await twitchie.ListenAsync();
}

static void OnMessage(object sender, MessageEventArgs e)
	=> Console.WriteLine($"User: {e.DisplayName} on channel: {e.Channel}: {e.Message}");

Dependencies

Twitchie doesn't use any external dependencies.