Carubbi.ChatToKeys 2.2.0

dotnet add package Carubbi.ChatToKeys --version 2.2.0
                    
NuGet\Install-Package Carubbi.ChatToKeys -Version 2.2.0
                    
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="Carubbi.ChatToKeys" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Carubbi.ChatToKeys" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Carubbi.ChatToKeys" />
                    
Project file
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 Carubbi.ChatToKeys --version 2.2.0
                    
#r "nuget: Carubbi.ChatToKeys, 2.2.0"
                    
#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 Carubbi.ChatToKeys@2.2.0
                    
#: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=Carubbi.ChatToKeys&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Carubbi.ChatToKeys&version=2.2.0
                    
Install as a Cake Tool

NuGet NuGet downloads

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 SendInput via InputSimulator)

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 ArgumentException instead of silently defaulting to Space. 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 Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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