Discord.InteractivityAddon
2.0.1
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 2.0.1
NuGet\Install-Package Discord.InteractivityAddon -Version 2.0.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="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Discord.InteractivityAddon --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Discord.InteractivityAddon, 2.0.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=2.0.1 // Install Discord.InteractivityAddon as a Cake Tool #tool nuget:?package=Discord.InteractivityAddon&version=2.0.1
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.
Features
- Waiting for a message / reaction which passes your filter
- Run actions on filtered messages / reactions
- Delayed sending and deleting messages & files
- A powerful fully customizable Paginator
- Send multi page messages
- Move through pages using reactions
- You can choose between a static and a lazy loaded one
- Get more customizability by creating your own child of the
Paginator
&PaginatorBuilder
classes
- Fully customizable selection from a list of objects
- Works with messages or reactions
- Makes user input easy
- Get more customizability by creating your own child of the
Selection
&SelectionBuilder
classes
- Confirmation
- Uptime counter
Usage
To properly use the features this addon provides you need to add the InteractivityService
to your service provider.
var provider = new ServiceCollection()
.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: Waiting for Message
[Command("nextmessage")]
public async Task ExampleReplyNextMessageAsync()
{
var result = await Interactivity.NextMessageAsync(x => x.Author == Context.User);
if (result.IsSuccess == true) {
Interactivity.DelayedSendMessageAndDeleteAsync(
Context.Channel,
deleteDelay: TimeSpan.FromSeconds(20),
text: result.Value.Content,
embed: result.Value.Embeds.FirstOrDefault());
}
}
Example: Selection
[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)
.WithDeletion(DeletionOption.AfterCapturedContext | DeletionOption.Invalids);
var result = await Interactivity.SendSelectionAsync(builder.Build(), Context.Channel, TimeSpan.FromSeconds(50));
if (result.IsSuccess == true) {
await Context.Channel.SendMessageAsync(result.Value.ToString());
}
}
Example: Paginator
[Command("paginator")]
public Task PaginatorAsync()
{
var pages = new PageBuilder[] {
new PageBuilder().WithTitle("I"),
new PageBuilder().WithTitle("am"),
new PageBuilder().WithTitle("cool"),
new PageBuilder().WithTitle(":sunglasses:"),
new PageBuilder().WithText("I am cool :crown:")
};
var paginator = new StaticPaginatorBuilder()
.WithUsers(Context.User)
.WithPages(pages)
.WithFooter(PaginatorFooter.PageNumber | PaginatorFooter.Users)
.WithDefaultEmotes()
.Build();
return Interactivity.SendPaginatorAsync(paginator, Context.Channel, TimeSpan.FromMinutes(2));
}
Example: Confirmation
[Command("confirm")]
public async Task ConfirmAsync()
{
var request = new ConfirmationBuilder()
.WithContent(new PageBuilder().WithText("Please Confirm"))
.Build();
var result = await Interactivity.SendConfirmationAsync(request, Context.Channel);
if (result.Value == true)
{
await Context.Channel.SendMessageAsync("Confirmed :thumbsup:!");
}
else
{
await Context.Channel.SendMessageAsync("Declined :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.1.1)
- Discord.Net.WebSocket (>= 2.1.1)
- Qommon (>= 1.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,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 |