[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:
Mihail Gribkov
2024-03-19 00:24:05 +03:00
committed by GitHub
parent bfc8dc229e
commit 24a69785fe
63 changed files with 1257 additions and 300 deletions

View File

@@ -0,0 +1,42 @@
using System.Collections.Immutable;
namespace Discord.Rest;
internal static class InteractionMetadataExtensions
{
public static IMessageInteractionMetadata ToInteractionMetadata(this API.MessageInteractionMetadata metadata)
{
switch (metadata.Type)
{
case InteractionType.ApplicationCommand:
return new ApplicationCommandInteractionMetadata(
metadata.Id,
metadata.Type,
metadata.UserId,
metadata.IntegrationOwners.ToImmutableDictionary(),
metadata.OriginalResponseMessageId.IsSpecified ? metadata.OriginalResponseMessageId.Value : null,
metadata.Name.GetValueOrDefault(null));
case InteractionType.MessageComponent:
return new MessageComponentInteractionMetadata(
metadata.Id,
metadata.Type,
metadata.UserId,
metadata.IntegrationOwners.ToImmutableDictionary(),
metadata.OriginalResponseMessageId.IsSpecified ? metadata.OriginalResponseMessageId.Value : null,
metadata.InteractedMessageId.GetValueOrDefault(0));
case InteractionType.ModalSubmit:
return new ModalSubmitInteractionMetadata(
metadata.Id,
metadata.Type,
metadata.UserId,
metadata.IntegrationOwners.ToImmutableDictionary(),
metadata.OriginalResponseMessageId.IsSpecified ? metadata.OriginalResponseMessageId.Value : null,
metadata.TriggeringInteractionMetadata.GetValueOrDefault(null)?.ToInteractionMetadata());
default:
return null;
}
}
}