Carubbi.ChatToKeys
2.2.0
dotnet add package Carubbi.ChatToKeys --version 2.2.0
NuGet\Install-Package Carubbi.ChatToKeys -Version 2.2.0
<PackageReference Include="Carubbi.ChatToKeys" Version="2.2.0" />
<PackageVersion Include="Carubbi.ChatToKeys" Version="2.2.0" />
<PackageReference Include="Carubbi.ChatToKeys" />
paket add Carubbi.ChatToKeys --version 2.2.0
#r "nuget: Carubbi.ChatToKeys, 2.2.0"
#:package Carubbi.ChatToKeys@2.2.0
#addin nuget:?package=Carubbi.ChatToKeys&version=2.2.0
#tool nuget:?package=Carubbi.ChatToKeys&version=2.2.0
Carubbi.ChatToKeys
Twitch IRC chat to Windows key bridge: listen to chat commands and send keystrokes to a target window. Runs from any Generic Host (console app, Windows service, etc.).
This is the modernized v2 line: the legacy .NET Framework 4.0 WinForms app built on SmartIrc4net + Microsoft.TestApi has been migrated to .NET 10 with MiniTwitch.Irc + InputSimulator.
Requirements
- .NET 10
- Windows 10/11 (key simulation uses
SendInputviaInputSimulator)
Packages
| Package | Purpose |
|---|---|
Carubbi.ChatToKeys |
Parser, Twitch client adapter, key sender, window activator, hosted service |
Carubbi.ChatToKeys.Interfaces |
Contracts (IChatClient, IKeySender, IWindowActivator, IChatCommandParser), options, records |
Chat syntax
MODE COMMAND [+ MODE COMMAND ...], case-insensitive. Mode defaults to PRESS.
| Token | Values |
|---|---|
| Command | ACTION (=Space), RESTART (=F2), LEFT, RIGHT, UP, DOWN |
| Mode | PRESS (tap), HOLD (key down), RELEASE (key up) |
Examples: UP, HOLD LEFT, HOLD LEFT+HOLD UP, RELEASE LEFT+RELEASE UP.
Breaking change vs v1: unknown commands/modes now throw
ArgumentExceptioninstead of silently defaulting toSpace. Empty messages are rejected.
Custom mapping and presets
Pass any command-to-key mapping at init — key names resolve against WindowsInput key codes (SPACE, F2, arrows, VK_C, ...):
builder.Services.AddChatToKeys(o =>
{
o.Channel = "rcarubbi";
o.Nick = "rcarubbi";
o.OAuthToken = Environment.GetEnvironmentVariable("TWITCH_OAUTH")!;
o.WindowTitle = "My Game Window";
o.StrictMapping = false; // unknown chat tokens are skipped instead of throwing
},
ChatToKeysPresets.Tetris());
Ship presets: ChatToKeysPresets.RetroPlatformer() (legacy arrows map), ChatToKeysPresets.Tetris() (LEFT/RIGHT/DOWN, ROTATE, DROP, HOLD, PAUSE). Or bind from appsettings.json:
{
"ChatToKeys": {
"Channel": "rcarubbi",
"StrictMapping": true,
"PerUserCooldownMs": 2000,
"Commands": { "JUMP": "SPACE", "HOLDITEM": "VK_C", "LEFT": "LEFT" }
}
}
PerUserCooldownMs ignores repeat messages from the same user inside the window (0 = disabled). Applies to both legacy and mapped paths.
Usage
using Carubbi.ChatToKeys;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddChatToKeys(o =>
{
o.Channel = "rcarubbi";
o.Nick = "rcarubbi";
o.OAuthToken = Environment.GetEnvironmentVariable("TWITCH_OAUTH")!;
o.WindowTitle = "My Game Window";
});
using var host = builder.Build();
await host.RunAsync();
Handle a message manually (e.g. custom transport):
var handler = host.Services.GetRequiredService<ChatMessageHandler>();
handler.Handle(new ChatMessage("#rcarubbi", "someuser", "HOLD LEFT"), "My Game Window");
List candidate windows:
var windows = host.Services.GetRequiredService<IWindowActivator>().ListVisibleWindows();
Building and testing locally
dotnet build Carubbi.ChatToKeys.slnx -c Release
dotnet run --project tests/Carubbi.ChatToKeys.Tests -c Release
Releasing
Tag v* triggers publish via trusted publishing (nuget/login, user rcarubbi):
git tag v2.0.0
git push origin master v2.0.0
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Carubbi.ChatToKeys.Interfaces (>= 2.2.0)
- InputSimulator (>= 1.0.4)
- Microsoft.Extensions.Hosting (>= 10.0.11)
- MiniTwitch.Irc (>= 3.1.0)
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 |
|---|---|---|
| 2.2.0 | 99 | 9/4/2026 |