feat(bot,types): Add webhook events types (#3953)

* Add webhook events types

We will not support all the signing part for the handling of http
requests, however we do still provide the types for these requests

* Apply suggestions from code review

Co-authored-by: Awesome Stickz <awesome@stickz.dev>

* Use union on DiscordEventWebhookEventBody data

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
This commit is contained in:
Fleny
2024-11-05 13:16:56 +01:00
committed by GitHub
co-authored by Awesome Stickz
parent d58de64704
commit 81b3b28e0e
5 changed files with 133 additions and 46 deletions
@@ -66,6 +66,9 @@ export function transformApplication(bot: Bot, payload: { application: DiscordAp
: undefined,
}
: undefined,
eventWebhooksUrl: payload.application.event_webhooks_url,
eventWebhooksStatus: payload.application.event_webhooks_status,
eventWebhooksTypes: payload.application.event_webhooks_types,
} as Application
return bot.transformers.customizers.application(bot, payload.application, application)
@@ -21,5 +21,8 @@ export function transformApplicationToDiscordApplication(bot: Bot, payload: Appl
owner: payload.owner ? bot.transformers.reverse.user(bot, payload.owner) : undefined,
team: payload.team ? bot.transformers.reverse.team(bot, payload.team) : null,
guild_id: payload.guildId?.toString(),
event_webhooks_url: payload.eventWebhooksUrl,
event_webhooks_status: payload.eventWebhooksStatus,
event_webhooks_types: payload.eventWebhooksTypes,
}
}
+5
View File
@@ -15,6 +15,7 @@ import type {
DefaultMessageNotificationLevels,
DiscordActivityInstanceResource,
DiscordActivityLocationKind,
DiscordApplicationEventWebhookStatus,
DiscordApplicationIntegrationType,
DiscordAuditLogChange,
DiscordAutoModerationRuleTriggerMetadataPresets,
@@ -32,6 +33,7 @@ import type {
DiscordSkuType,
DiscordTeamMemberRole,
DiscordTemplateSerializedSourceGuild,
DiscordWebhookEventType,
EmbedTypes,
ExplicitContentFilterLevels,
ForumLayout,
@@ -175,6 +177,9 @@ export interface Application {
integrationTypesConfig?: Partial<Record<DiscordApplicationIntegrationType, ApplicationIntegrationTypeConfiguration>>
roleConnectionsVerificationUrl: string
tags: string[]
eventWebhooksUrl?: string
eventWebhooksStatus: DiscordApplicationEventWebhookStatus
eventWebhooksTypes?: DiscordWebhookEventType[]
}
export interface ApplicationIntegrationTypeConfiguration {