TwitcheryNet 0.0.3-prerelease
This is a prerelease version of TwitcheryNet.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package TwitcheryNet --version 0.0.3-prerelease
NuGet\Install-Package TwitcheryNet -Version 0.0.3-prerelease
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TwitcheryNet" Version="0.0.3-prerelease" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TwitcheryNet" Version="0.0.3-prerelease" />
<PackageReference Include="TwitcheryNet" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TwitcheryNet --version 0.0.3-prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TwitcheryNet, 0.0.3-prerelease"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TwitcheryNet@0.0.3-prerelease
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TwitcheryNet&version=0.0.3-prerelease&prerelease
#tool nuget:?package=TwitcheryNet&version=0.0.3-prerelease&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Twitchery.Net - A .NET library for Twitch
Freshly born library to access Twitch stuff, designed to be simple, efficient and easy to use. We want you to be able to create your own Twitch bots, chat clients, stream viewers, and more with ease.
This library is still under heavy development and not ready for production use.
You can check the current implementation status here: Implementation Status
Using Twitchery.Net: For Developers, Contributors and Testers
Getting Started as a Developer
- Create a new Twitch application at Twitch Developer Console
- Create a new .NET8+ project or open an existing one
- Install the library from NuGet:
dotnet add package TwitcheryNet --prerelease
- Start coding!
Example Usage
using TwitcheryNet.Models.Helix.Channels;
using TwitcheryNet.Services.Implementations;
const string myClientId = "your-client-id"; // Get this from your Twitch application
const string myRedirectUri = "http://localhost:8181"; // Must match the one in your Twitch application
var myScopes = new[]
{
"chat:read",
"chat:edit",
"user:read:chat",
"channel:moderate",
"channel:read:subscriptions",
"moderator:read:followers"
};
// Create a new Twitchery instance
var twitchery = new Twitchery();
// Authenticate with the user's default browser (Windows, Linux and OSX supported)
// If none is available, a URL will be printed to the console
await twitchery.UserBrowserAuthAsync(myClientId, myRedirectUri, myScopes);
// Print the user's display name
Console.WriteLine("Logged in as: " + twitchery.Me!.DisplayName);
// Get the authenticated user's channel
var myChannel = twitchery.Me.Channel;
// How many followers do I have?
// This will fetch all followers, so it may take a while if you have a lot
// In a future version, you'll be able to access the total amount and the recent followers more easy
var followerCount = 0;
Follower lastFollower = null;
await foreach (var follower in myChannel.Followers)
{
// The first follower in the list is the most recent one
if (lastFollower is null)
{
lastFollower = follower;
}
followerCount++;
}
Console.WriteLine("I have {0} followers", followerCount);
// Am I streaming right now?
var myStream = twitchery.Streams[twitchery.Me!.Login];
if (myStream is null)
{
Console.WriteLine("I'm not streaming right now");
}
else
{
Console.WriteLine("I'm streaming {0} for {1} viewers!", myStream.GameName, myStream.ViewerCount);
}
// Who was the last person to follow me?
Console.WriteLine("My last follower was {0}, who followed on {1}!", lastFollower.UserName, lastFollower.FollowedAt);
// Listen for events
myChannel.ChatMessage += (sender, e) =>
{
Console.WriteLine("{0} said: {1}", e.ChatterUserName, e.Message.Text);
return Task.CompletedTask;
};
myChannel.Follow += (sender, e) =>
{
Console.WriteLine("{0} followed me!", e.UserName);
return Task.CompletedTask;
};
myChannel.Subscribe += (sender, e) =>
{
Console.WriteLine("{0} subscribed to me!", e.UserName);
return Task.CompletedTask;
};
Console.WriteLine("Press any key to exit...");
// This is required to keep the bot running until the user presses a key
// To keep the bot running indefinitely, you can use `await Task.Delay(-1);`
await Task.Run(Console.ReadKey);
// Yes, it's that simple!
Getting Started as a Contributor
Follow the contribution guidelines in CONTRIBUTING.md to get started.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.0.3.1-prerelease | 80 | 9/29/2024 |
0.0.3-prerelease | 66 | 9/29/2024 |
0.0.2.4-prerelease | 79 | 9/27/2024 |
0.0.2.2-prerelease | 64 | 9/27/2024 |
0.0.2.1-prerelease | 72 | 9/27/2024 |
0.0.2-prerelease | 71 | 9/27/2024 |
0.0.1-prerelease | 74 | 9/20/2024 |