Discord.InteractivityAddon
1.2.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Discord.InteractivityAddon --version 1.2.3
NuGet\Install-Package Discord.InteractivityAddon -Version 1.2.3
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.2.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Discord.InteractivityAddon --version 1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Discord.InteractivityAddon, 1.2.3"
#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.2.3 // Install Discord.InteractivityAddon as a Cake Tool #tool nuget:?package=Discord.InteractivityAddon&version=1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Discord.InteractivityAddon
This is an addon for the Discord API Wrapper Discord.Net which makes it easy to add interactivity to your discord bot.
Credits
- The package has been created with the support of TwentyFourMinutes. Check out his UtilityAddon which provides some great features for your bot 😃
- The criterion system is inspired by foxbot's Discord.Addons.Interactive package.
Features
- Waiting for a specific message or reaction using a powerful criteria system
- Applying a custom action to every message / reaction which passes your criteria
- Send and delete messages & files with delays
- A powerful Paginator
- Selection from a custom list of objects
- Confirmation of an action
- Uptime counter
Usage
To use this addons features you need to add an 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 SelectionBuilder<string>()
.WithSettings(allowCancel: true)
.WithUsers(Context.User)
.WithValues(new[] { "Hi", "How", "Hey", "Huh?!" })
.WithAppearance(SelectionAppearanceBuilder.Default
.WithSettings(deleteSelectionAfterCapturedResult: true));
//Note that the selection will not return the original ref but a clone!
var result = await _interactivity.GetUserSelectionAsync(builder.Build(), Context.Channel, TimeSpan.FromSeconds(50));
if (result.IsSuccess == true) {
await Context.Channel.SendMessageAsync(result.Value);
}
}
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 | Versions 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.
-
.NETStandard 2.0
- Discord.Net.Core (>= 2.0.1)
- Discord.Net.WebSocket (>= 2.0.1)
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,516 | 11/26/2021 |
2.4.1-preview-2021092110.1 | 207 | 9/10/2021 |
2.4.1-preview-20210624.1 | 345 | 6/23/2021 |
2.4.1-dev-20210513.1 | 843 | 5/13/2021 |
2.4.0 | 8,838 | 5/13/2021 |
2.4.0-dev-20210512.1 | 169 | 5/11/2021 |
2.4.0-dev-20210320.1 | 424 | 3/20/2021 |
2.4.0-dev-20210307.3 | 296 | 3/7/2021 |
2.1.1 | 1,031 | 7/10/2020 |
2.1.0 | 554 | 5/18/2020 |
2.0.5 | 548 | 5/18/2020 |
2.0.4 | 555 | 5/13/2020 |
2.0.3 | 606 | 1/31/2020 |
2.0.1 | 705 | 12/12/2019 |
2.0.0 | 573 | 12/6/2019 |
1.3.1 | 657 | 8/8/2019 |
1.3.0 | 710 | 5/16/2019 |
1.2.3 | 663 | 5/10/2019 |
1.2.2 | 664 | 4/30/2019 |
1.1.0 | 675 | 4/15/2019 |
0.9.5.1 | 702 | 4/8/2019 |
0.9.0 | 911 | 4/4/2019 |