izolabella.Discord
6.1.1
dotnet add package izolabella.Discord --version 6.1.1
NuGet\Install-Package izolabella.Discord -Version 6.1.1
<PackageReference Include="izolabella.Discord" Version="6.1.1" />
paket add izolabella.Discord --version 6.1.1
#r "nuget: izolabella.Discord, 6.1.1"
// Install izolabella.Discord as a Cake Addin
#addin nuget:?package=izolabella.Discord&version=6.1.1
// Install izolabella.Discord as a Cake Tool
#tool nuget:?package=izolabella.Discord&version=6.1.1
💞 izolabella.Discord
This project is an alternative to the command handler provided by Discord.NET for providing more detail to commands in a lightweight manner.
🌸 Quality Status
👩💻 Getting Started
This project is available through NuGet.org;
- Package Manager (Visual Studio)
Install-Package izolabella.Discord
- .NET CLI
dotnet add package izolabella.Discord
This project uses Discord.NET to function!*
⌨️ Code
A new instance of the IzolabellaDiscordCommandClient
class must be initialized. The class takes a DiscordSocketConfig
argument for the client, and a bool
for whether or not the commands should be updated per guild or globally.
IzolabellaDiscordCommandClient Client = new(new DiscordSocketConfig(), false);
The current version of this library uses classes for commands. To create a command, create a class that inherits the interface IIzolabellaCommand
. These classes must have parameterless constructors.
namespace MyDiscordBot.Commands
{
public class MyCommand : IIzolabellaCommand
{
public string Name => "Command";
public string Description => "My command's description.'";
public bool GuildsOnly => true;
public List<IIzolabellaCommandConstraint> Constraints { get; } = new();
public IzolabellaCommandParameter[] Parameters => new[]
{
new IzolabellaCommandParameter("Param", "This is my parameter!", ApplicationCommandOptionType.Channel, true)
};
public Task RunAsync(CommandContext Context, IzolabellaCommandArgument[] Arguments)
{
// command runs here!
}
public Task OnLoadAsync(IIzolabellaCommand[] AllCommands)
{
// runs when all commands have been initialized - fired once.
}
public Task OnConstrainmentAsync(CommandContext Context, IzolabellaCommandArgument[] Arguments, IIzolabellaCommandConstraint ConstraintThatFailed)
{
// when one of the constrainments don't pass the validity check by the handler, this method gets called.
}
}
}
To get things going, call the following method on the IzolabellaDiscordCommandClient
instance you have created:
await Client.StartAsync();
I want to make this as useable as possible for you. I have no in-depth documentation since things are currently changing rapidly. For questions and how-tos, please send me a request on Discord at izolabella.bin#0216
.
Product | Versions 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. |
-
net6.0
- Discord.Net (>= 3.7.0)
- Discord.Net.Core (>= 3.7.0)
- Discord.Net.Rest (>= 3.7.0)
- Discord.Net.Webhook (>= 3.7.0)
- Discord.Net.WebSocket (>= 3.7.0)
- izolabella.PrettyConsole (>= 1.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|
Fixed logic error.