[Feature] Initial user apps support (#2883)
* omg it kinda works somehow * more things added * a bit of xmldocs * added interaction framework support * working? IF * more builder stuff * space * rename attribute to prevent conflict with `ContextType` enum * context type * moar features * remove integration types * trigger workflow * modelzzzz * `InteractionContextType` * allow setting custom status with `SetGameAsync` * bugzzz * app permissions * message interaction context * hm * push for cd * structs lets goooo * whoops forgot to change types * whoops x2 * tweak some things * xmldocs + missing prop + fix enabled in dm * moar validations * deprecate a bunch of stuffz * disable moar obsolete warnings * add IF sample * Apply suggestions from code review Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com> * Update src/Discord.Net.Rest/Entities/RestApplication.cs Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com> --------- Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
19
docs/guides/int_framework/samples/intro/userapps.cs
Normal file
19
docs/guides/int_framework/samples/intro/userapps.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
// This parameteres can be configured on the module level
|
||||
// Set supported command context types to Bot DMs and Private Channels (regular DM & GDM)
|
||||
[CommandContextType(InteractionContextType.BotDm, InteractionContextType.PrivateChannel)]
|
||||
// Set supported integration installation type to User Install
|
||||
[IntegrationType(ApplicationIntegrationType.UserInstall)]
|
||||
public class CommandModule() : InteractionModuleBase<SocketInteractionContext>
|
||||
{
|
||||
[SlashCommand("test", "Just a test command")]
|
||||
public async Task TestCommand()
|
||||
=> await RespondAsync("Hello There");
|
||||
|
||||
// But can also be overridden on the command level
|
||||
[CommandContextType(InteractionContextType.BotDm, InteractionContextType.PrivateChannel, InteractionContextType.Guild)]
|
||||
[IntegrationType(ApplicationIntegrationType.GuildInstall)]
|
||||
[SlashCommand("echo", "Echo the input")]
|
||||
public async Task EchoCommand(string input)
|
||||
=> await RespondAsync($"You said: {input}");
|
||||
}
|
||||
Reference in New Issue
Block a user