BSGameLib.Chat 1.0.4-preview

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

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.
  • %TOKEN replacements 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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