[Feature] Age restricted (NSFW) application commands support (#2531)

* add `nsfw` to data model & internal methods; add missing property

* add `nsfw` prop to command builders

* add `NsfwCommandAttribute` to Interaction Framework

* working state

* docs?
This commit is contained in:
Misha133
2022-12-20 01:00:56 +03:00
committed by GitHub
parent 60956c720b
commit 56b1a930e7
23 changed files with 230 additions and 15 deletions

View File

@@ -55,5 +55,10 @@ The amount of nesting you can do is realistically endless.
> If the nested class is marked with `Group`, as required for setting up subcommands, this example will not work.
> As mentioned before, subcommands cannot have seperate permissions from the top level command.
### NSFW Commands
Commands can be limited to only age restricted channels and DMs:
[!code-csharp[Nsfw-Permissions](samples/permissions/nsfw-permissions.cs)]
[permissions]: xref:Discord.GuildPermission

View File

@@ -0,0 +1,6 @@
[NsfwCommand(true)]
[SlashCommand("beautiful-code", "Get an image of perfect code")]
public async Task BeautifulCodeAsync(...)
{
...
}