-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display ephemeral messages on restricted input on paginators and sele…
…ctions
- Loading branch information
Showing
11 changed files
with
156 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Discord; | ||
using Fergun.Interactive; | ||
using Fergun.Interactive.Selection; | ||
using Microsoft.Extensions.Localization; | ||
using System.Linq; | ||
|
||
namespace Fergun.Extensions; | ||
|
||
public static class SelectionExtensions | ||
{ | ||
/// <summary> | ||
/// Sets the localized prompts. | ||
/// </summary> | ||
/// <typeparam name="TSelection">The type of the built selection.</typeparam> | ||
/// <typeparam name="TOption">The type of the options.</typeparam> | ||
/// <typeparam name="TBuilder">The type of this builder.</typeparam> | ||
/// <param name="builder">The selection builder.</param> | ||
/// <param name="localizer">The localizer.</param> | ||
/// <returns>This builder.</returns> | ||
public static TBuilder WithLocalizedPrompts<TSelection, TOption, TBuilder>(this BaseSelectionBuilder<TSelection, TOption, TBuilder> builder, IStringLocalizer localizer) | ||
where TSelection : BaseSelection<TOption> | ||
where TBuilder : BaseSelectionBuilder<TSelection, TOption, TBuilder> | ||
{ | ||
builder.WithRestrictedPageFactory(users => new PageBuilder().WithDescription(localizer["RestrictedSelectionInputMessage", users.First().Mention]).WithColor(Color.Orange).Build()); | ||
|
||
return (TBuilder)builder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.