disgroove 2.2.2-dev.db6cb16 → 2.2.3-dev.4f98e3d
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.
- package/README.md +5 -9
- package/dist/lib/Client.d.ts +116 -126
- package/dist/lib/Client.js +360 -267
- package/dist/lib/constants.d.ts +85 -74
- package/dist/lib/constants.js +88 -75
- package/dist/lib/gateway/Shard.d.ts +1 -0
- package/dist/lib/gateway/Shard.js +194 -170
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/rest/Endpoints.d.ts +6 -6
- package/dist/lib/rest/Endpoints.js +13 -13
- package/dist/lib/rest/RequestManager.d.ts +1 -1
- package/dist/lib/rest/RequestManager.js +1 -1
- package/dist/lib/rest/index.d.ts +0 -1
- package/dist/lib/rest/index.js +1 -2
- package/dist/lib/transformers/ApplicationCommands.d.ts +7 -0
- package/dist/lib/transformers/ApplicationCommands.js +90 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.d.ts +5 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.js +26 -0
- package/dist/lib/transformers/Applications.d.ts +5 -0
- package/dist/lib/transformers/Applications.js +97 -0
- package/dist/lib/transformers/AuditLogs.d.ts +7 -0
- package/dist/lib/transformers/AuditLogs.js +97 -0
- package/dist/lib/transformers/AutoModeration.d.ts +9 -0
- package/dist/lib/transformers/AutoModeration.js +76 -0
- package/dist/lib/transformers/Channels.d.ts +16 -0
- package/dist/lib/transformers/Channels.js +676 -0
- package/dist/lib/transformers/Emojis.d.ts +5 -0
- package/dist/lib/transformers/Emojis.js +31 -0
- package/dist/lib/transformers/Entitlements.d.ts +7 -0
- package/dist/lib/transformers/Entitlements.js +58 -0
- package/dist/lib/transformers/GuildScheduledEvents.d.ts +5 -0
- package/dist/lib/transformers/GuildScheduledEvents.js +51 -0
- package/dist/lib/transformers/GuildTemplates.d.ts +5 -0
- package/dist/lib/transformers/GuildTemplates.js +38 -0
- package/dist/lib/transformers/Guilds.d.ts +12 -0
- package/dist/lib/transformers/Guilds.js +264 -0
- package/dist/lib/transformers/Interactions.d.ts +10 -0
- package/dist/lib/transformers/Interactions.js +273 -0
- package/dist/lib/transformers/Invites.d.ts +5 -0
- package/dist/lib/transformers/Invites.js +79 -0
- package/dist/lib/transformers/Polls.d.ts +5 -0
- package/dist/lib/transformers/Polls.js +50 -0
- package/dist/lib/transformers/Presences.d.ts +5 -0
- package/dist/lib/transformers/Presences.js +116 -0
- package/dist/lib/transformers/Roles.d.ts +5 -0
- package/dist/lib/transformers/Roles.js +56 -0
- package/dist/lib/transformers/SKUs.d.ts +5 -0
- package/dist/lib/transformers/SKUs.js +26 -0
- package/dist/lib/transformers/StageInstances.d.ts +5 -0
- package/dist/lib/transformers/StageInstances.js +28 -0
- package/dist/lib/transformers/Stickers.d.ts +5 -0
- package/dist/lib/transformers/Stickers.js +41 -0
- package/dist/lib/transformers/Teams.d.ts +5 -0
- package/dist/lib/transformers/Teams.js +35 -0
- package/dist/lib/transformers/Users.d.ts +5 -0
- package/dist/lib/transformers/Users.js +62 -0
- package/dist/lib/transformers/Voice.d.ts +5 -0
- package/dist/lib/transformers/Voice.js +45 -0
- package/dist/lib/transformers/Webhooks.d.ts +5 -0
- package/dist/lib/transformers/Webhooks.js +51 -0
- package/dist/lib/transformers/index.d.ts +23 -0
- package/dist/lib/transformers/index.js +39 -0
- package/dist/lib/types/entitlements.d.ts +0 -6
- package/dist/lib/types/gateway-events.d.ts +21 -8
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/interaction.d.ts +2 -2
- package/dist/lib/types/sku.d.ts +0 -12
- package/dist/lib/types/user.d.ts +2 -2
- package/dist/lib/utils/CDN.d.ts +24 -0
- package/dist/lib/utils/CDN.js +49 -0
- package/dist/lib/utils/errors.d.ts +3 -3
- package/dist/lib/utils/errors.js +10 -12
- package/dist/lib/utils/formatters.d.ts +16 -0
- package/dist/lib/utils/formatters.js +44 -0
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/index.js +15 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
- package/dist/lib/rest/CDN.d.ts +0 -22
- package/dist/lib/rest/CDN.js +0 -45
- package/dist/lib/types/voice-connections.d.ts +0 -64
- package/dist/lib/types/voice-connections.js +0 -2
- package/dist/lib/utils/Util.d.ts +0 -94
- package/dist/lib/utils/Util.js +0 -2228
- package/dist/lib/voice/VoiceConnection.d.ts +0 -57
- package/dist/lib/voice/VoiceConnection.js +0 -150
- package/dist/lib/voice/VoiceConnectionManager.d.ts +0 -19
- package/dist/lib/voice/VoiceConnectionManager.js +0 -66
- package/dist/lib/voice/index.d.ts +0 -2
- package/dist/lib/voice/index.js +0 -18
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.js
CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./gateway"), exports);
|
18
18
|
__exportStar(require("./rest"), exports);
|
19
|
+
__exportStar(require("./transformers"), exports);
|
19
20
|
__exportStar(require("./types/application-command"), exports);
|
20
21
|
__exportStar(require("./types/application-role-connection-metadata"), exports);
|
21
22
|
__exportStar(require("./types/application"), exports);
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { snowflake } from "../types/common";
|
2
|
-
export declare const bulkGuildBan: (guildID: snowflake) => `guilds/${string}/bulk-ban`;
|
3
2
|
export declare const guild: (guildID: snowflake) => `guilds/${string}`;
|
4
3
|
export declare const guilds: () => "guilds";
|
5
4
|
export declare const guildActiveThreads: (guildID: snowflake) => `guilds/${string}/threads/active`;
|
@@ -8,8 +7,9 @@ export declare const guildAutoModerationRule: (guildID: snowflake, ruleID: snowf
|
|
8
7
|
export declare const guildAutoModerationRules: (guildID: snowflake) => `guilds/${string}/auto-moderation/rules`;
|
9
8
|
export declare const guildBan: (guildID: snowflake, userID: snowflake) => `guilds/${string}/bans/${string}`;
|
10
9
|
export declare const guildBans: (guildID: snowflake) => `guilds/${string}/bans`;
|
10
|
+
export declare const guildBulkBan: (guildID: snowflake) => `guilds/${string}/bulk-ban`;
|
11
11
|
export declare const guildChannels: (guildID: snowflake) => `guilds/${string}/channels`;
|
12
|
-
export declare const
|
12
|
+
export declare const guildMemberNickname: (guildID: snowflake) => `guilds/${string}/members/@me/nick`;
|
13
13
|
export declare const guildEmoji: (guildID: snowflake, emojiID: snowflake) => `guilds/${string}/emojis/${string}`;
|
14
14
|
export declare const guildEmojis: (guildID: snowflake) => `guilds/${string}/emojis`;
|
15
15
|
export declare const guildIntegration: (guildID: snowflake, integrationID: snowflake) => `guilds/${string}/integrations/${string}`;
|
@@ -71,7 +71,7 @@ export declare const userGuilds: () => "users/@me/guilds";
|
|
71
71
|
export declare const applicationCommand: (applicationID: snowflake, commandID: snowflake) => `applications/${string}/commands/${string}`;
|
72
72
|
export declare const applicationCommands: (applicationID: snowflake) => `applications/${string}/commands`;
|
73
73
|
export declare const applicationCommandPermissions: (applicationID: snowflake, guildID: snowflake, commandID: snowflake) => `applications/${string}/guilds/${string}/commands/${string}/permissions`;
|
74
|
-
export declare const
|
74
|
+
export declare const applicationUser: () => "applications/@me";
|
75
75
|
export declare const applicationEntitlement: (applicationID: snowflake, entitlementID: snowflake) => `applications/${string}/entitlements/${string}`;
|
76
76
|
export declare const applicationEntitlementConsume: (applicationID: snowflake, entitlementID: snowflake) => `applications/${string}/entitlements/${string}/consume`;
|
77
77
|
export declare const applicationEntitlements: (applicationID: snowflake) => `applications/${string}/entitlements`;
|
@@ -85,9 +85,9 @@ export declare const webhookMessage: (webhookID: snowflake, webhookToken: string
|
|
85
85
|
export declare const webhookPlatform: (webhookID: snowflake, webhookToken: string, platform: "github" | "slack") => `webhooks/${string}/${string}/github` | `webhooks/${string}/${string}/slack`;
|
86
86
|
export declare const gateway: () => "gateway";
|
87
87
|
export declare const gatewayBot: () => "gateway/bot";
|
88
|
-
export declare const
|
89
|
-
export declare const
|
90
|
-
export declare const
|
88
|
+
export declare const oauth2Authorize: () => "oauth2/authorize";
|
89
|
+
export declare const oauth2Application: () => "oauth2/applications/@me";
|
90
|
+
export declare const oauth2Authorization: () => "oauth2/@me";
|
91
91
|
export declare const oauth2TokenExchange: () => "oauth2/token";
|
92
92
|
export declare const oauth2TokenRevocation: () => "oauth2/token/revoke";
|
93
93
|
export declare const interactionCallback: (interactionID: snowflake, interactionToken: string) => `interactions/${string}/${string}/callback`;
|
@@ -1,10 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityURL = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildEmojis = exports.guildEmoji = exports.
|
4
|
-
exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.
|
3
|
+
exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityURL = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildEmojis = exports.guildEmoji = exports.guildMemberNickname = exports.guildChannels = exports.guildBulkBan = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = void 0;
|
4
|
+
exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = exports.oauth2Application = exports.oauth2Authorize = exports.gatewayBot = exports.gateway = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSKUs = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = exports.channelMessageReaction = void 0;
|
5
5
|
// Guilds
|
6
|
-
const bulkGuildBan = (guildID) => `guilds/${guildID}/bulk-ban`;
|
7
|
-
exports.bulkGuildBan = bulkGuildBan;
|
8
6
|
const guild = (guildID) => `guilds/${guildID}`;
|
9
7
|
exports.guild = guild;
|
10
8
|
const guilds = () => "guilds";
|
@@ -21,10 +19,12 @@ const guildBan = (guildID, userID) => `guilds/${guildID}/bans/${userID}`;
|
|
21
19
|
exports.guildBan = guildBan;
|
22
20
|
const guildBans = (guildID) => `guilds/${guildID}/bans`;
|
23
21
|
exports.guildBans = guildBans;
|
22
|
+
const guildBulkBan = (guildID) => `guilds/${guildID}/bulk-ban`;
|
23
|
+
exports.guildBulkBan = guildBulkBan;
|
24
24
|
const guildChannels = (guildID) => `guilds/${guildID}/channels`;
|
25
25
|
exports.guildChannels = guildChannels;
|
26
|
-
const
|
27
|
-
exports.
|
26
|
+
const guildMemberNickname = (guildID) => `guilds/${guildID}/members/@me/nick`;
|
27
|
+
exports.guildMemberNickname = guildMemberNickname;
|
28
28
|
const guildEmoji = (guildID, emojiID) => `guilds/${guildID}/emojis/${emojiID}`;
|
29
29
|
exports.guildEmoji = guildEmoji;
|
30
30
|
const guildEmojis = (guildID) => `guilds/${guildID}/emojis`;
|
@@ -158,8 +158,8 @@ const applicationCommands = (applicationID) => `applications/${applicationID}/co
|
|
158
158
|
exports.applicationCommands = applicationCommands;
|
159
159
|
const applicationCommandPermissions = (applicationID, guildID, commandID) => `applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions`;
|
160
160
|
exports.applicationCommandPermissions = applicationCommandPermissions;
|
161
|
-
const
|
162
|
-
exports.
|
161
|
+
const applicationUser = () => "applications/@me";
|
162
|
+
exports.applicationUser = applicationUser;
|
163
163
|
const applicationEntitlement = (applicationID, entitlementID) => `applications/${applicationID}/entitlements/${entitlementID}`;
|
164
164
|
exports.applicationEntitlement = applicationEntitlement;
|
165
165
|
const applicationEntitlementConsume = (applicationID, entitlementID) => `applications/${applicationID}/entitlements/${entitlementID}/consume`;
|
@@ -191,12 +191,12 @@ exports.gateway = gateway;
|
|
191
191
|
const gatewayBot = () => "gateway/bot";
|
192
192
|
exports.gatewayBot = gatewayBot;
|
193
193
|
// OAuth2
|
194
|
-
const
|
194
|
+
const oauth2Authorize = () => "oauth2/authorize";
|
195
|
+
exports.oauth2Authorize = oauth2Authorize;
|
196
|
+
const oauth2Application = () => `oauth2/applications/@me`;
|
197
|
+
exports.oauth2Application = oauth2Application;
|
198
|
+
const oauth2Authorization = () => "oauth2/@me";
|
195
199
|
exports.oauth2Authorization = oauth2Authorization;
|
196
|
-
const oauth2CurrentApplication = () => `oauth2/applications/@me`;
|
197
|
-
exports.oauth2CurrentApplication = oauth2CurrentApplication;
|
198
|
-
const oauth2CurrentAuthorization = () => "oauth2/@me";
|
199
|
-
exports.oauth2CurrentAuthorization = oauth2CurrentAuthorization;
|
200
200
|
const oauth2TokenExchange = () => "oauth2/token";
|
201
201
|
exports.oauth2TokenExchange = oauth2TokenExchange;
|
202
202
|
const oauth2TokenRevocation = () => "oauth2/token/revoke";
|
@@ -106,7 +106,7 @@ class RequestManager {
|
|
106
106
|
const responseJSON = await response.json();
|
107
107
|
reject(responseJSON.code !== 0
|
108
108
|
? new utils_1.RESTError(responseJSON.code, responseJSON.message, responseJSON.errors, method, endpoint)
|
109
|
-
: new utils_1.HTTPError(response.status, response.statusText, method, endpoint));
|
109
|
+
: new utils_1.HTTPError(response.status, response.statusText, responseJSON.errors, method, endpoint));
|
110
110
|
}
|
111
111
|
}
|
112
112
|
else if (response.status === constants_1.HTTPResponseCodes.NoContent) {
|
package/dist/lib/rest/index.d.ts
CHANGED
package/dist/lib/rest/index.js
CHANGED
@@ -26,7 +26,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.Endpoints =
|
30
|
-
exports.CDN = __importStar(require("./CDN"));
|
29
|
+
exports.Endpoints = void 0;
|
31
30
|
exports.Endpoints = __importStar(require("./Endpoints"));
|
32
31
|
__exportStar(require("./RequestManager"), exports);
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { RawApplicationCommand, ApplicationCommand, ApplicationCommandOption, RawApplicationCommandOption } from "../types/application-command";
|
2
|
+
export declare class ApplicationCommands {
|
3
|
+
static applicationCommandFromRaw(command: RawApplicationCommand): ApplicationCommand;
|
4
|
+
static applicationCommandToRaw(command: ApplicationCommand): RawApplicationCommand;
|
5
|
+
static optionToRaw(option: ApplicationCommandOption): RawApplicationCommandOption;
|
6
|
+
static optionFromRaw(option: RawApplicationCommandOption): ApplicationCommandOption;
|
7
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ApplicationCommands = void 0;
|
4
|
+
class ApplicationCommands {
|
5
|
+
static applicationCommandFromRaw(command) {
|
6
|
+
return {
|
7
|
+
id: command.id,
|
8
|
+
type: command.type,
|
9
|
+
applicationID: command.application_id,
|
10
|
+
guildID: command.guild_id,
|
11
|
+
name: command.name,
|
12
|
+
nameLocalizations: command.name_localizations,
|
13
|
+
description: command.description,
|
14
|
+
descriptionLocalizations: command.description_localizations,
|
15
|
+
options: command.options?.map((option) => this.optionFromRaw(option)),
|
16
|
+
defaultMemberPermissions: command.default_member_permissions,
|
17
|
+
dmPermission: command.dm_permission,
|
18
|
+
defaultPermission: command.default_permission,
|
19
|
+
integrationTypes: command.integration_types,
|
20
|
+
contexts: command.contexts,
|
21
|
+
nsfw: command.nsfw,
|
22
|
+
version: command.version,
|
23
|
+
};
|
24
|
+
}
|
25
|
+
static applicationCommandToRaw(command) {
|
26
|
+
return {
|
27
|
+
id: command.id,
|
28
|
+
type: command.type,
|
29
|
+
application_id: command.applicationID,
|
30
|
+
guild_id: command.guildID,
|
31
|
+
name: command.name,
|
32
|
+
name_localizations: command.nameLocalizations,
|
33
|
+
description: command.description,
|
34
|
+
description_localizations: command.descriptionLocalizations,
|
35
|
+
options: command.options?.map((option) => this.optionToRaw(option)),
|
36
|
+
default_member_permissions: command.defaultMemberPermissions,
|
37
|
+
dm_permission: command.dmPermission,
|
38
|
+
default_permission: command.defaultPermission,
|
39
|
+
integration_types: command.integrationTypes,
|
40
|
+
contexts: command.contexts,
|
41
|
+
nsfw: command.nsfw,
|
42
|
+
version: command.version,
|
43
|
+
};
|
44
|
+
}
|
45
|
+
static optionToRaw(option) {
|
46
|
+
return {
|
47
|
+
type: option.type,
|
48
|
+
name: option.name,
|
49
|
+
name_localizations: option.nameLocalizations,
|
50
|
+
description: option.description,
|
51
|
+
description_localizations: option.descriptionLocalizations,
|
52
|
+
required: option.required,
|
53
|
+
choices: option.choices?.map((choice) => ({
|
54
|
+
name: choice.name,
|
55
|
+
name_localizations: choice.nameLocalizations,
|
56
|
+
value: choice.value,
|
57
|
+
})),
|
58
|
+
options: option.options?.map((o) => this.optionFromRaw(o)),
|
59
|
+
channel_types: option.channelTypes,
|
60
|
+
min_value: option.minValue,
|
61
|
+
max_value: option.maxValue,
|
62
|
+
min_length: option.minLength,
|
63
|
+
max_length: option.maxLength,
|
64
|
+
autocomplete: option.autocomplete,
|
65
|
+
};
|
66
|
+
}
|
67
|
+
static optionFromRaw(option) {
|
68
|
+
return {
|
69
|
+
type: option.type,
|
70
|
+
name: option.name,
|
71
|
+
nameLocalizations: option.name_localizations,
|
72
|
+
description: option.description,
|
73
|
+
descriptionLocalizations: option.description_localizations,
|
74
|
+
required: option.required,
|
75
|
+
choices: option.choices?.map((choice) => ({
|
76
|
+
name: choice.name,
|
77
|
+
nameLocalizations: choice.name_localizations,
|
78
|
+
value: choice.value,
|
79
|
+
})),
|
80
|
+
options: option.options?.map((o) => this.optionFromRaw(o)),
|
81
|
+
channelTypes: option.channel_types,
|
82
|
+
minValue: option.min_value,
|
83
|
+
maxValue: option.max_value,
|
84
|
+
minLength: option.min_length,
|
85
|
+
maxLength: option.max_length,
|
86
|
+
autocomplete: option.autocomplete,
|
87
|
+
};
|
88
|
+
}
|
89
|
+
}
|
90
|
+
exports.ApplicationCommands = ApplicationCommands;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { ApplicationRoleConnectionMetadata, RawApplicationRoleConnectionMetadata } from "../types/application-role-connection-metadata";
|
2
|
+
export declare class ApplicationRoleConnectionMetadatas {
|
3
|
+
static applicationRoleConnectionMetadataFromRaw(connectionMetadata: RawApplicationRoleConnectionMetadata): ApplicationRoleConnectionMetadata;
|
4
|
+
static applicationRoleConnectionMetadataToRaw(connectionMetadata: ApplicationRoleConnectionMetadata): RawApplicationRoleConnectionMetadata;
|
5
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ApplicationRoleConnectionMetadatas = void 0;
|
4
|
+
class ApplicationRoleConnectionMetadatas {
|
5
|
+
static applicationRoleConnectionMetadataFromRaw(connectionMetadata) {
|
6
|
+
return {
|
7
|
+
type: connectionMetadata.type,
|
8
|
+
key: connectionMetadata.key,
|
9
|
+
name: connectionMetadata.name,
|
10
|
+
nameLocalizations: connectionMetadata.name_localizations,
|
11
|
+
description: connectionMetadata.description,
|
12
|
+
descriptionLocalizations: connectionMetadata.description_localizations,
|
13
|
+
};
|
14
|
+
}
|
15
|
+
static applicationRoleConnectionMetadataToRaw(connectionMetadata) {
|
16
|
+
return {
|
17
|
+
type: connectionMetadata.type,
|
18
|
+
key: connectionMetadata.key,
|
19
|
+
name: connectionMetadata.name,
|
20
|
+
name_localizations: connectionMetadata.nameLocalizations,
|
21
|
+
description: connectionMetadata.description,
|
22
|
+
description_localizations: connectionMetadata.descriptionLocalizations,
|
23
|
+
};
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.ApplicationRoleConnectionMetadatas = ApplicationRoleConnectionMetadatas;
|
@@ -0,0 +1,97 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Applications = void 0;
|
4
|
+
const Guilds_1 = require("./Guilds");
|
5
|
+
const Teams_1 = require("./Teams");
|
6
|
+
const Users_1 = require("./Users");
|
7
|
+
class Applications {
|
8
|
+
static applicationFromRaw(application) {
|
9
|
+
return {
|
10
|
+
id: application.id,
|
11
|
+
name: application.name,
|
12
|
+
icon: application.icon,
|
13
|
+
description: application.description,
|
14
|
+
rpcOrigins: application.rpc_origins,
|
15
|
+
botPublic: application.bot_public,
|
16
|
+
botRequireCodeGrant: application.bot_require_code_grant,
|
17
|
+
termsOfServiceURL: application.terms_of_service_url,
|
18
|
+
privacyPolicyURL: application.privacy_policy_url,
|
19
|
+
owner: application.owner !== undefined
|
20
|
+
? Users_1.Users.userFromRaw(application.owner)
|
21
|
+
: undefined,
|
22
|
+
verifyKey: application.verify_key,
|
23
|
+
team: application.team !== null ? Teams_1.Teams.teamFromRaw(application.team) : null,
|
24
|
+
guildID: application.guild_id,
|
25
|
+
guild: application.guild !== undefined
|
26
|
+
? Guilds_1.Guilds.guildFromRaw(application.guild)
|
27
|
+
: undefined,
|
28
|
+
primarySKUID: application.primary_sku_id,
|
29
|
+
slug: application.slug,
|
30
|
+
coverImage: application.cover_image,
|
31
|
+
flags: application.flags,
|
32
|
+
approximateGuildCount: application.approximate_guild_count,
|
33
|
+
redirectURIs: application.redirect_uris,
|
34
|
+
interactionsEndpointURL: application.interactions_endpoint_url,
|
35
|
+
roleConnectionsVerificationURL: application.role_connections_verification_url,
|
36
|
+
tags: application.tags,
|
37
|
+
installParams: application.install_params,
|
38
|
+
integrationTypesConfig: application.integration_types_config !== undefined
|
39
|
+
? {
|
40
|
+
"0": {
|
41
|
+
oauth2InstallParams: application.integration_types_config?.[0]
|
42
|
+
.oauth2_install_params,
|
43
|
+
},
|
44
|
+
"1": {
|
45
|
+
oauth2InstallParams: application.integration_types_config?.[1]
|
46
|
+
.oauth2_install_params,
|
47
|
+
},
|
48
|
+
}
|
49
|
+
: undefined,
|
50
|
+
customInstallURL: application.custom_install_url,
|
51
|
+
};
|
52
|
+
}
|
53
|
+
static applicationToRaw(application) {
|
54
|
+
return {
|
55
|
+
id: application.id,
|
56
|
+
name: application.name,
|
57
|
+
icon: application.icon,
|
58
|
+
description: application.description,
|
59
|
+
rpc_origins: application.rpcOrigins,
|
60
|
+
bot_public: application.botPublic,
|
61
|
+
bot_require_code_grant: application.botRequireCodeGrant,
|
62
|
+
terms_of_service_url: application.termsOfServiceURL,
|
63
|
+
privacy_policy_url: application.privacyPolicyURL,
|
64
|
+
owner: application.owner !== undefined
|
65
|
+
? Users_1.Users.userToRaw(application.owner)
|
66
|
+
: undefined,
|
67
|
+
verify_key: application.verifyKey,
|
68
|
+
team: application.team !== null ? Teams_1.Teams.teamToRaw(application.team) : null,
|
69
|
+
guild_id: application.guildID,
|
70
|
+
guild: application.guild !== undefined
|
71
|
+
? Guilds_1.Guilds.guildToRaw(application.guild)
|
72
|
+
: undefined,
|
73
|
+
primary_sku_id: application.primarySKUID,
|
74
|
+
slug: application.slug,
|
75
|
+
cover_image: application.coverImage,
|
76
|
+
flags: application.flags,
|
77
|
+
approximate_guild_count: application.approximateGuildCount,
|
78
|
+
redirect_uris: application.redirectURIs,
|
79
|
+
interactions_endpoint_url: application.interactionsEndpointURL,
|
80
|
+
role_connections_verification_url: application.roleConnectionsVerificationURL,
|
81
|
+
tags: application.tags,
|
82
|
+
install_params: application.installParams,
|
83
|
+
integration_types_config: application.integrationTypesConfig !== undefined
|
84
|
+
? {
|
85
|
+
"0": {
|
86
|
+
oauth2_install_params: application.integrationTypesConfig?.[0].oauth2InstallParams,
|
87
|
+
},
|
88
|
+
"1": {
|
89
|
+
oauth2_install_params: application.integrationTypesConfig?.[1].oauth2InstallParams,
|
90
|
+
},
|
91
|
+
}
|
92
|
+
: undefined,
|
93
|
+
custom_install_url: application.customInstallURL,
|
94
|
+
};
|
95
|
+
}
|
96
|
+
}
|
97
|
+
exports.Applications = Applications;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { RawAuditLogEntry, AuditLogEntry, RawAuditLog, AuditLog } from "../types/audit-log";
|
2
|
+
export declare class AuditLogs {
|
3
|
+
static auditLogEntryFromRaw(auditLogEntry: RawAuditLogEntry): AuditLogEntry;
|
4
|
+
static auditLogEntryToRaw(auditLogEntry: AuditLogEntry): RawAuditLogEntry;
|
5
|
+
static auditLogFromRaw(auditLog: RawAuditLog): AuditLog;
|
6
|
+
static auditLogToRaw(auditLog: AuditLog): RawAuditLog;
|
7
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AuditLogs = void 0;
|
4
|
+
const ApplicationCommands_1 = require("./ApplicationCommands");
|
5
|
+
const AutoModeration_1 = require("./AutoModeration");
|
6
|
+
const Channels_1 = require("./Channels");
|
7
|
+
const Guilds_1 = require("./Guilds");
|
8
|
+
const GuildScheduledEvents_1 = require("./GuildScheduledEvents");
|
9
|
+
const Users_1 = require("./Users");
|
10
|
+
const Webhooks_1 = require("./Webhooks");
|
11
|
+
class AuditLogs {
|
12
|
+
static auditLogEntryFromRaw(auditLogEntry) {
|
13
|
+
return {
|
14
|
+
targetID: auditLogEntry.target_id,
|
15
|
+
changes: auditLogEntry.changes?.map((auditLogChange) => ({
|
16
|
+
newValue: auditLogChange.new_value,
|
17
|
+
oldValue: auditLogChange.old_value,
|
18
|
+
key: auditLogChange.key,
|
19
|
+
})),
|
20
|
+
userID: auditLogEntry.user_id,
|
21
|
+
id: auditLogEntry.id,
|
22
|
+
actionType: auditLogEntry.action_type,
|
23
|
+
options: auditLogEntry.options !== undefined
|
24
|
+
? {
|
25
|
+
applicationID: auditLogEntry.options.application_id,
|
26
|
+
autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
|
27
|
+
autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
|
28
|
+
channelID: auditLogEntry.options.channel_id,
|
29
|
+
count: auditLogEntry.options.count,
|
30
|
+
deleteMemberDays: auditLogEntry.options.delete_member_days,
|
31
|
+
id: auditLogEntry.options.id,
|
32
|
+
membersRemoved: auditLogEntry.options.members_removed,
|
33
|
+
messageID: auditLogEntry.options.message_id,
|
34
|
+
roleName: auditLogEntry.options.role_name,
|
35
|
+
type: auditLogEntry.options.type,
|
36
|
+
integrationType: auditLogEntry.options.integration_type,
|
37
|
+
}
|
38
|
+
: undefined,
|
39
|
+
reason: auditLogEntry.reason,
|
40
|
+
};
|
41
|
+
}
|
42
|
+
static auditLogEntryToRaw(auditLogEntry) {
|
43
|
+
return {
|
44
|
+
target_id: auditLogEntry.targetID,
|
45
|
+
changes: auditLogEntry.changes?.map((auditLogChange) => ({
|
46
|
+
new_value: auditLogChange.newValue,
|
47
|
+
old_value: auditLogChange.oldValue,
|
48
|
+
key: auditLogChange.key,
|
49
|
+
})),
|
50
|
+
user_id: auditLogEntry.userID,
|
51
|
+
id: auditLogEntry.id,
|
52
|
+
action_type: auditLogEntry.actionType,
|
53
|
+
options: auditLogEntry.options !== undefined
|
54
|
+
? {
|
55
|
+
application_id: auditLogEntry.options.applicationID,
|
56
|
+
auto_moderation_rule_name: auditLogEntry.options.autoModerationRuleName,
|
57
|
+
auto_moderation_rule_trigger_type: auditLogEntry.options.autoModerationRuleTriggerType,
|
58
|
+
channel_id: auditLogEntry.options.channelID,
|
59
|
+
count: auditLogEntry.options.count,
|
60
|
+
delete_member_days: auditLogEntry.options.deleteMemberDays,
|
61
|
+
id: auditLogEntry.options.id,
|
62
|
+
members_removed: auditLogEntry.options.membersRemoved,
|
63
|
+
message_id: auditLogEntry.options.messageID,
|
64
|
+
role_name: auditLogEntry.options.roleName,
|
65
|
+
type: auditLogEntry.options.type,
|
66
|
+
integration_type: auditLogEntry.options.integrationType,
|
67
|
+
}
|
68
|
+
: undefined,
|
69
|
+
reason: auditLogEntry.reason,
|
70
|
+
};
|
71
|
+
}
|
72
|
+
static auditLogFromRaw(auditLog) {
|
73
|
+
return {
|
74
|
+
applicationCommands: auditLog.application_commands.map((applicationCommand) => ApplicationCommands_1.ApplicationCommands.applicationCommandFromRaw(applicationCommand)),
|
75
|
+
auditLogEntries: auditLog.audit_log_entries.map((auditLogEntry) => AuditLogs.auditLogEntryFromRaw(auditLogEntry)),
|
76
|
+
autoModerationRules: auditLog.auto_moderation_rules.map((autoModerationRule) => AutoModeration_1.AutoModeration.autoModerationRuleFromRaw(autoModerationRule)),
|
77
|
+
guildScheduledEvents: auditLog.guild_scheduled_events.map((guildScheduledEvent) => GuildScheduledEvents_1.GuildScheduledEvents.guildScheduledEventFromRaw(guildScheduledEvent)),
|
78
|
+
integrations: auditLog.integrations.map((integration) => Guilds_1.Guilds.integrationFromRaw(integration)),
|
79
|
+
threads: auditLog.threads.map((thread) => Channels_1.Channels.channelFromRaw(thread)),
|
80
|
+
users: auditLog.users.map((user) => Users_1.Users.userFromRaw(user)),
|
81
|
+
webhooks: auditLog.webhooks.map((webhook) => Webhooks_1.Webhooks.webhookFromRaw(webhook)),
|
82
|
+
};
|
83
|
+
}
|
84
|
+
static auditLogToRaw(auditLog) {
|
85
|
+
return {
|
86
|
+
application_commands: auditLog.applicationCommands.map((applicationCommand) => ApplicationCommands_1.ApplicationCommands.applicationCommandToRaw(applicationCommand)),
|
87
|
+
audit_log_entries: auditLog.auditLogEntries.map((auditLogEntry) => AuditLogs.auditLogEntryToRaw(auditLogEntry)),
|
88
|
+
auto_moderation_rules: auditLog.autoModerationRules.map((autoModerationRule) => AutoModeration_1.AutoModeration.autoModerationRuleToRaw(autoModerationRule)),
|
89
|
+
guild_scheduled_events: auditLog.guildScheduledEvents.map((guildScheduledEvent) => GuildScheduledEvents_1.GuildScheduledEvents.guildScheduledEventToRaw(guildScheduledEvent)),
|
90
|
+
integrations: auditLog.integrations.map((integration) => Guilds_1.Guilds.integrationToRaw(integration)),
|
91
|
+
threads: auditLog.threads.map((thread) => Channels_1.Channels.channelToRaw(thread)),
|
92
|
+
users: auditLog.users.map((user) => Users_1.Users.userToRaw(user)),
|
93
|
+
webhooks: auditLog.webhooks.map((webhook) => Webhooks_1.Webhooks.webhookToRaw(webhook)),
|
94
|
+
};
|
95
|
+
}
|
96
|
+
}
|
97
|
+
exports.AuditLogs = AuditLogs;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { AutoModerationAction, AutoModerationRule, RawAutoModerationAction, RawAutoModerationRule, RawTriggerMetadata, TriggerMetadata } from "../types/auto-moderation";
|
2
|
+
export declare class AutoModeration {
|
3
|
+
static actionFromRaw(action: RawAutoModerationAction): AutoModerationAction;
|
4
|
+
static actionToRaw(action: AutoModerationAction): RawAutoModerationAction;
|
5
|
+
static autoModerationRuleFromRaw(autoModerationRule: RawAutoModerationRule): AutoModerationRule;
|
6
|
+
static autoModerationRuleToRaw(autoModerationRule: AutoModerationRule): RawAutoModerationRule;
|
7
|
+
static triggerMetadataFromRaw(triggerMetadata: RawTriggerMetadata): TriggerMetadata;
|
8
|
+
static triggerMetadataToRaw(triggerMetadata: TriggerMetadata): RawTriggerMetadata;
|
9
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AutoModeration = void 0;
|
4
|
+
class AutoModeration {
|
5
|
+
static actionFromRaw(action) {
|
6
|
+
return {
|
7
|
+
type: action.type,
|
8
|
+
metadata: {
|
9
|
+
channelID: action.metadata.channel_id,
|
10
|
+
durationSeconds: action.metadata.duration_seconds,
|
11
|
+
customMessage: action.metadata.custom_message,
|
12
|
+
},
|
13
|
+
};
|
14
|
+
}
|
15
|
+
static actionToRaw(action) {
|
16
|
+
return {
|
17
|
+
type: action.type,
|
18
|
+
metadata: {
|
19
|
+
channel_id: action.metadata.channelID,
|
20
|
+
duration_seconds: action.metadata.durationSeconds,
|
21
|
+
custom_message: action.metadata.customMessage,
|
22
|
+
},
|
23
|
+
};
|
24
|
+
}
|
25
|
+
static autoModerationRuleFromRaw(autoModerationRule) {
|
26
|
+
return {
|
27
|
+
id: autoModerationRule.id,
|
28
|
+
guildID: autoModerationRule.guild_id,
|
29
|
+
name: autoModerationRule.name,
|
30
|
+
creatorID: autoModerationRule.creator_id,
|
31
|
+
eventType: autoModerationRule.event_type,
|
32
|
+
triggerType: autoModerationRule.trigger_type,
|
33
|
+
triggerMetadata: this.triggerMetadataFromRaw(autoModerationRule.trigger_metadata),
|
34
|
+
actions: autoModerationRule.actions.map((action) => this.actionFromRaw(action)),
|
35
|
+
enabled: autoModerationRule.enabled,
|
36
|
+
exemptRoles: autoModerationRule.exempt_roles,
|
37
|
+
exemptChannels: autoModerationRule.exempt_channels,
|
38
|
+
};
|
39
|
+
}
|
40
|
+
static autoModerationRuleToRaw(autoModerationRule) {
|
41
|
+
return {
|
42
|
+
id: autoModerationRule.id,
|
43
|
+
guild_id: autoModerationRule.guildID,
|
44
|
+
name: autoModerationRule.name,
|
45
|
+
creator_id: autoModerationRule.creatorID,
|
46
|
+
event_type: autoModerationRule.eventType,
|
47
|
+
trigger_type: autoModerationRule.triggerType,
|
48
|
+
trigger_metadata: this.triggerMetadataToRaw(autoModerationRule.triggerMetadata),
|
49
|
+
actions: autoModerationRule.actions.map((action) => this.actionToRaw(action)),
|
50
|
+
enabled: autoModerationRule.enabled,
|
51
|
+
exempt_roles: autoModerationRule.exemptRoles,
|
52
|
+
exempt_channels: autoModerationRule.exemptChannels,
|
53
|
+
};
|
54
|
+
}
|
55
|
+
static triggerMetadataFromRaw(triggerMetadata) {
|
56
|
+
return {
|
57
|
+
keywordFilter: triggerMetadata.keyword_filter,
|
58
|
+
regexPatterns: triggerMetadata.regex_patterns,
|
59
|
+
presets: triggerMetadata.presets,
|
60
|
+
allowList: triggerMetadata.allow_list,
|
61
|
+
mentionTotalLimit: triggerMetadata.mention_total_limit,
|
62
|
+
mentionRaidProtection: triggerMetadata.mention_raid_protection,
|
63
|
+
};
|
64
|
+
}
|
65
|
+
static triggerMetadataToRaw(triggerMetadata) {
|
66
|
+
return {
|
67
|
+
keyword_filter: triggerMetadata.keywordFilter,
|
68
|
+
regex_patterns: triggerMetadata.regexPatterns,
|
69
|
+
presets: triggerMetadata.presets,
|
70
|
+
allow_list: triggerMetadata.allowList,
|
71
|
+
mention_total_limit: triggerMetadata.mentionTotalLimit,
|
72
|
+
mention_raid_protection: triggerMetadata.mentionRaidProtection,
|
73
|
+
};
|
74
|
+
}
|
75
|
+
}
|
76
|
+
exports.AutoModeration = AutoModeration;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { RawAttachment, Attachment, RawChannel, Channel, RawEmbed, Embed, RawMessage, Message, RawThreadMember, ThreadMember } from "../types/channel";
|
2
|
+
import type { RawActionRow, ActionRow } from "../types/message-components";
|
3
|
+
export declare class Channels {
|
4
|
+
static attachmentFromRaw(attachment: RawAttachment): Attachment;
|
5
|
+
static attachmentToRaw(attachment: Attachment): RawAttachment;
|
6
|
+
static channelFromRaw(channel: RawChannel): Channel;
|
7
|
+
static channelToRaw(channel: Channel): RawChannel;
|
8
|
+
static componentsFromRaw(components: Array<RawActionRow>): Array<ActionRow>;
|
9
|
+
static componentsToRaw(components: Array<ActionRow>): Array<RawActionRow>;
|
10
|
+
static embedFromRaw(embed: RawEmbed): Embed;
|
11
|
+
static embedToRaw(embed: Embed): RawEmbed;
|
12
|
+
static messageFromRaw(message: RawMessage): Message;
|
13
|
+
static messageToRaw(message: Message): RawMessage;
|
14
|
+
static threadMemberFromRaw(threadMember: RawThreadMember): ThreadMember;
|
15
|
+
static threadMemberToRaw(threadMember: ThreadMember): RawThreadMember;
|
16
|
+
}
|