Skip to content

TOC2 client made in C#, for bots and client development.

License

Notifications You must be signed in to change notification settings

Animadoria/TOCSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TOCSharp

Quick TOC2 client I made. Works on the NINA server.

Has a command system inspired by DSharpPlus/Discord.NET.

Quick Start

Create an instance of TOCClient. Subscribe to events, and do ConnectAsync(). Note that ConnectAsync is non blocking and starts in a new thread!

Command System

You can subscribe to the IMReceived and ChatMessageReceived events and handle it manually, or use the Command System.

To use the Command System, use client.UseCommands(CommandSystemSettings):

CommandsSystem cmds = client.UseCommands(new CommandsSystemSettings()
  {
      StringPrefixes = new[] { "/" }
  });

Create a class that implements ICommandModule, and make a public command method with the [Command] attribute, with the parameter for the name(s) for that command. You must have at least one argument, CommandContext. The other arguments will be parsed automatically.

public class HelloCommand : ICommandModule
{
    [Command("hello")]
    public async Task Hello(CommandContext ctx, [RemainingText] string text)
    {
        await ctx.ReplyAsync($"Hello, {text}!");
    }
}

Don't forget to register it!

cmds.RegisterCommands(new HelloCommand());

About

TOC2 client made in C#, for bots and client development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •