Discord.Net.Extensions 1.2.0

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

// Install Discord.Net.Extensions as a Cake Tool
#tool nuget:?package=Discord.Net.Extensions&version=1.2.0                

➕ Discord.Net.Extensions

This package introduces a number of features that assist Discord.Net as a library. It attempts to make work for the developer easier, by introducing extensions that perfectly support development needs.

ℹī¸ How to install

Grabbing the package from NuGet:

The Discord.Net.Extensions package is available on Nuget or through the package manager:

  • PM> Install-Package Discord.Net.Extensions -Version 1.2.0

Installing from Visual Studio:

Just like Discord.Net, Discord.Net.Extensions is available from the NuGet package manager built into VS:

Go to the Manager

Applying namespaces:

The naming of this package follows that of Discord.Net:

using Discord;
using Discord.Extensions;

Because the package is seperate, and not a part of the library itself, it levels down a single name on the namespace. It does still follow the naming of Discord.Net itself however:

using Discord.Interactions;
using Discord.Extensions.Interactions;

Depending on the namespace of the type you're looking to target, its extensions will be in the matching Extensions namespace.

📑 Features

Below a number of features is covered, including notices of logic, examples or exceptions.

🌐 Core

Message Formatting support

  • MessageBuilder has been introduced to allow for large text message creation to look a lot cleaner & helps avoid a lot of markdown errors.

Alternatively, inside the DiscordFormattingExtensions class a large amount of formatting extensions exist, allowing developers to customize messages with ease.

Builder Factories

  • EmbedBuilderFactory
  • ComponentBuilderFactory
  • ModalBuilderFactory

These factories generate builders based on the actions defined in BuilderSettings. View the Samples for how to use it.

💤 Rest

In progress...

⚡ Websocket

In progress...

đŸĒ Webhook

In progress...

❗ Commands

In progress...

⭕ Interactions

IModal to ModalBuilder support

Thanks to the design of modals in Discord.Net, a few extensions have been added to turn IModal's into ModalBuilder's with populated values.

Generic Context Generation

For each type of Interaction a method has been introduced to automatically generate generic IInteractionContext, supporting the use-case of XInteractionContext<XInteraction>.

View the Samples to learn how to use these methods.

Type converters for commands, modals & components.

  • TypeReaders

    • Color
    • TimeSpan*
    • Guid
    • IEmote**
  • TypeConverters

    • Color
    • TimeSpan*
    • UInt64***
    • IEmote**
  • ComponentTypeConverters

    • Color
    • TimeSpan*
    • IEmote**

* The TimeSpan converters run through a reader far more advanced than a simple TryParse. It supports formatting such as: 1d16h10m up to 10 weeks, 4 months & 7 seconds. Parsing does not respect order, and works in any format.

** The IEmote converters support Emoji and Emote. Both can be parsed from this parser. However, the parameter implementation will have to be IEmote as well, regardless of the underlying type.

*** The UInt64 (ulong) converter is introduced because the Int64 (number) parameter from discord does not support unsigned positive characters up to the height of Discord snowflake ID's.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Release 1.2, Supporting Discord.Net 3.6.1+