FAQ rework, replacing outdated info, better interaction FAQ (#2106)
* FAQ rework, replacing outdated info, better interaction faq * Update docs/faq/basics/getting-started.md Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com> * Update docs/faq/basics/getting-started.md Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com> * Update docs/faq/int_framework/general.md Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com> * fix TOC reference Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com> Co-authored-by: Quin Lynch <lynchquin@gmail.com>
This commit is contained in:
6
docs/faq/int_framework/samples/interactionsyncing.cs
Normal file
6
docs/faq/int_framework/samples/interactionsyncing.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
DiscordSocketConfig config = new()
|
||||
{
|
||||
UseInteractionSnowflakeDate = false
|
||||
};
|
||||
|
||||
DiscordSocketclient client = new(config);
|
||||
8
docs/faq/int_framework/samples/propertyinjection.cs
Normal file
8
docs/faq/int_framework/samples/propertyinjection.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
public class MyModule
|
||||
{
|
||||
// Intended.
|
||||
public InteractionService Service { get; set; }
|
||||
|
||||
// Will not work. A private setter cannot be accessed by the serviceprovider.
|
||||
private InteractionService Service { get; private set; }
|
||||
}
|
||||
21
docs/faq/int_framework/samples/registerint.cs
Normal file
21
docs/faq/int_framework/samples/registerint.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
private async Task ReadyAsync()
|
||||
{
|
||||
// pull your commands from some array, everyone has a different approach for this.
|
||||
var commands = _builders.ToArray();
|
||||
|
||||
// write your list of commands globally in one go.
|
||||
await _client.Rest.BulkOverwriteGlobalCommands(commands);
|
||||
|
||||
// write your array of commands to one guild in one go.
|
||||
// You can do a foreach (... in _client.Guilds) approach to write to all guilds.
|
||||
await _client.Rest.BulkOverwriteGuildCommands(commands, /* some guild ID */);
|
||||
|
||||
foreach (var c in commands)
|
||||
{
|
||||
// Create a global command, repeating usage for multiple commands.
|
||||
await _client.Rest.CreateGlobalCommand(c);
|
||||
|
||||
// Create a guild command, repeating usage for multiple commands.
|
||||
await _client.Rest.CreateGuildCommand(c, guildId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user