Adding Entity guides, flowcharts, better sample system. (#2054)
* initial * Interaction glossary entry * Sharded Interaction sample * Renames into solution * Debugging samples * Modify target location for webhookclient * Finalizing docs work, resolving docfx errors. * Adding threaduser to user chart * Add branch info to readme. * Edits to user chart * Resolve format for glossary entries * Patch sln target * Issue with file naming fixed * Patch 1/x for builds * Appending suggestions
This commit is contained in:
18
samples/InteractionFramework/Modules/ComponentModule.cs
Normal file
18
samples/InteractionFramework/Modules/ComponentModule.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Discord.Interactions;
|
||||
using Discord.WebSocket;
|
||||
using InteractionFramework.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InteractionFramework
|
||||
{
|
||||
// As with all other modules, we create the context by defining what type of interaction this module is supposed to target.
|
||||
internal class ComponentModule : InteractionModuleBase<SocketInteractionContext<SocketMessageComponent>>
|
||||
{
|
||||
// With the Attribute DoUserCheck you can make sure that only the user this button targets can click it. This is defined by the first wildcard: *.
|
||||
// See Attributes/DoUserCheckAttribute.cs for elaboration.
|
||||
[DoUserCheck]
|
||||
[ComponentInteraction("myButton:*")]
|
||||
public async Task ClickButtonAsync(string userId)
|
||||
=> await RespondAsync(text: ":thumbsup: Clicked!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user