Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
53fad7a
Start
KubaZ2 Sep 28, 2026
05fb3ee
Move PartialGuild to PartialGuild.cs, optimize Role
KubaZ2 Sep 28, 2026
9f81b73
Fix role tests, use required for JsonRole
KubaZ2 Sep 28, 2026
bbe18b3
Enforce STJ nullable checks and remove nullable warning suppression
KubaZ2 Sep 28, 2026
3ed0075
Add missing required to some models, fix test
KubaZ2 Sep 29, 2026
243417b
Progress
KubaZ2 Sep 29, 2026
89b8432
Update
KubaZ2 Sep 29, 2026
4693b59
Rewrite deserialization of interactions
KubaZ2 Sep 30, 2026
c18969e
Optimize IInteraction
KubaZ2 Sep 30, 2026
e683219
Progress
KubaZ2 Sep 30, 2026
250b6ac
Progress
KubaZ2 Sep 30, 2026
6922b5c
Rewrite embed
KubaZ2 Sep 30, 2026
e2ede85
Update EmbedProperties
KubaZ2 Sep 30, 2026
ba6bcb3
Suppress nullability warning
KubaZ2 Sep 30, 2026
e53d5ea
Rewrite MessagePoll
KubaZ2 Sep 30, 2026
d821a2b
Merge branch 'main' into optimize/deserialization
KubaZ2 Oct 1, 2026
eaf7ead
Update RoleSubscriptionData
KubaZ2 Oct 1, 2026
6393236
Update MessageInteractionMetadata
KubaZ2 Oct 1, 2026
bfab59e
Update JsonStickerPacks
KubaZ2 Oct 1, 2026
a93acef
Update AvatarDecorationData
KubaZ2 Oct 1, 2026
e25f06c
Update ForumTag
KubaZ2 Oct 1, 2026
e5a6aae
Update GuildChannelMention
KubaZ2 Oct 1, 2026
c823886
Update MessageSnapshotMessage
KubaZ2 Oct 1, 2026
35b35fb
Update GuildUserChunkEventArgs
KubaZ2 Oct 1, 2026
b516990
Update MessageReaction
KubaZ2 Oct 1, 2026
a9a0b93
Update Emoji
KubaZ2 Oct 1, 2026
8d8fbf4
Improve Emoji
KubaZ2 Oct 1, 2026
1cba22b
Update ApplicationInstallParams
KubaZ2 Oct 1, 2026
0042051
Update Attachment
KubaZ2 Oct 1, 2026
47c1c98
Update Sticker
KubaZ2 Oct 1, 2026
cacc7c7
Update InteractionGuildReference
KubaZ2 Oct 1, 2026
a049743
Update Integration
KubaZ2 Oct 1, 2026
59d5dd0
Update IntegrationAccount
KubaZ2 Oct 1, 2026
00b4d06
Update Team
KubaZ2 Oct 1, 2026
ded9876
Update GuildEmojisUpdateEventArgs
KubaZ2 Oct 1, 2026
f18f86c
Update AutoModerationRuleTriggerMetadata
KubaZ2 Oct 1, 2026
0bf6b3c
Update AutoModerationActionExecutionEventArgs
KubaZ2 Oct 1, 2026
160ab2b
Update MessageInteraction
KubaZ2 Oct 1, 2026
66189cf
Update GuildBanEventArgs
KubaZ2 Oct 1, 2026
2a0dbb9
Update GuildStickersUpdateEventArgs
KubaZ2 Oct 1, 2026
2e52cd1
Update GuildThreadListSyncEventArgs
KubaZ2 Oct 1, 2026
5ca3530
Update GuildUserRemoveEventArgs
KubaZ2 Oct 1, 2026
6b73a92
Update InviteDeleteEventArgs
KubaZ2 Oct 1, 2026
ea16536
Update MessageDeleteBulkEventArgs
KubaZ2 Oct 1, 2026
54ce963
Update MessageReactionAddEventArgs
KubaZ2 Oct 1, 2026
5cc3a26
Update JsonMessageReactionRemoveEmojiEventArgs
KubaZ2 Oct 1, 2026
a97e273
Update Subscription
KubaZ2 Oct 1, 2026
5dbfe57
Update TeamUser
KubaZ2 Oct 1, 2026
dd88052
Update MessageReactionRemoveEventArgs
KubaZ2 Oct 1, 2026
a21a6db
Update MessageSnapshot
KubaZ2 Oct 1, 2026
df73eba
Update UserActivity
KubaZ2 Oct 1, 2026
5183e76
Update Invite
KubaZ2 Oct 1, 2026
159eac6
Improve UserActivity.cs
KubaZ2 Oct 1, 2026
655aab9
Update MessageCall
KubaZ2 Oct 1, 2026
8fbd170
Update JsonRoleEventArgs
KubaZ2 Oct 1, 2026
d986e25
Update MessageSticker
KubaZ2 Oct 1, 2026
4036ecb
Update AutoModerationRule
KubaZ2 Oct 2, 2026
8837343
Update Presence, improve User
KubaZ2 Oct 2, 2026
4e999d1
Fix compilation error
KubaZ2 Oct 2, 2026
3679672
Fix duplicating RestClient in CustomEmoji
KubaZ2 Oct 2, 2026
f2c4cee
Update VoiceServerUpdateEventArgs
KubaZ2 Oct 4, 2026
a0230dd
Update VoiceState
KubaZ2 Oct 4, 2026
db15ac8
Update SharedClientTheme
KubaZ2 Oct 4, 2026
6d71d9c
Update ApplicationCommandInteractionDataOption
KubaZ2 Oct 4, 2026
0b5cc5e
Update ApplicationCommandGuildPermissions
KubaZ2 Oct 4, 2026
54da059
Update AuditLogChange
KubaZ2 Oct 4, 2026
1069911
Fix AuditLogEntry
KubaZ2 Oct 4, 2026
2655d5e
Update StageInstance
KubaZ2 Oct 4, 2026
dc5b631
Update StringSelectOption
KubaZ2 Oct 4, 2026
392f27b
Update GuildWelcomeScreen and GuildWelcomeScreenChannel
KubaZ2 Oct 4, 2026
b3e0ca3
Use JsonGuard
KubaZ2 Oct 4, 2026
e8e2f8c
Update ApplicationCommandGuildPermission
KubaZ2 Oct 4, 2026
42b5288
Update ApplicationIntegrationTypeConfiguration
KubaZ2 Oct 4, 2026
74436e1
Update AuditLogEntryInfo and AuditLogEntry
KubaZ2 Oct 4, 2026
7734d04
Update AutoModerationAction and AutoModerationActionMetadata
KubaZ2 Oct 4, 2026
629d4e1
Update channels
KubaZ2 Oct 4, 2026
09bdca3
Update GuildThreadMetadata
KubaZ2 Oct 4, 2026
4b235d8
Update Collectibles
KubaZ2 Oct 4, 2026
9beab19
Update Entitlement
KubaZ2 Oct 4, 2026
e056fa2
Update ForumGuildChannelDefaultReaction
KubaZ2 Oct 4, 2026
4511392
Update AuditLogEntry
KubaZ2 Oct 4, 2026
b66c391
Update ChannelPinsUpdateEventArgs
KubaZ2 Oct 4, 2026
e311f38
Update GuildIntegrationDeleteEventArgs
KubaZ2 Oct 4, 2026
291a065
Update GuildIntegrationsUpdateEventArgs
KubaZ2 Oct 4, 2026
a1b1b37
Update GuildScheduledEventUserEventArgs
KubaZ2 Oct 4, 2026
1ad80a9
Update GuildThreadUsersUpdateEventArgs and AddedThreadUser
KubaZ2 Oct 4, 2026
408cc79
Update MessageDeleteEventArgs
KubaZ2 Oct 4, 2026
407bc0c
Update MessagePollVoteEventArgs
KubaZ2 Oct 4, 2026
d83859f
Update MessageReactionRemoveAllEventArgs
KubaZ2 Oct 4, 2026
128490d
Update RateLimitedEventArgs
KubaZ2 Oct 4, 2026
35e77f2
Update RoleDeleteEventArgs
KubaZ2 Oct 4, 2026
eb2a010
Update TypingStartEventArgs
KubaZ2 Oct 4, 2026
f9ed8ff
Update VoiceChannelEffectSendEventArgs
KubaZ2 Oct 4, 2026
27013f2
Update WebhooksUpdateEventArgs
KubaZ2 Oct 4, 2026
042f6ce
Update PartySize
KubaZ2 Oct 4, 2026
a0f2f6b
Update SpeakingEventArgs
KubaZ2 Oct 4, 2026
4af4574
Update GuildScheduledEventRecurrenceRule
KubaZ2 Oct 4, 2026
bfe2eb1
Update GuildScheduledEventRecurrenceRuleNWeekday
KubaZ2 Oct 4, 2026
2ff104e
Update MessageActivity
KubaZ2 Oct 4, 2026
c3656c2
Update MessageReaction
KubaZ2 Oct 4, 2026
45a5fd5
Update MessageReactionCountDetails
KubaZ2 Oct 4, 2026
0cbc607
Update MessageReference
KubaZ2 Oct 4, 2026
0ef9e69
Update Nameplate
KubaZ2 Oct 4, 2026
94b27b4
Update PermissionOverwrite
KubaZ2 Oct 4, 2026
6965a76
Update ApplicationCommand
KubaZ2 Oct 4, 2026
4546328
Fix ApplicationCommand
KubaZ2 Oct 4, 2026
1ca5f4b
Update ApplicationCommandOption and fix GuildApplicationCommand
KubaZ2 Oct 4, 2026
3aa24e7
Update ApplicationCommandOptionChoice and improve GuildApplicationCom…
KubaZ2 Oct 4, 2026
fd0f29e
Fix ApplicationCommand, rename EntryPointCommandHandler to EntryPoint…
KubaZ2 Oct 4, 2026
0634e65
Fix ApplicationCommandOption
KubaZ2 Oct 4, 2026
d8f64b8
Update ApplicationRoleConnection
KubaZ2 Oct 4, 2026
6581491
Fix ApplicationRoleConnection
KubaZ2 Oct 4, 2026
0fc0016
Update ApplicationRoleConnectionMetadata
KubaZ2 Oct 4, 2026
f63a1cd
Update GatewaySessionStartLimit
KubaZ2 Oct 4, 2026
685508d
Update GoogleCloudPlatformStorageBucket
KubaZ2 Oct 4, 2026
c677463
Update GuildBulkBan
KubaZ2 Oct 4, 2026
b313a9f
Update GuildMessageSearchResult
KubaZ2 Oct 4, 2026
4d89e42
Update GuildVanityInvite
KubaZ2 Oct 4, 2026
7e6af51
Update GuildWidgetChannel
KubaZ2 Oct 4, 2026
be2cc6a
Update GuildWidgetSettings
KubaZ2 Oct 4, 2026
c44f084
Update InviteTargetUsersJobStatus
KubaZ2 Oct 4, 2026
110d7f3
Update RestMessage and Message
KubaZ2 Oct 4, 2026
ffd8b73
Fix Message
KubaZ2 Oct 4, 2026
5c94455
Update ThreadCurrentUser
KubaZ2 Oct 4, 2026
bd43d78
Update ThreadUser
KubaZ2 Oct 4, 2026
54ed438
Update UserPrimaryGuild
KubaZ2 Oct 4, 2026
73e01fd
Simplify AuditLogChange and AuditLogEntry
KubaZ2 Oct 4, 2026
0151e9e
Remove IJsonModel
KubaZ2 Oct 4, 2026
742e07f
Update test
KubaZ2 Oct 4, 2026
73e36ec
Reduce virtual calls by making Entity.Id non-abstract
KubaZ2 Oct 4, 2026
914c9cf
Rename all menu components to selects
KubaZ2 Oct 5, 2026
3fcb365
Update documentation naming of selects
KubaZ2 Oct 5, 2026
b22ca87
Update JsonGuard
KubaZ2 Oct 5, 2026
a46610e
Start rewrite channels
KubaZ2 Oct 7, 2026
cfc7057
Add IVoiceGuildChannel and IObfuscatedVoiceGuildChannel and implement…
KubaZ2 Oct 7, 2026
5a38737
Update channels
KubaZ2 Oct 7, 2026
549d0bb
Add missing channels and properties
KubaZ2 Oct 7, 2026
d49503d
Fix IMaybeObfuscatedMediaGuildChannel
KubaZ2 Oct 7, 2026
ae1cb57
Update JsonGuard
KubaZ2 Oct 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,3 @@ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:sug
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion

[**/JsonModels{/**,}/Json*.cs]
dotnet_diagnostic.CS8618.severity = none
6 changes: 2 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="10.0.1" />
<PackageVersion Include="JsonGuard" Version="0.1.0" />
<PackageVersion Include="libsodium" Version="1.0.22" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.9.0" />
Expand All @@ -24,5 +23,4 @@
<PackageVersion Include="MSTest.TestFramework" Version="4.4.1" />
<PackageVersion Include="PolySharp" Version="1.16.0" />
</ItemGroup>

</Project>
</Project>
30 changes: 15 additions & 15 deletions Documentation/guides/basic-concepts/SendingMessages/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async static Task PropertiesAsync()
new LinkButtonProperties("https://netcord.dev", "Learn More"),
new PremiumButtonProperties(1271914991536312372));

component = new StringMenuProperties("animal")
component = new StringSelectProperties("animal")
{
new("Dog", "dog")
{
Expand All @@ -197,55 +197,55 @@ async static Task PropertiesAsync()
},
};

component = new StringMenuProperties("animal")
component = new StringSelectProperties("animal")
.AddOptions(
new StringMenuSelectOptionProperties("Dog", "dog")
new StringSelectOptionProperties("Dog", "dog")
.WithDefault()
.WithEmoji(EmojiProperties.Standard("🐶"))
.WithDescription("A loyal companion"),
new StringMenuSelectOptionProperties("Cat", "cat")
new StringSelectOptionProperties("Cat", "cat")
.WithEmoji(EmojiProperties.Standard("🐱"))
.WithDescription("A curious feline"),
new StringMenuSelectOptionProperties("Bird", "bird")
new StringSelectOptionProperties("Bird", "bird")
.WithEmoji(EmojiProperties.Standard("🐦"))
.WithDescription("A chirpy flyer"));

component = new ChannelMenuProperties("channel")
component = new ChannelSelectProperties("channel")
{
DefaultValues = [1124777547687788626],
ChannelTypes = [ChannelType.ForumGuildChannel, ChannelType.PublicGuildThread],
};

component = new ChannelMenuProperties("channel")
component = new ChannelSelectProperties("channel")
.AddDefaultValues(1124777547687788626)
.AddChannelTypes(ChannelType.ForumGuildChannel, ChannelType.PublicGuildThread);

component = new MentionableMenuProperties("mentionable")
component = new MentionableSelectProperties("mentionable")
{
DefaultValues =
[
new(803324257194082314, MentionableValueType.User),
],
};

component = new MentionableMenuProperties("mentionable")
component = new MentionableSelectProperties("mentionable")
.AddDefaultValues(
new MentionableValueProperties(803324257194082314, MentionableValueType.User));

component = new RoleMenuProperties("role")
component = new RoleSelectProperties("role")
{
DefaultValues = [803169206115237908],
};

component = new RoleMenuProperties("role")
component = new RoleSelectProperties("role")
.AddDefaultValues(803169206115237908);

component = new UserMenuProperties("user")
component = new UserSelectProperties("user")
{
DefaultValues = [233590074724319233],
};

component = new UserMenuProperties("user")
component = new UserSelectProperties("user")
.AddDefaultValues(233590074724319233);

message.Components = [component];
Expand All @@ -257,9 +257,9 @@ async static Task PropertiesAsync()
message.WithFlags(MessageFlags.SuppressEmbeds | MessageFlags.SuppressNotifications);
}

static void Menu()
static void Select()
{
MenuProperties component = null!;
SelectProperties component = null!;

component.Placeholder = "Select 2-5 animals";
component.MinValues = 2;
Expand Down
52 changes: 26 additions & 26 deletions Documentation/guides/basic-concepts/sending-messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ You can enhance your attachments by adding titles and descriptions. Use the `Att

## Adding Components

Components are interactive elements that can be attached to a message. These include buttons, select menus, and more. A message can contain up to 5 components, including action rows and select menus.
Components are interactive elements that can be attached to a message. These include buttons, selects, and more. A message can contain up to 5 components, including action rows and selects.

# [Classic Syntax](#tab/classic-syntax)

Expand Down Expand Up @@ -217,91 +217,91 @@ Action rows contain buttons, and each can have up to 5 buttons. Available button

***

### Select Menus
### Selects

Select menus are dropdown menus containing up to 25 options. They support various types, such as strings, channels, and users.
Selects are dropdown menus containing up to 25 options. They support various types, such as strings, channels, and users.

#### String Menus
#### String Selects

String menus allow you to include any string options. Each option in the menu can be customized with additional properties, such as setting a default selection, adding an emoji, or providing a description for better context.
String selects allow you to include any string options. Each option in the select can be customized with additional properties, such as setting a default selection, adding an emoji, or providing a description for better context.

# [Classic Syntax](#tab/classic-syntax)

[!code-cs[Creating string menus](SendingMessages/Program.cs#L180-L198)]
[!code-cs[Creating string selects](SendingMessages/Program.cs#L180-L198)]

# [Fluent Syntax](#tab/fluent-syntax)

[!code-cs[Creating string menus](SendingMessages/Program.cs#L200-L211)]
[!code-cs[Creating string selects](SendingMessages/Program.cs#L200-L211)]

***

#### Channel Menus
#### Channel Selects

Channel menus include channels as options, and support filtering by channel type and the ability to specify default channels.
Channel selects include channels as options, and support filtering by channel type and the ability to specify default channels.

# [Classic Syntax](#tab/classic-syntax)

[!code-cs[Creating channel menus](SendingMessages/Program.cs#L213-L217)]
[!code-cs[Creating channel selects](SendingMessages/Program.cs#L213-L217)]

# [Fluent Syntax](#tab/fluent-syntax)

[!code-cs[Creating channel menus](SendingMessages/Program.cs#L219-L221)]
[!code-cs[Creating channel selects](SendingMessages/Program.cs#L219-L221)]

***

#### Mentionable Menus
#### Mentionable Selects

Mentionable menus include users and roles as options, and support specifying default users and roles.
Mentionable selects include users and roles as options, and support specifying default users and roles.

# [Classic Syntax](#tab/classic-syntax)

[!code-cs[Creating mentionable menus](SendingMessages/Program.cs#L223-L229)]
[!code-cs[Creating mentionable selects](SendingMessages/Program.cs#L223-L229)]

# [Fluent Syntax](#tab/fluent-syntax)

[!code-cs[Creating mentionable menus](SendingMessages/Program.cs#L231-L233)]
[!code-cs[Creating mentionable selects](SendingMessages/Program.cs#L231-L233)]

***

#### Role Menus
#### Role Selects

Role menus contain roles as options, and support specifying default roles.
Role selects contain roles as options, and support specifying default roles.

# [Classic Syntax](#tab/classic-syntax)

[!code-cs[Creating role menus](SendingMessages/Program.cs#L235-L238)]
[!code-cs[Creating role selects](SendingMessages/Program.cs#L235-L238)]

# [Fluent Syntax](#tab/fluent-syntax)

[!code-cs[Creating role menus](SendingMessages/Program.cs#L240-L241)]
[!code-cs[Creating role selects](SendingMessages/Program.cs#L240-L241)]

***

#### User Menus
#### User Selects

User menus allow selecting users as options, and support specifying default users.
User selects allow selecting users as options, and support specifying default users.

# [Classic Syntax](#tab/classic-syntax)

[!code-cs[Creating user menus](SendingMessages/Program.cs#L243-L246)]
[!code-cs[Creating user selects](SendingMessages/Program.cs#L243-L246)]

# [Fluent Syntax](#tab/fluent-syntax)

[!code-cs[Creating user menus](SendingMessages/Program.cs#L248-L249)]
[!code-cs[Creating user selects](SendingMessages/Program.cs#L248-L249)]

***

#### Specifying Additional Properties

Additionally, all select menus allow you to specify a placeholder, set a minimum and maximum number of selectable options, and disable the select menu if necessary.
Additionally, all selects allow you to specify a placeholder, set a minimum and maximum number of selectable options, and disable the select if necessary.

# [Classic Syntax](#tab/classic-syntax)

[!code-cs[Configuring select menus](SendingMessages/Program.cs#L264-L267)]
[!code-cs[Configuring selects](SendingMessages/Program.cs#L264-L267)]

# [Fluent Syntax](#tab/fluent-syntax)

[!code-cs[Configuring select menus](SendingMessages/Program.cs#L269-L273)]
[!code-cs[Configuring selects](SendingMessages/Program.cs#L269-L273)]

***

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using NetCord.Services.ComponentInteractions;

namespace MyBot;

public class ChannelSelectModule : ComponentInteractionModule<ChannelSelectInteractionContext>
{
[ComponentInteraction("select")]
public string Select() => $"You selected: {string.Join(", ", Context.SelectedValues)}";
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using NetCord.Services.ComponentInteractions;

namespace MyBot;

public class MentionableSelectModule : ComponentInteractionModule<MentionableSelectInteractionContext>
{
[ComponentInteraction("select")]
public string Select() => $"You selected: {string.Join(", ", Context.SelectedValues)}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace MyBot;
public class ModalModule : ComponentInteractionModule<ModalInteractionContext>
{
[ComponentInteraction("modal")]
public string Modal() => string.Join('\n', Context.Components.OfType<Label>()
public string Modal() => string.Join('\n', Context.Components.OfType<LabelComponent>()
.Select(l => l.Component)
.OfType<TextInput>()
.OfType<TextInputComponent>()
.Select(i => $"{i.CustomId}: {i.Value}"));
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using NetCord.Services.ComponentInteractions;

namespace MyBot;

public class RoleSelectModule : ComponentInteractionModule<RoleSelectInteractionContext>
{
[ComponentInteraction("select")]
public string Select() => $"You selected: {string.Join(", ", Context.SelectedValues)}";
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using NetCord.Services.ComponentInteractions;

namespace MyBot;

public class StringSelectModule : ComponentInteractionModule<StringSelectInteractionContext>
{
[ComponentInteraction("select")]
public string Select() => $"You selected: {string.Join(", ", Context.Values)}";
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using NetCord.Services.ComponentInteractions;

namespace MyBot;

public class UserSelectModule : ComponentInteractionModule<UserSelectInteractionContext>
{
[ComponentInteraction("select")]
public string Select() => $"You selected: {string.Join(", ", Context.SelectedValues)}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
builder.Services
.AddDiscordGateway()
.AddComponentInteractions<ButtonInteraction, ButtonInteractionContext>()
.AddComponentInteractions<StringMenuInteraction, StringMenuInteractionContext>()
.AddComponentInteractions<UserMenuInteraction, UserMenuInteractionContext>()
.AddComponentInteractions<RoleMenuInteraction, RoleMenuInteractionContext>()
.AddComponentInteractions<MentionableMenuInteraction, MentionableMenuInteractionContext>()
.AddComponentInteractions<ChannelMenuInteraction, ChannelMenuInteractionContext>()
.AddComponentInteractions<ModalInteraction, ModalInteractionContext>();
.AddComponentInteractions<StringSelectInteraction, StringSelectInteractionContext>()
.AddComponentInteractions<UserSelectInteraction, UserSelectInteractionContext>()
.AddComponentInteractions<RoleSelectInteraction, RoleSelectInteractionContext>()
.AddComponentInteractions<MentionableSelectInteraction, MentionableSelectInteractionContext>()
.AddComponentInteractions<ChannelSelectInteraction, ChannelSelectInteractionContext>()
.AddComponentInteractions<ModalSubmitInteraction, ModalInteractionContext>();

var host = builder.Build();

// Add component interactions using minimal APIs
host.AddComponentInteraction<ButtonInteractionContext>("ping", () => "Pong!");
host.AddComponentInteraction<StringMenuInteractionContext>("string", (StringMenuInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<UserMenuInteractionContext>("user", (UserMenuInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<RoleMenuInteractionContext>("role", (RoleMenuInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<MentionableMenuInteractionContext>("mentionable", (MentionableMenuInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<ChannelMenuInteractionContext>("channel", (ChannelMenuInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<ModalInteractionContext>("modal", (ModalInteractionContext context) => ((TextInput)context.Components[0]).Value);
host.AddComponentInteraction<StringSelectInteractionContext>("string", (StringSelectInteractionContext context) => string.Join("\n", context.Values));
host.AddComponentInteraction<UserSelectInteractionContext>("user", (UserSelectInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<RoleSelectInteractionContext>("role", (RoleSelectInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<MentionableSelectInteractionContext>("mentionable", (MentionableSelectInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<ChannelSelectInteractionContext>("channel", (ChannelSelectInteractionContext context) => string.Join("\n", context.SelectedValues));
host.AddComponentInteraction<ModalInteractionContext>("modal", (ModalInteractionContext context) => ((TextInputComponent)context.Components[0]).Value);

// Add component interactions from modules
host.AddModules(typeof(Program).Assembly);
Expand Down
Loading
Loading