Discord.InteractivityAddon 1.3.1

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

// Install Discord.InteractivityAddon as a Cake Tool
#tool nuget:?package=Discord.InteractivityAddon&version=1.3.1                

Discord.InteractivityAddon

NuGet BotFacility

This is an addon for the Discord API Wrapper Discord.Net which makes it easy to add interactivity to your discord bot.

Credits

Installation

The package can be pulled easily from NuGet.

Features

  • Waiting for a specific message or reaction using a powerful criteria system
  • Waiting for a message / reaction which passes your criteria
    • Run actions on filtered messages / reactions
  • Send and delete messages & files with delays
  • A powerful fully customizable Paginator
    • Send multi page messages
    • Move through pages using reactions
  • Fully customizable selection from a list of objects
    • Makes user input easy
    • Works via messages or reactions
    • For more customizability you can create your own child of the selection class
  • Confirmation of an action
  • Uptime counter

Usage

To properly use the features this addon provides you need the InteractivityService to your service provider.

var provider = new ServiceCollection()
                .AddSingleton(Client)
                .AddSingleton(CommandService)
                .AddSingleton(new InteractivityService(Client, TimeSpan.FromMinutes(3)))

This addon does not include a custom ModuleBase in order to support every command framework. (Discord.Net.Command/Qmmands/...)

Example Selection Command

[Command("select")]
public async Task ExampleSelectionAsync()
{
    var builder = new ReactionSelectionBuilder<string>()
        .WithValues("Hi", "How", "Hey", "Huh?!")
        .WithEmotes(new Emoji("💵"), new Emoji("🍭"), new Emoji("😩"), new Emoji("💠"))
        .WithUsers(Context.User)
        .WithAppearance(ReactionSelectionAppearanceBuilder.Default.WithDeletion(DeletionOption.AfterCapturedContext);

    var result = await _interactivity.SendSelectionAsync(await builder.Build(), Context.Channel, TimeSpan.FromSeconds(50));

    if (result.IsSuccess == true) {
        await Context.Channel.SendMessageAsync(result.Value.ToString());
    }
}

Example Paginator Command

[Command("paginator")]
public async Task ExamplePaginatorAsync()
{
    var pages = new List<Embed>() {
        new EmbedBuilder().WithTitle("I").Build(),
        new EmbedBuilder().WithTitle("am").Build(),
        new EmbedBuilder().WithTitle("cool").Build(),
        new EmbedBuilder().WithTitle(":sunglasses: ").Build(),
    };

    var paginator = new PaginatorBuilder()
        .WithEmbeds(pages.ToArray())
        .WithUsers(Context.User)
        .WithPaginatorFooter(PaginatorFooter.PageNumber | PaginatorFooter.Users)
        .Build();

    await _interactivity.SendPaginatorAsync(paginator, Context.Channel, TimeSpan.FromMinutes(2));
}

Example Confirmation Command

[Command("confirm")]
public async Task ExampleConfirmationAsync()
{
    var message = await Context.Channel.SendMessageAsync("Please confirm!");
    var request = new ConfirmationRequest(message, Context.User.Id);

    var result = await _interactivity.GetUserConfirmationAsync(request);

    if (result.Value == true) {
        await message.ModifyAsync(x => x.Content = "Confirmed :thumbsup:!");
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.

Version Downloads Last updated
2.4.1-preview-20212511.1 1,519 11/26/2021
2.4.1-preview-2021092110.1 210 9/10/2021
2.4.1-preview-20210624.1 348 6/23/2021
2.4.1-dev-20210513.1 846 5/13/2021
2.4.0 8,940 5/13/2021
2.4.0-dev-20210512.1 172 5/11/2021
2.4.0-dev-20210320.1 427 3/20/2021
2.4.0-dev-20210307.3 299 3/7/2021
2.1.1 1,034 7/10/2020
2.1.0 557 5/18/2020
2.0.5 551 5/18/2020
2.0.4 558 5/13/2020
2.0.3 609 1/31/2020
2.0.1 710 12/12/2019
2.0.0 578 12/6/2019
1.3.1 662 8/8/2019
1.3.0 715 5/16/2019
1.2.3 668 5/10/2019
1.2.2 669 4/30/2019
1.1.0 680 4/15/2019
0.9.5.1 707 4/8/2019
0.9.0 916 4/4/2019