YappersHQ.ChatProcessor.Shared
1.0.1
dotnet add package YappersHQ.ChatProcessor.Shared --version 1.0.1
NuGet\Install-Package YappersHQ.ChatProcessor.Shared -Version 1.0.1
<PackageReference Include="YappersHQ.ChatProcessor.Shared" Version="1.0.1" />
<PackageVersion Include="YappersHQ.ChatProcessor.Shared" Version="1.0.1" />
<PackageReference Include="YappersHQ.ChatProcessor.Shared" />
paket add YappersHQ.ChatProcessor.Shared --version 1.0.1
#r "nuget: YappersHQ.ChatProcessor.Shared, 1.0.1"
#:package YappersHQ.ChatProcessor.Shared@1.0.1
#addin nuget:?package=YappersHQ.ChatProcessor.Shared&version=1.0.1
#tool nuget:?package=YappersHQ.ChatProcessor.Shared&version=1.0.1
<div align="center"> <h1><strong>ChatProcessor</strong></h1> <p>Rewrite CS2 player chat through a single SayText2 hook — color tokens, team/dead/spec prefixes, and a pub/sub API for other plugins.</p> </div>
<p align="center"> <a href="https://github.com/Kxnrl/modsharp-public"><img src="https://img.shields.io/badge/framework-ModSharp-5865F2?logo=github" alt="ModSharp"></a> <img src="https://img.shields.io/badge/game-CS2-orange" alt="CS2"> <img src="https://img.shields.io/badge/license-MIT-green" alt="MIT"> <img src="https://img.shields.io/gitlab/stars/cs2-server-plugins/cs2-chat-processor?gitlab_url=https%3A%2F%2Fgitlab.com" alt="Stars"> </p>
ChatProcessor is a ModSharp module for Counter-Strike 2 that intercepts outgoing SayText2 chat messages and re-renders them. It bakes {token} color codes into the line, preserves the engine's team/dead/spectator prefixes, and exposes a PreProcess / PostProcess event API so other plugins can rewrite or cancel chat before it reaches clients.
🚀 Install
Copy the build output into your ModSharp install (<sharp> = your sharp directory):
| From | To |
|---|---|
.build/modules/ChatProcessor.Core/ |
<sharp>/modules/ChatProcessor.Core/ |
.build/shared/ChatProcessor.Shared/ |
<sharp>/shared/ChatProcessor.Shared/ |
.assets/configs/cs2-chat-processor.json |
<sharp>/configs/cs2-chat-processor.json |
.assets/locales/cs2-chat-processor.json |
<sharp>/locales/cs2-chat-processor.json |
Restart the server (or change map) to load. The config is auto-created with defaults on first run if missing.
⚙️ Configuration
configs/cs2-chat-processor.json (auto-generated on first run):
| Setting | Default | Meaning |
|---|---|---|
enabled |
true |
Master switch. When false, chat passes through untouched. |
Color tokens
{token} placeholders in a name or message are replaced with CS2 chat color escapes:
| Tokens | Color |
|---|---|
{white}, {default} |
White |
{team}, {teamcolor}, {pink} |
Pink (team color) |
{darkred}, {red}, {lightred} |
Reds |
{green}, {lightgreen}, {lime} |
Greens |
{blue}, {lightblue}, {darkblue} |
Blues |
{yellow}, {gold} |
Yellow / Gold |
{grey} / {gray}, {silver}, {muted}, {purple} |
Greys / Silver / Muted / Purple |
🔧 How it works
The plugin hooks the outgoing CS_UM_SayText2 / UM_SayText2 net messages. For each real (non-bot) player message it resolves the sender, raises PreProcess (subscribers may edit fields or set Cancel), then bakes the formatted line — team/dead/spec prefix + colored name + colored message — directly into Messagename as a literal. This is required because CS2 strips chat color escapes from the Param1/Param2 substitution slots, so colors only render when inlined into the message-name string itself. After rewriting, PostProcess fires for observers.
🧩 Public API
Other plugins consume IChatProcessorShared (resolve in OnAllModulesLoaded) and subscribe to the chat pipeline:
var chat = sharpModuleManager
.GetOptionalSharpModuleInterface<IChatProcessorShared>(IChatProcessorShared.Identity)?.Instance;
chat.PreProcess += msg =>
{
// Rewrite name/message, or drop the line entirely:
msg.Name = "{green}" + msg.Name;
// msg.Cancel = true; // suppress this message
};
PreProcess runs before the line is rewritten (mutate ChatMessage or set Cancel); PostProcess runs after, for read-only observation. ChatMessage carries SteamId, Client, IsTeam, Name, Message, Format, and Cancel.
📦 Build
dotnet build -c Release
Outputs the module to .build/modules/ChatProcessor.Core/ and the public contract to .build/shared/ChatProcessor.Shared/.
<div align="center"> <p>Made with ❤️ by <a href="https://gitlab.com/cs2-server-plugins">cs2-server-plugins</a></p> <p>⭐ Star this repo if you find it useful!</p> </div>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.