seyfert 2.1.1-dev-11727465603.0 → 2.1.1-dev-11767975974.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { MakeRequired, OmitInsert } from '../../common';
|
|
2
|
+
import type { APIGuild } from './guild';
|
|
3
|
+
import type { ApplicationIntegrationType } from './interactions';
|
|
4
|
+
import type { APIEntitlement } from './monetization';
|
|
5
|
+
import type { OAuth2Scopes } from './oauth2';
|
|
6
|
+
import type { APIUser } from './user';
|
|
7
|
+
/**
|
|
8
|
+
* https://discord.com/developers/docs/events/webhook-events#payload-structure
|
|
9
|
+
*/
|
|
10
|
+
export interface WebhookEventPayload<WET extends WebhookEventTypes = WebhookEventTypes> {
|
|
11
|
+
/** Version scheme for the webhook event */
|
|
12
|
+
version: 1;
|
|
13
|
+
/** ID of your app */
|
|
14
|
+
application_id: string;
|
|
15
|
+
/** Type of webhook, either 0 for PING or 1 for webhook events */
|
|
16
|
+
type: WET;
|
|
17
|
+
/** Event data payload */
|
|
18
|
+
event: EventBodyObject<WET>;
|
|
19
|
+
}
|
|
20
|
+
export type EventBodyObjectData<T extends WebhookEventTypes> = T extends WebhookEventTypes.ApplicationAuthorized ? ApplicationAuthorizedEvent : APIEntitlement;
|
|
21
|
+
/**
|
|
22
|
+
* https://discord.com/developers/docs/events/webhook-events#event-body-object
|
|
23
|
+
*/
|
|
24
|
+
export interface EventBodyObject<T extends WebhookEventTypes = WebhookEventTypes> {
|
|
25
|
+
/** Event type */
|
|
26
|
+
type: T;
|
|
27
|
+
/** Timestamp of when the event occurred in ISO8601 format */
|
|
28
|
+
timestamp: string;
|
|
29
|
+
/** Data for the event. The shape depends on the event type */
|
|
30
|
+
data?: EventBodyObjectData<T>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* https://discord.com/developers/docs/events/webhook-events#application-authorized-application-authorized-structure
|
|
34
|
+
*/
|
|
35
|
+
export interface ApplicationAuthorizedEvent {
|
|
36
|
+
/** Installation context for the authorization. Either guild (0) if installed to a server or user (1) if installed to a user's account */
|
|
37
|
+
integration_type?: ApplicationIntegrationType;
|
|
38
|
+
/** User who authorized the app */
|
|
39
|
+
user: APIUser;
|
|
40
|
+
/** List of scopes the user authorized */
|
|
41
|
+
scopes: `${OAuth2Scopes}`[];
|
|
42
|
+
/** Server which app was authorized for (when integration type is 0) */
|
|
43
|
+
guild?: APIGuild;
|
|
44
|
+
}
|
|
45
|
+
export type ApplicationGuildAuthorizedEvent = MakeRequired<OmitInsert<ApplicationAuthorizedEvent, 'integration_type', {
|
|
46
|
+
integration_type: ApplicationIntegrationType.GuildInstall;
|
|
47
|
+
}>, 'guild'>;
|
|
48
|
+
export type ApplicationUserAuthorizedEvent = OmitInsert<ApplicationAuthorizedEvent, 'integration_type' | 'guild', {
|
|
49
|
+
integration_type: ApplicationIntegrationType.UserInstall;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* https://discord.com/developers/docs/events/webhook-events#webhook-types
|
|
53
|
+
*/
|
|
54
|
+
export declare enum WebhookRequestType {
|
|
55
|
+
/** PING event sent to verify your Webhook Event URL is active */
|
|
56
|
+
PING = 0,
|
|
57
|
+
/** Webhook event (details for event in event body object) */
|
|
58
|
+
Event = 1
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* https://discord.com/developers/docs/events/webhook-events#event-types
|
|
62
|
+
*/
|
|
63
|
+
export declare enum WebhookEventTypes {
|
|
64
|
+
/** Sent when an app was authorized by a user to a server or their account */
|
|
65
|
+
ApplicationAuthorized = "APPLICATION_AUTHORIZED",
|
|
66
|
+
/** Entitlement was created */
|
|
67
|
+
EntitlementCreate = "ENTITLEMENT_CREATE",
|
|
68
|
+
/**
|
|
69
|
+
* User was added to a Quest (currently unavailable)
|
|
70
|
+
* @unstable
|
|
71
|
+
*/
|
|
72
|
+
QuestUserEnrollment = "QUEST_USER_ENROLLMENT"
|
|
73
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhookEventTypes = exports.WebhookRequestType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* https://discord.com/developers/docs/events/webhook-events#webhook-types
|
|
6
|
+
*/
|
|
7
|
+
var WebhookRequestType;
|
|
8
|
+
(function (WebhookRequestType) {
|
|
9
|
+
/** PING event sent to verify your Webhook Event URL is active */
|
|
10
|
+
WebhookRequestType[WebhookRequestType["PING"] = 0] = "PING";
|
|
11
|
+
/** Webhook event (details for event in event body object) */
|
|
12
|
+
WebhookRequestType[WebhookRequestType["Event"] = 1] = "Event";
|
|
13
|
+
})(WebhookRequestType || (exports.WebhookRequestType = WebhookRequestType = {}));
|
|
14
|
+
/**
|
|
15
|
+
* https://discord.com/developers/docs/events/webhook-events#event-types
|
|
16
|
+
*/
|
|
17
|
+
var WebhookEventTypes;
|
|
18
|
+
(function (WebhookEventTypes) {
|
|
19
|
+
/** Sent when an app was authorized by a user to a server or their account */
|
|
20
|
+
WebhookEventTypes["ApplicationAuthorized"] = "APPLICATION_AUTHORIZED";
|
|
21
|
+
/** Entitlement was created */
|
|
22
|
+
WebhookEventTypes["EntitlementCreate"] = "ENTITLEMENT_CREATE";
|
|
23
|
+
/**
|
|
24
|
+
* User was added to a Quest (currently unavailable)
|
|
25
|
+
* @unstable
|
|
26
|
+
*/
|
|
27
|
+
WebhookEventTypes["QuestUserEnrollment"] = "QUEST_USER_ENROLLMENT";
|
|
28
|
+
})(WebhookEventTypes || (exports.WebhookEventTypes = WebhookEventTypes = {}));
|