BSGameLib.Chat
1.0.4-preview
dotnet add package BSGameLib.Chat --version 1.0.4-preview
NuGet\Install-Package BSGameLib.Chat -Version 1.0.4-preview
<PackageReference Include="BSGameLib.Chat" Version="1.0.4-preview" />
<PackageVersion Include="BSGameLib.Chat" Version="1.0.4-preview" />
<PackageReference Include="BSGameLib.Chat" />
paket add BSGameLib.Chat --version 1.0.4-preview
#r "nuget: BSGameLib.Chat, 1.0.4-preview"
#:package BSGameLib.Chat@1.0.4-preview
#addin nuget:?package=BSGameLib.Chat&version=1.0.4-preview&prerelease
#tool nuget:?package=BSGameLib.Chat&version=1.0.4-preview&prerelease
BSGameLib.Chat
A chat and slash-command engine for games, with no networking of its own: hand it a line of text
and who said it, and it runs /commands with typed arguments or passes the line on as chat.
BSGameLib.Server wires it up for a dedicated server; on its own it works anywhere.
- Commands from a fluent builder, or from classes with
[Command]and parameter attributes. - Required and optional parameters, converted to their types; rest-of-line parameters.
- Command groups and sub-commands, with aliases; case-insensitive keywords.
%TOKENreplacements in messages.- Events for unknown commands and missing or wrong arguments, and help text and tab completion from the registered commands.
using BSGameLib.Chat;
var chat = new GameChat();
chat.CreateCommand("roll")
.WithKeywords("roll", "r")
.WithRequiredParameter<int>("sides", "Number of sides")
.WithHelpText("Rolls a die.")
.WithAction(ctx =>
{
var sides = ctx.GetParameterByName<int>("sides").Value;
Console.WriteLine($"{ctx.SourceTo<Player>().Name} rolled {Random.Shared.Next(1, sides + 1)}");
})
.Build();
chat.Handle(new Player { Name = "Ann" }, "/roll 20");
public class Player : IMessageSource
{
public string Name { get; set; }
}
public sealed class GameChat : BaseChatEngine<Player>
{
public GameChat() : base(commandProviders: null, commandFactoryProvider: null) { }
public override void Handle(Player source, string message)
{
if (TryHandleCommand(source, ref message))
return;
Console.WriteLine($"{source.Name}: {message}");
}
}
Documentation: https://docs.burningstormstudios.com/
| 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
- BSGameLib.Core (>= 1.0.3-preview)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BSGameLib.Chat:
| Package | Downloads |
|---|---|
|
BSGameLib.Server
A dedicated game server host on Microsoft.Extensions.Hosting: finds your game's handlers and services, registers them for dependency injection, listens over QUIC and runs a fixed-step game loop, as a console app or a systemd or Windows service. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.4-preview | 53 | 11/9/2026 |