NetCord.Hosting 1.0.0-alpha.97

Prefix Reserved
This is a prerelease version of NetCord.Hosting.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package NetCord.Hosting --version 1.0.0-alpha.97                
NuGet\Install-Package NetCord.Hosting -Version 1.0.0-alpha.97                
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="NetCord.Hosting" Version="1.0.0-alpha.97" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetCord.Hosting --version 1.0.0-alpha.97                
#r "nuget: NetCord.Hosting, 1.0.0-alpha.97"                
#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.
// Install NetCord.Hosting as a Cake Addin
#addin nuget:?package=NetCord.Hosting&version=1.0.0-alpha.97&prerelease

// Install NetCord.Hosting as a Cake Tool
#tool nuget:?package=NetCord.Hosting&version=1.0.0-alpha.97&prerelease                

NetCord

The modern and fully customizable C# Discord library

Table of Contents

  1. 📦 Installation
  2. 🚀 Showcase
  3. 🎨 Features
  4. 🥅 Goals
  5. 📚 Guides
  6. 📄 Documentation
  7. 🩹 Support
  8. 📜 License

1. 📦 Installation

You can install NetCord packages via NuGet package manager:

Package Description
NetCord Core package with fundamental functionality.
NetCord.Services Facilitates seamless handling of commands and interactions.
NetCord.Hosting Provides .NET Generic Host extensions for the NetCord package.
NetCord.Hosting.Services Provides .NET Generic Host extensions for the NetCord.Services package.
NetCord.Hosting.AspNetCore Provides ASP.NET Core extensions for seamless handling of HTTP interactions.

2. 🚀 Showcase

This snippet showcases a bot with a minimal API-style /square command and includes a module-based /greet command.

Minimal API-style Bot Example

The following example sets up a bot with a minimal API-style approach for the /square command, which calculates the square of a number:

var builder = Host.CreateDefaultBuilder(args)
    .UseDiscordGateway()
    .UseApplicationCommands<SlashCommandInteraction, SlashCommandContext>();

var host = builder.Build()
    .AddSlashCommand<SlashCommandContext>("square", "Square!", (int a) => $"{a}² = {a * a}")
    .UseGatewayEventHandlers();

await host.RunAsync();

Module-based Command Example

Moreover, you can use a module-based approach. Here's an example of a /greet command that greets a specified user:

public class GreetingModule : ApplicationCommandModule<SlashCommandContext>
{
    [SlashCommand("greet", "Greet someone!")]
    public string Greet(User user) => $"{Context.User} greets {user}!";
}

3. 🎨 Features

  • Fully Customizable - Easily tailor your Discord bot with NetCord's flexible, extensible API.
  • Easy to Use - Designed to be intuitive and easy to use for C# and .NET developers.
  • Lightweight & High Performance - Optimized for efficient resource use, ideal for scalable bots.
  • Fully Asynchronous - Built for responsive, concurrent operations in your bot.
  • Native AOT Support - Enjoy faster startups and reduced memory usage with AOT compilation.
  • Immutable Caching - Default immutable caching keeps data reliable and consistent.
  • Voice Support - Includes high-quality capabilities for sending and receiving voice.
  • HTTP Interactions - Easily handle interactions over HTTP without a persistent connection.
  • Dependency-Free - Lightweight by design, with no external dependencies required.
  • Stateless REST - Efficiently manage API requests with a stateless design.
  • Complete API Coverage - Comprehensive support for the Discord API and advanced features.
  • Open Source - Free to use and contribute to, licensed under MIT.

4. 🥅 Goals

NetCord's goal is to allow .NET developers to create fully customizable Discord bots without fighting the API wrapper itself. NetCord is designed to be easy to use and fully customizable, while still being lightweight and performant.

5. 📚 Guides

6. 📄 Documentation

7. 🩹 Support

8. 📜 License

This repository is released under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on NetCord.Hosting:

Package Downloads
NetCord.Hosting.Services

The modern and fully customizable C# Discord library.

NetCord.Hosting.AspNetCore

The modern and fully customizable C# Discord library.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on NetCord.Hosting:

Repository Stars
angelobreuer/Lavalink4NET
Lavalink4NET is a Lavalink wrapper with node clustering, caching and custom players for .NET with support for Discord.Net, DSharpPlus, Remora, and NetCord.
Version Downloads Last updated
1.0.0-alpha.100 83 11/18/2024
1.0.0-alpha.99 33 11/18/2024
1.0.0-alpha.98 33 11/18/2024
1.0.0-alpha.97 85 11/15/2024
1.0.0-alpha.96 141 10/13/2024
1.0.0-alpha.95 64 10/7/2024
1.0.0-alpha.94 56 10/1/2024
1.0.0-alpha.93 67 9/24/2024
1.0.0-alpha.92 43 9/23/2024
1.0.0-alpha.91 52 9/19/2024
1.0.0-alpha.90 82 9/14/2024
1.0.0-alpha.89 47 9/14/2024
1.0.0-alpha.88 51 9/13/2024
1.0.0-alpha.87 35 9/8/2024
1.0.0-alpha.86 50 9/4/2024
1.0.0-alpha.85 51 9/1/2024
1.0.0-alpha.84 47 8/31/2024
1.0.0-alpha.83 49 8/31/2024
1.0.0-alpha.82 50 8/30/2024
1.0.0-alpha.81 187 8/19/2024
1.0.0-alpha.80 106 8/9/2024
1.0.0-alpha.79 59 8/9/2024
1.0.0-alpha.78 50 8/8/2024
1.0.0-alpha.77 40 8/6/2024
1.0.0-alpha.76 68 7/26/2024
1.0.0-alpha.75 53 7/25/2024
1.0.0-alpha.74 41 7/25/2024
1.0.0-alpha.73 60 7/21/2024
1.0.0-alpha.72 53 7/10/2024
1.0.0-alpha.71 47 7/10/2024
1.0.0-alpha.70 39 7/9/2024
1.0.0-alpha.69 62 6/22/2024
1.0.0-alpha.68 87 6/2/2024
1.0.0-alpha.67 63 5/26/2024
1.0.0-alpha.66 62 5/26/2024
1.0.0-alpha.65 136 5/17/2024
1.0.0-alpha.64 66 5/17/2024
1.0.0-alpha.63 54 5/11/2024
1.0.0-alpha.62 78 5/5/2024
1.0.0-alpha.61 55 4/30/2024
1.0.0-alpha.60 58 4/28/2024
1.0.0-alpha.59 53 4/27/2024
1.0.0-alpha.58 63 4/27/2024
1.0.0-alpha.57 65 4/25/2024
1.0.0-alpha.56 57 4/25/2024
1.0.0-alpha.55 53 4/25/2024
1.0.0-alpha.54 55 4/25/2024
1.0.0-alpha.53 65 4/20/2024
1.0.0-alpha.52 57 4/19/2024
1.0.0-alpha.51 54 4/19/2024
1.0.0-alpha.50 115 4/6/2024
1.0.0-alpha.49 80 3/30/2024
1.0.0-alpha.48 69 3/24/2024
1.0.0-alpha.47 66 3/19/2024
1.0.0-alpha.46 61 3/15/2024
1.0.0-alpha.45 52 3/14/2024
1.0.0-alpha.44 48 3/14/2024
1.0.0-alpha.43 61 3/14/2024
1.0.0-alpha.42 63 3/9/2024
1.0.0-alpha.41 65 3/7/2024
1.0.0-alpha.40 713 2/29/2024
1.0.0-alpha.39 62 2/29/2024
1.0.0-alpha.38 55 2/27/2024
1.0.0-alpha.37 90 2/22/2024
1.0.0-alpha.36 67 2/21/2024
1.0.0-alpha.35 75 2/17/2024
1.0.0-alpha.34 59 2/17/2024
1.0.0-alpha.33 63 2/16/2024
1.0.0-alpha.32 66 2/15/2024
1.0.0-alpha.31 60 2/13/2024
1.0.0-alpha.30 98 2/10/2024
1.0.0-alpha.29 59 2/10/2024
1.0.0-alpha.28 58 2/9/2024
1.0.0-alpha.27 96 2/6/2024
1.0.0-alpha.26 59 2/6/2024
1.0.0-alpha.25 61 2/6/2024
1.0.0-alpha.24 64 2/4/2024
1.0.0-alpha.23 67 2/4/2024
1.0.0-alpha.22 59 2/3/2024
1.0.0-alpha.21 68 2/1/2024
1.0.0-alpha.20 73 1/27/2024
1.0.0-alpha.19 57 1/27/2024
1.0.0-alpha.18 62 1/23/2024
1.0.0-alpha.17 71 1/17/2024
1.0.0-alpha.16 69 1/16/2024
1.0.0-alpha.15 58 1/15/2024
1.0.0-alpha.14 66 1/15/2024
1.0.0-alpha.13 66 1/13/2024
1.0.0-alpha.12 110 12/29/2023
1.0.0-alpha.11 91 12/24/2023
1.0.0-alpha.10 77 12/23/2023
1.0.0-alpha.9 80 12/23/2023
1.0.0-alpha.8 73 12/23/2023
1.0.0-alpha.7 78 12/19/2023
1.0.0-alpha.6 66 12/18/2023
1.0.0-alpha.5 80 12/18/2023
1.0.0-alpha.4 64 12/17/2023
1.0.0-alpha.3 75 12/17/2023
1.0.0-alpha.2 88 12/14/2023
1.0.0-alpha.1 83 12/9/2023
1.0.0-alpha.0 71 12/8/2023