oceanic.js 1.10.3-dev.c6c9f52 → 1.10.3-dev.ca8b6e8
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/dist/lib/Client.d.ts +99 -0
- package/dist/lib/Client.js +263 -0
- package/dist/lib/Constants.d.ts +1215 -0
- package/dist/lib/Constants.js +1513 -0
- package/dist/lib/gateway/Shard.d.ts +83 -0
- package/dist/lib/gateway/Shard.js +1621 -0
- package/dist/lib/gateway/ShardManager.d.ts +29 -0
- package/dist/lib/gateway/ShardManager.js +300 -0
- package/dist/lib/index.d.ts +84 -0
- package/dist/lib/index.js +168 -0
- package/dist/lib/rest/Bucket.d.ts +33 -0
- package/dist/lib/rest/Bucket.js +78 -0
- package/dist/lib/rest/DiscordHTTPError.d.ts +16 -0
- package/dist/lib/rest/DiscordHTTPError.js +65 -0
- package/dist/lib/rest/DiscordRESTError.d.ts +19 -0
- package/dist/lib/rest/DiscordRESTError.js +89 -0
- package/dist/lib/rest/OAuthHelper.d.ts +62 -0
- package/dist/lib/rest/OAuthHelper.js +183 -0
- package/dist/lib/rest/RESTManager.d.ts +42 -0
- package/dist/lib/rest/RESTManager.js +82 -0
- package/dist/lib/rest/RequestHandler.d.ts +28 -0
- package/dist/lib/rest/RequestHandler.js +313 -0
- package/dist/lib/rest/SequentialBucket.d.ts +25 -0
- package/dist/lib/rest/SequentialBucket.js +76 -0
- package/dist/lib/routes/Applications.d.ts +171 -0
- package/dist/lib/routes/Applications.js +447 -0
- package/dist/lib/routes/Channels.d.ts +408 -0
- package/dist/lib/routes/Channels.js +1160 -0
- package/dist/lib/routes/Guilds.d.ts +606 -0
- package/dist/lib/routes/Guilds.js +1669 -0
- package/dist/lib/routes/Interactions.d.ts +74 -0
- package/dist/lib/routes/Interactions.js +141 -0
- package/dist/lib/routes/Miscellaneous.d.ts +31 -0
- package/dist/lib/routes/Miscellaneous.js +69 -0
- package/dist/lib/routes/OAuth.d.ts +108 -0
- package/dist/lib/routes/OAuth.js +312 -0
- package/dist/lib/routes/Users.d.ts +32 -0
- package/dist/lib/routes/Users.js +59 -0
- package/dist/lib/routes/Webhooks.d.ts +128 -0
- package/dist/lib/routes/Webhooks.js +265 -0
- package/dist/lib/structures/AnnouncementChannel.d.ts +36 -0
- package/dist/lib/structures/AnnouncementChannel.js +47 -0
- package/dist/lib/structures/AnnouncementThreadChannel.d.ts +18 -0
- package/dist/lib/structures/AnnouncementThreadChannel.js +27 -0
- package/dist/lib/structures/Application.d.ts +102 -0
- package/dist/lib/structures/Application.js +189 -0
- package/dist/lib/structures/ApplicationCommand.d.ts +74 -0
- package/dist/lib/structures/ApplicationCommand.js +141 -0
- package/dist/lib/structures/Attachment.d.ts +34 -0
- package/dist/lib/structures/Attachment.js +64 -0
- package/dist/lib/structures/AuditLogEntry.d.ts +25 -0
- package/dist/lib/structures/AuditLogEntry.js +53 -0
- package/dist/lib/structures/AutoModerationRule.d.ts +49 -0
- package/dist/lib/structures/AutoModerationRule.js +139 -0
- package/dist/lib/structures/AutocompleteInteraction.d.ts +62 -0
- package/dist/lib/structures/AutocompleteInteraction.js +115 -0
- package/dist/lib/structures/Base.d.ts +20 -0
- package/dist/lib/structures/Base.js +58 -0
- package/dist/lib/structures/BaseEntitlement.d.ts +19 -0
- package/dist/lib/structures/BaseEntitlement.js +44 -0
- package/dist/lib/structures/CategoryChannel.d.ts +41 -0
- package/dist/lib/structures/CategoryChannel.js +105 -0
- package/dist/lib/structures/Channel.d.ts +20 -0
- package/dist/lib/structures/Channel.js +91 -0
- package/dist/lib/structures/ClientApplication.d.ts +153 -0
- package/dist/lib/structures/ClientApplication.js +220 -0
- package/dist/lib/structures/CommandInteraction.d.ts +127 -0
- package/dist/lib/structures/CommandInteraction.js +297 -0
- package/dist/lib/structures/ComponentInteraction.d.ts +137 -0
- package/dist/lib/structures/ComponentInteraction.js +311 -0
- package/dist/lib/structures/Entitlement.d.ts +12 -0
- package/dist/lib/structures/Entitlement.js +26 -0
- package/dist/lib/structures/ExtendedUser.d.ts +26 -0
- package/dist/lib/structures/ExtendedUser.js +57 -0
- package/dist/lib/structures/ForumChannel.d.ts +11 -0
- package/dist/lib/structures/ForumChannel.js +19 -0
- package/dist/lib/structures/GroupChannel.d.ts +62 -0
- package/dist/lib/structures/GroupChannel.js +133 -0
- package/dist/lib/structures/Guild.d.ts +654 -0
- package/dist/lib/structures/Guild.js +1319 -0
- package/dist/lib/structures/GuildChannel.d.ts +34 -0
- package/dist/lib/structures/GuildChannel.js +75 -0
- package/dist/lib/structures/GuildPreview.d.ts +50 -0
- package/dist/lib/structures/GuildPreview.js +119 -0
- package/dist/lib/structures/GuildScheduledEvent.d.ts +60 -0
- package/dist/lib/structures/GuildScheduledEvent.js +154 -0
- package/dist/lib/structures/GuildTemplate.d.ts +55 -0
- package/dist/lib/structures/GuildTemplate.js +126 -0
- package/dist/lib/structures/Integration.d.ts +54 -0
- package/dist/lib/structures/Integration.js +156 -0
- package/dist/lib/structures/Interaction.d.ts +40 -0
- package/dist/lib/structures/Interaction.js +90 -0
- package/dist/lib/structures/InteractionResolvedChannel.d.ts +28 -0
- package/dist/lib/structures/InteractionResolvedChannel.js +45 -0
- package/dist/lib/structures/Invite.d.ts +64 -0
- package/dist/lib/structures/Invite.js +193 -0
- package/dist/lib/structures/InviteGuild.d.ts +52 -0
- package/dist/lib/structures/InviteGuild.js +88 -0
- package/dist/lib/structures/MediaChannel.d.ts +11 -0
- package/dist/lib/structures/MediaChannel.js +19 -0
- package/dist/lib/structures/Member.d.ts +122 -0
- package/dist/lib/structures/Member.js +255 -0
- package/dist/lib/structures/Message.d.ts +194 -0
- package/dist/lib/structures/Message.js +477 -0
- package/dist/lib/structures/ModalSubmitInteraction.d.ts +128 -0
- package/dist/lib/structures/ModalSubmitInteraction.js +240 -0
- package/dist/lib/structures/OAuthApplication.d.ts +79 -0
- package/dist/lib/structures/OAuthApplication.js +210 -0
- package/dist/lib/structures/OAuthGuild.d.ts +35 -0
- package/dist/lib/structures/OAuthGuild.js +61 -0
- package/dist/lib/structures/PartialApplication.d.ts +30 -0
- package/dist/lib/structures/PartialApplication.js +67 -0
- package/dist/lib/structures/Permission.d.ts +21 -0
- package/dist/lib/structures/Permission.js +68 -0
- package/dist/lib/structures/PermissionOverwrite.d.ts +26 -0
- package/dist/lib/structures/PermissionOverwrite.js +49 -0
- package/dist/lib/structures/PingInteraction.d.ts +16 -0
- package/dist/lib/structures/PingInteraction.js +26 -0
- package/dist/lib/structures/Poll.d.ts +28 -0
- package/dist/lib/structures/Poll.js +78 -0
- package/dist/lib/structures/PrivateChannel.d.ts +90 -0
- package/dist/lib/structures/PrivateChannel.js +131 -0
- package/dist/lib/structures/PrivateThreadChannel.d.ts +18 -0
- package/dist/lib/structures/PrivateThreadChannel.js +27 -0
- package/dist/lib/structures/PublicThreadChannel.d.ts +21 -0
- package/dist/lib/structures/PublicThreadChannel.js +37 -0
- package/dist/lib/structures/Role.d.ts +52 -0
- package/dist/lib/structures/Role.js +137 -0
- package/dist/lib/structures/SKU.d.ts +32 -0
- package/dist/lib/structures/SKU.js +53 -0
- package/dist/lib/structures/StageChannel.d.ts +33 -0
- package/dist/lib/structures/StageChannel.js +44 -0
- package/dist/lib/structures/StageInstance.d.ts +36 -0
- package/dist/lib/structures/StageInstance.js +94 -0
- package/dist/lib/structures/Team.d.ts +22 -0
- package/dist/lib/structures/Team.js +67 -0
- package/dist/lib/structures/TestEntitlement.d.ts +10 -0
- package/dist/lib/structures/TestEntitlement.js +21 -0
- package/dist/lib/structures/TextChannel.d.ts +34 -0
- package/dist/lib/structures/TextChannel.js +46 -0
- package/dist/lib/structures/TextableChannel.d.ts +158 -0
- package/dist/lib/structures/TextableChannel.js +276 -0
- package/dist/lib/structures/TextableVoiceChannel.d.ts +39 -0
- package/dist/lib/structures/TextableVoiceChannel.js +81 -0
- package/dist/lib/structures/ThreadChannel.d.ts +159 -0
- package/dist/lib/structures/ThreadChannel.js +295 -0
- package/dist/lib/structures/ThreadOnlyChannel.d.ts +99 -0
- package/dist/lib/structures/ThreadOnlyChannel.js +233 -0
- package/dist/lib/structures/ThreadableChannel.d.ts +36 -0
- package/dist/lib/structures/ThreadableChannel.js +58 -0
- package/dist/lib/structures/UnavailableGuild.d.ts +11 -0
- package/dist/lib/structures/UnavailableGuild.js +21 -0
- package/dist/lib/structures/User.d.ts +82 -0
- package/dist/lib/structures/User.js +168 -0
- package/dist/lib/structures/VoiceChannel.d.ts +20 -0
- package/dist/lib/structures/VoiceChannel.js +35 -0
- package/dist/lib/structures/VoiceState.d.ts +51 -0
- package/dist/lib/structures/VoiceState.js +140 -0
- package/dist/lib/structures/Webhook.d.ts +129 -0
- package/dist/lib/structures/Webhook.js +206 -0
- package/dist/lib/types/applications.d.ts +466 -0
- package/dist/lib/types/audit-log.d.ts +122 -0
- package/dist/lib/types/auto-moderation.d.ts +99 -0
- package/dist/lib/types/channels.d.ts +1244 -0
- package/dist/lib/types/client.d.ts +228 -0
- package/dist/lib/types/events.d.ts +265 -0
- package/dist/lib/types/gateway-raw.d.ts +584 -0
- package/dist/lib/types/gateway.d.ts +351 -0
- package/dist/lib/types/guild-template.d.ts +33 -0
- package/dist/lib/types/guilds.d.ts +855 -0
- package/dist/lib/types/index.d.ts +18 -0
- package/dist/lib/types/interactions.d.ts +377 -0
- package/dist/lib/types/json.d.ts +742 -0
- package/dist/lib/types/misc.d.ts +28 -0
- package/dist/lib/types/oauth.d.ts +201 -0
- package/dist/lib/types/request-handler.d.ts +52 -0
- package/dist/lib/types/scheduled-events.d.ts +88 -0
- package/dist/lib/types/shared.d.ts +9 -0
- package/dist/lib/types/users.d.ts +45 -0
- package/dist/lib/types/voice.d.ts +45 -0
- package/dist/lib/types/webhooks.d.ts +74 -0
- package/dist/lib/util/Collection.d.ts +47 -0
- package/dist/lib/util/Collection.js +78 -0
- package/dist/lib/util/Errors.d.ts +29 -0
- package/dist/lib/util/Errors.js +56 -0
- package/dist/lib/util/Routes.d.ts +127 -0
- package/dist/lib/util/Routes.js +248 -0
- package/dist/lib/util/SimpleCollection.d.ts +12 -0
- package/dist/lib/util/SimpleCollection.js +81 -0
- package/dist/lib/util/TypedCollection.d.ts +24 -0
- package/dist/lib/util/TypedCollection.js +76 -0
- package/dist/lib/util/TypedEmitter.d.ts +19 -0
- package/dist/lib/util/TypedEmitter.js +19 -0
- package/dist/lib/util/Util.d.ts +58 -0
- package/dist/lib/util/Util.js +535 -0
- package/dist/lib/util/interactions/InteractionOptionsWrapper.d.ts +170 -0
- package/dist/lib/util/interactions/InteractionOptionsWrapper.js +213 -0
- package/dist/lib/util/interactions/MessageInteractionResponse.d.ts +24 -0
- package/dist/lib/util/interactions/MessageInteractionResponse.js +28 -0
- package/dist/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.d.ts +24 -0
- package/dist/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.js +34 -0
- package/dist/lib/util/interactions/SelectMenuValuesWrapper.d.ts +60 -0
- package/dist/lib/util/interactions/SelectMenuValuesWrapper.js +124 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module Application */
|
|
5
|
+
const ClientApplication_1 = tslib_1.__importDefault(require("./ClientApplication"));
|
|
6
|
+
const OAuthGuild_1 = tslib_1.__importDefault(require("./OAuthGuild"));
|
|
7
|
+
const User_1 = tslib_1.__importDefault(require("./User"));
|
|
8
|
+
const Team_1 = tslib_1.__importDefault(require("./Team"));
|
|
9
|
+
const Routes = tslib_1.__importStar(require("../util/Routes"));
|
|
10
|
+
/** Represents an application. */
|
|
11
|
+
class Application extends ClientApplication_1.default {
|
|
12
|
+
/** The approximate number of guilds the application is in. */
|
|
13
|
+
approximateGuildCount;
|
|
14
|
+
/** If the bot can be invited by anyone. */
|
|
15
|
+
botPublic;
|
|
16
|
+
/** If authorizing the bot requires a code grant. */
|
|
17
|
+
botRequireCodeGrant;
|
|
18
|
+
/** This application's rich presence invite cover image hash, if any. */
|
|
19
|
+
coverImage;
|
|
20
|
+
/** This application's default custom authorization link, if any. */
|
|
21
|
+
customInstallURL;
|
|
22
|
+
/** The description of the application. */
|
|
23
|
+
description;
|
|
24
|
+
/** The state of this application's discoverability. */
|
|
25
|
+
discoverabilityState;
|
|
26
|
+
/** The { @link Constants~ApplicationDiscoveryEligibilityFlags | flags } for this application's discovery eligibility. */
|
|
27
|
+
discoveryEligibilityFlags;
|
|
28
|
+
/** The explicit content filter for this application. */
|
|
29
|
+
explicitContentFilter;
|
|
30
|
+
/** If this application is a game sold on Discord, the guild to which it has been linked. This will only be present if recieved via {@link REST/Applications.getCurrent | `/applications/@me`}. */
|
|
31
|
+
guild;
|
|
32
|
+
/** If this application is a game sold on Discord, the ID of the guild to which it has been linked. */
|
|
33
|
+
guildID;
|
|
34
|
+
hook;
|
|
35
|
+
/** The icon hash of the application. */
|
|
36
|
+
icon;
|
|
37
|
+
/** Settings for this application's in-app authorization link, if enabled. */
|
|
38
|
+
installParams;
|
|
39
|
+
/** The install types available for this application. */
|
|
40
|
+
integrationTypes;
|
|
41
|
+
/** The configs for the install types available for this application. */
|
|
42
|
+
integrationTypesConfig;
|
|
43
|
+
/** This applications interaction endpoint url, if any. */
|
|
44
|
+
interactionsEndpointURL;
|
|
45
|
+
/** The event types that will be recieved like http interactions, if interactionsVersion is 2. */
|
|
46
|
+
interactionsEventTypes;
|
|
47
|
+
/** The interactions version of this application. */
|
|
48
|
+
interactionsVersion;
|
|
49
|
+
/** If this application is monetized. */
|
|
50
|
+
isMonetized;
|
|
51
|
+
/** The { @link Constants~ApplicationMonetizationEligibilityFlags | flags } for this application's monetization eligibility. */
|
|
52
|
+
monetizationEligibilityFlags;
|
|
53
|
+
/** This application's monetization state. */
|
|
54
|
+
monetizationState;
|
|
55
|
+
/** The name of the application. */
|
|
56
|
+
name;
|
|
57
|
+
/** The owner of this application. */
|
|
58
|
+
owner;
|
|
59
|
+
/** If this application is a game sold on Discord, the id of the Game's SKU. */
|
|
60
|
+
primarySKUID;
|
|
61
|
+
/** A URL to this application's privacy policy. */
|
|
62
|
+
privacyPolicyURL;
|
|
63
|
+
/** The redirect URIs for this application. */
|
|
64
|
+
redirectURIs;
|
|
65
|
+
/** This application's role connections verification url, if any. */
|
|
66
|
+
roleConnectionsVerificationURL;
|
|
67
|
+
/** The state of this application's RPC application. */
|
|
68
|
+
rpcApplicationState;
|
|
69
|
+
/** A list of rpc origin urls, if rpc is enabled. */
|
|
70
|
+
rpcOrigins;
|
|
71
|
+
/** If this application is a game sold on Discord, the slug that links to its store page. */
|
|
72
|
+
slug;
|
|
73
|
+
/** The state of this application's store application state. */
|
|
74
|
+
storeApplicationState;
|
|
75
|
+
/** The tags for this application. */
|
|
76
|
+
tags;
|
|
77
|
+
/** The team that owns this application. */
|
|
78
|
+
team;
|
|
79
|
+
/** A URL to this application's terms of service. */
|
|
80
|
+
termsOfServiceURL;
|
|
81
|
+
/** The type of this application. */
|
|
82
|
+
type;
|
|
83
|
+
/** The state of this application's verification. */
|
|
84
|
+
verificationState;
|
|
85
|
+
/** The bot's hex encoded public key. */
|
|
86
|
+
verifyKey;
|
|
87
|
+
constructor(data, client) {
|
|
88
|
+
super(data, client);
|
|
89
|
+
this.approximateGuildCount = data.approximate_guild_count ?? 0;
|
|
90
|
+
this.botPublic = data.bot_public;
|
|
91
|
+
this.botRequireCodeGrant = data.bot_require_code_grant;
|
|
92
|
+
this.coverImage = data.cover_image ?? null;
|
|
93
|
+
this.description = data.description;
|
|
94
|
+
this.discoverabilityState = data.discoverability_state;
|
|
95
|
+
this.discoveryEligibilityFlags = data.discovery_eligibility_flags;
|
|
96
|
+
this.explicitContentFilter = data.explicit_content_filter;
|
|
97
|
+
this.guild = data.guild === undefined ? null : new OAuthGuild_1.default(data.guild, client);
|
|
98
|
+
this.guildID = data.guild_id ?? null;
|
|
99
|
+
this.hook = data.hook;
|
|
100
|
+
this.icon = data.icon;
|
|
101
|
+
this.installParams = data.install_params;
|
|
102
|
+
this.integrationTypes = [];
|
|
103
|
+
this.integrationTypesConfig = {};
|
|
104
|
+
this.interactionsEndpointURL = null;
|
|
105
|
+
this.interactionsEventTypes = data.interactions_event_types;
|
|
106
|
+
this.interactionsVersion = data.interactions_version;
|
|
107
|
+
this.isMonetized = data.is_monetized;
|
|
108
|
+
this.monetizationEligibilityFlags = data.monetization_eligibility_flags;
|
|
109
|
+
this.monetizationState = data.monetization_state;
|
|
110
|
+
this.name = data.name;
|
|
111
|
+
this.owner = data.owner === undefined ? null : new User_1.default(data.owner, client);
|
|
112
|
+
this.primarySKUID = data.primary_sku_id;
|
|
113
|
+
this.privacyPolicyURL = data.privacy_policy_url;
|
|
114
|
+
this.redirectURIs = data.redirect_uris ?? [];
|
|
115
|
+
this.roleConnectionsVerificationURL = null;
|
|
116
|
+
this.rpcApplicationState = data.rpc_application_state;
|
|
117
|
+
this.rpcOrigins = data.rpc_origins ?? [];
|
|
118
|
+
this.slug = data.slug;
|
|
119
|
+
this.storeApplicationState = data.store_application_state;
|
|
120
|
+
this.tags = data.tags ?? [];
|
|
121
|
+
this.team = data.team ? new Team_1.default(data.team, client) : null;
|
|
122
|
+
this.termsOfServiceURL = data.terms_of_service_url;
|
|
123
|
+
this.type = data.type;
|
|
124
|
+
this.verificationState = data.verification_state;
|
|
125
|
+
this.verifyKey = data.verify_key;
|
|
126
|
+
this.update(data);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The url of this application's cover image.
|
|
130
|
+
* @param format The format the url should be.
|
|
131
|
+
* @param size The dimensions of the image.
|
|
132
|
+
*/
|
|
133
|
+
coverImageURL(format, size) {
|
|
134
|
+
return this.coverImage === null ? null : this.client.util.formatImage(Routes.APPLICATION_COVER(this.id, this.coverImage), format, size);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The url of this application's icon.
|
|
138
|
+
* @param format The format the url should be.
|
|
139
|
+
* @param size The dimensions of the image.
|
|
140
|
+
*/
|
|
141
|
+
iconURL(format, size) {
|
|
142
|
+
return this.icon === null ? null : this.client.util.formatImage(Routes.APPLICATION_ICON(this.id, this.icon), format, size);
|
|
143
|
+
}
|
|
144
|
+
toJSON() {
|
|
145
|
+
return {
|
|
146
|
+
...super.toJSON(),
|
|
147
|
+
approximateGuildCount: this.approximateGuildCount,
|
|
148
|
+
botPublic: this.botPublic,
|
|
149
|
+
botRequireCodeGrant: this.botRequireCodeGrant,
|
|
150
|
+
coverImage: this.coverImage,
|
|
151
|
+
customInstallURL: this.customInstallURL,
|
|
152
|
+
description: this.description,
|
|
153
|
+
discoverabilityState: this.discoverabilityState,
|
|
154
|
+
discoveryEligibilityFlags: this.discoveryEligibilityFlags,
|
|
155
|
+
explicitContentFilter: this.explicitContentFilter,
|
|
156
|
+
guild: this.guild?.toJSON() ?? null,
|
|
157
|
+
guildID: this.guildID,
|
|
158
|
+
hook: this.hook,
|
|
159
|
+
icon: this.icon,
|
|
160
|
+
installParams: this.installParams,
|
|
161
|
+
integrationTypes: this.integrationTypes,
|
|
162
|
+
integrationTypesConfig: this.integrationTypesConfig,
|
|
163
|
+
interactionsEndpointURL: this.interactionsEndpointURL,
|
|
164
|
+
interactionsEventTypes: this.interactionsEventTypes,
|
|
165
|
+
interactionsVersion: this.interactionsVersion,
|
|
166
|
+
isMonetized: this.isMonetized,
|
|
167
|
+
monetizationEligibilityFlags: this.monetizationEligibilityFlags,
|
|
168
|
+
monetizationState: this.monetizationState,
|
|
169
|
+
name: this.name,
|
|
170
|
+
owner: this.owner?.toJSON() ?? null,
|
|
171
|
+
primarySKUID: this.primarySKUID,
|
|
172
|
+
privacyPolicyURL: this.privacyPolicyURL,
|
|
173
|
+
redirectURIs: this.redirectURIs,
|
|
174
|
+
roleConnectionsVerificationURL: this.roleConnectionsVerificationURL,
|
|
175
|
+
rpcApplicationState: this.rpcApplicationState,
|
|
176
|
+
rpcOrigins: this.rpcOrigins,
|
|
177
|
+
slug: this.slug,
|
|
178
|
+
storeApplicationState: this.storeApplicationState,
|
|
179
|
+
tags: this.tags,
|
|
180
|
+
team: this.team?.toJSON() ?? null,
|
|
181
|
+
termsOfServiceURL: this.termsOfServiceURL,
|
|
182
|
+
type: this.type,
|
|
183
|
+
verificationState: this.verificationState,
|
|
184
|
+
verifyKey: this.verifyKey
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.default = Application;
|
|
189
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXBwbGljYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWIvc3RydWN0dXJlcy9BcHBsaWNhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQkFBMEI7QUFDMUIsb0ZBQW9EO0FBQ3BELHNFQUFzQztBQUN0QywwREFBMEI7QUFDMUIsMERBQTBCO0FBYTFCLCtEQUF5QztBQUl6QyxpQ0FBaUM7QUFDakMsTUFBcUIsV0FBWSxTQUFRLDJCQUFpQjtJQUN0RCw4REFBOEQ7SUFDOUQscUJBQXFCLENBQVM7SUFDOUIsMkNBQTJDO0lBQzNDLFNBQVMsQ0FBVztJQUNwQixvREFBb0Q7SUFDcEQsbUJBQW1CLENBQVc7SUFDOUIsd0VBQXdFO0lBQ3hFLFVBQVUsQ0FBZ0I7SUFDMUIsb0VBQW9FO0lBQ3BFLGdCQUFnQixDQUFVO0lBQzFCLDBDQUEwQztJQUMxQyxXQUFXLENBQVM7SUFDcEIsdURBQXVEO0lBQ3ZELG9CQUFvQixDQUFtQztJQUN2RCx5SEFBeUg7SUFDekgseUJBQXlCLENBQVU7SUFDbkMsd0RBQXdEO0lBQ3hELHFCQUFxQixDQUF5QztJQUM5RCxrTUFBa007SUFDbE0sS0FBSyxDQUFvQjtJQUN6QixzR0FBc0c7SUFDdEcsT0FBTyxDQU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xFQUFFLElBQUksSUFBSTtZQUMzRCxpQkFBaUIsRUFBZSxJQUFJLENBQUMsaUJBQWlCO1lBQ3RELElBQUksRUFBNEIsSUFBSSxDQUFDLElBQUk7WUFDekMsaUJBQWlCLEVBQWUsSUFBSSxDQUFDLGlCQUFpQjtZQUN0RCxTQUFTLEVBQXVCLElBQUksQ0FBQyxTQUFTO1NBQ2pELENBQUM7SUFDTixDQUFDO0NBQ0o7QUFuTEQsOEJBbUxDIn0=
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** @module ApplicationCommand */
|
|
2
|
+
import Base from "./Base";
|
|
3
|
+
import Permission from "./Permission";
|
|
4
|
+
import type Guild from "./Guild";
|
|
5
|
+
import type ClientApplication from "./ClientApplication";
|
|
6
|
+
import type Client from "../Client";
|
|
7
|
+
import { ApplicationCommandTypes, type InteractionContextTypes, type ApplicationIntegrationTypes } from "../Constants";
|
|
8
|
+
import type { ApplicationCommandOptionConversion, ApplicationCommandOptions, EditApplicationCommandPermissionsOptions, LocaleMap, RawApplicationCommand, RESTGuildApplicationCommandPermissions, TypeToEdit } from "../types/applications";
|
|
9
|
+
import type { JSONApplicationCommand } from "../types/json";
|
|
10
|
+
/** Represents an application command. */
|
|
11
|
+
export default class ApplicationCommand<T extends ApplicationCommandTypes = ApplicationCommandTypes> extends Base {
|
|
12
|
+
private _cachedGuild?;
|
|
13
|
+
/** The application this command is for. */
|
|
14
|
+
application?: ClientApplication;
|
|
15
|
+
/** The ID of application this command is for. */
|
|
16
|
+
applicationID: string;
|
|
17
|
+
/** The contexts in which this application command can be used in. */
|
|
18
|
+
contexts: Array<InteractionContextTypes>;
|
|
19
|
+
/** The default permissions for this command. */
|
|
20
|
+
defaultMemberPermissions: Permission | null;
|
|
21
|
+
/** The description of this command. Empty string for non `CHAT_INPUT` commands. */
|
|
22
|
+
description: T extends ApplicationCommandTypes.CHAT_INPUT ? string : "";
|
|
23
|
+
/** A dictionary of [locales](https://discord.com/developers/docs/reference#locales) to localized descriptions. */
|
|
24
|
+
descriptionLocalizations?: LocaleMap | null;
|
|
25
|
+
/** The description of this application command in the requested locale. */
|
|
26
|
+
descriptionLocalized?: string;
|
|
27
|
+
/** If this command can be used in direct messages (global commands only). */
|
|
28
|
+
dmPermission?: boolean;
|
|
29
|
+
/** The id of the guild this command is in (guild commands only). */
|
|
30
|
+
guildID: string | null;
|
|
31
|
+
/** The installation contexts in which this command is available. */
|
|
32
|
+
integrationTypes: Array<ApplicationIntegrationTypes>;
|
|
33
|
+
/** The name of this command. */
|
|
34
|
+
name: string;
|
|
35
|
+
/** A dictionary of [locales](https://discord.com/developers/docs/reference#locales) to localized names. */
|
|
36
|
+
nameLocalizations?: LocaleMap | null;
|
|
37
|
+
/** The description of this application command in the requested locale. */
|
|
38
|
+
nameLocalized?: string;
|
|
39
|
+
/** Whether the command is age restricted. */
|
|
40
|
+
nsfw?: boolean;
|
|
41
|
+
/** The options on this command. Only valid for `CHAT_INPUT`. */
|
|
42
|
+
options?: Array<ApplicationCommandOptions>;
|
|
43
|
+
/** The [type](https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types) of this command. */
|
|
44
|
+
type: T;
|
|
45
|
+
/** Autoincrementing version identifier updated during substantial record changes. */
|
|
46
|
+
version: string;
|
|
47
|
+
constructor(data: RawApplicationCommand, client: Client);
|
|
48
|
+
/** The guild this command is in (guild commands only). This will throw an error if the guild is not cached. */
|
|
49
|
+
get guild(): Guild | null;
|
|
50
|
+
/**
|
|
51
|
+
* Delete this command.
|
|
52
|
+
*/
|
|
53
|
+
delete(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Edit this command.
|
|
56
|
+
* @param options The options for editing the command.
|
|
57
|
+
*/
|
|
58
|
+
edit(options: TypeToEdit<T>): Promise<ApplicationCommandOptionConversion<TypeToEdit<T>>>;
|
|
59
|
+
/**
|
|
60
|
+
* Edit this command's permissions (guild commands only). This requires a bearer token with the `applications.commands.permissions.update` scope.
|
|
61
|
+
* @param options The options for editing the permissions.
|
|
62
|
+
*/
|
|
63
|
+
editGuildCommandPermissions(options: EditApplicationCommandPermissionsOptions): Promise<RESTGuildApplicationCommandPermissions>;
|
|
64
|
+
/**
|
|
65
|
+
* Get this command's permissions (guild commands only).
|
|
66
|
+
*/
|
|
67
|
+
getGuildPermission(): Promise<RESTGuildApplicationCommandPermissions>;
|
|
68
|
+
/**
|
|
69
|
+
* Get a mention for this command.
|
|
70
|
+
* @param sub The subcommand group and/or subcommand to include (["subcommand"] or ["subcommand-group", "subcommand"]).
|
|
71
|
+
*/
|
|
72
|
+
mention(sub?: [subcommand: string] | [subcommandGroup: string, subcommand: string]): string;
|
|
73
|
+
toJSON(): JSONApplicationCommand;
|
|
74
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module ApplicationCommand */
|
|
5
|
+
const Base_1 = tslib_1.__importDefault(require("./Base"));
|
|
6
|
+
const Permission_1 = tslib_1.__importDefault(require("./Permission"));
|
|
7
|
+
const Constants_1 = require("../Constants");
|
|
8
|
+
const Errors_1 = require("../util/Errors");
|
|
9
|
+
/** Represents an application command. */
|
|
10
|
+
class ApplicationCommand extends Base_1.default {
|
|
11
|
+
_cachedGuild;
|
|
12
|
+
/** The application this command is for. */
|
|
13
|
+
application;
|
|
14
|
+
/** The ID of application this command is for. */
|
|
15
|
+
applicationID;
|
|
16
|
+
/** The contexts in which this application command can be used in. */
|
|
17
|
+
contexts;
|
|
18
|
+
/** The default permissions for this command. */
|
|
19
|
+
defaultMemberPermissions;
|
|
20
|
+
/** The description of this command. Empty string for non `CHAT_INPUT` commands. */
|
|
21
|
+
description;
|
|
22
|
+
/** A dictionary of [locales](https://discord.com/developers/docs/reference#locales) to localized descriptions. */
|
|
23
|
+
descriptionLocalizations;
|
|
24
|
+
/** The description of this application command in the requested locale. */
|
|
25
|
+
descriptionLocalized;
|
|
26
|
+
/** If this command can be used in direct messages (global commands only). */
|
|
27
|
+
dmPermission;
|
|
28
|
+
/** The id of the guild this command is in (guild commands only). */
|
|
29
|
+
guildID;
|
|
30
|
+
/** The installation contexts in which this command is available. */
|
|
31
|
+
integrationTypes;
|
|
32
|
+
/** The name of this command. */
|
|
33
|
+
name;
|
|
34
|
+
/** A dictionary of [locales](https://discord.com/developers/docs/reference#locales) to localized names. */
|
|
35
|
+
nameLocalizations;
|
|
36
|
+
/** The description of this application command in the requested locale. */
|
|
37
|
+
nameLocalized;
|
|
38
|
+
/** Whether the command is age restricted. */
|
|
39
|
+
nsfw;
|
|
40
|
+
/** The options on this command. Only valid for `CHAT_INPUT`. */
|
|
41
|
+
options;
|
|
42
|
+
/** The [type](https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types) of this command. */
|
|
43
|
+
type;
|
|
44
|
+
/** Autoincrementing version identifier updated during substantial record changes. */
|
|
45
|
+
version;
|
|
46
|
+
constructor(data, client) {
|
|
47
|
+
super(data.id, client);
|
|
48
|
+
this.application = client["_application"] && client.application.id === data.application_id ? client.application : undefined;
|
|
49
|
+
this.applicationID = data.application_id;
|
|
50
|
+
this.contexts = data.contexts;
|
|
51
|
+
this.defaultMemberPermissions = data.default_member_permissions ? new Permission_1.default(data.default_member_permissions) : null;
|
|
52
|
+
this.description = data.description;
|
|
53
|
+
this.descriptionLocalizations = data.description_localizations;
|
|
54
|
+
this.descriptionLocalized = data.description_localized;
|
|
55
|
+
this.dmPermission = data.dm_permission;
|
|
56
|
+
this.guildID = data.guild_id ?? null;
|
|
57
|
+
this.integrationTypes = data.integration_types;
|
|
58
|
+
this.name = data.name;
|
|
59
|
+
this.nameLocalizations = data.name_localizations;
|
|
60
|
+
this.nameLocalized = data.name_localized;
|
|
61
|
+
this.nsfw = data.nsfw;
|
|
62
|
+
this.options = data.options?.map(o => client.util.optionToParsed(o));
|
|
63
|
+
this.type = (data.type ?? Constants_1.ApplicationCommandTypes.CHAT_INPUT);
|
|
64
|
+
this.version = data.version;
|
|
65
|
+
}
|
|
66
|
+
/** The guild this command is in (guild commands only). This will throw an error if the guild is not cached. */
|
|
67
|
+
get guild() {
|
|
68
|
+
if (this.guildID !== null && this._cachedGuild !== null) {
|
|
69
|
+
this._cachedGuild ??= this.client.guilds.get(this.guildID);
|
|
70
|
+
if (!this._cachedGuild) {
|
|
71
|
+
throw new Errors_1.UncachedError(this, "guild", "GUILDS", this.client);
|
|
72
|
+
}
|
|
73
|
+
return this._cachedGuild;
|
|
74
|
+
}
|
|
75
|
+
return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Delete this command.
|
|
79
|
+
*/
|
|
80
|
+
async delete() {
|
|
81
|
+
return this.guildID ? this.client.rest.applications.deleteGuildCommand(this.applicationID, this.guildID, this.id) : this.client.rest.applications.deleteGlobalCommand(this.applicationID, this.id);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Edit this command.
|
|
85
|
+
* @param options The options for editing the command.
|
|
86
|
+
*/
|
|
87
|
+
async edit(options) {
|
|
88
|
+
return this.guildID ? this.client.rest.applications.editGuildCommand(this.applicationID, this.guildID, this.id, options) : this.client.rest.applications.editGlobalCommand(this.applicationID, this.id, options);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Edit this command's permissions (guild commands only). This requires a bearer token with the `applications.commands.permissions.update` scope.
|
|
92
|
+
* @param options The options for editing the permissions.
|
|
93
|
+
*/
|
|
94
|
+
async editGuildCommandPermissions(options) {
|
|
95
|
+
if (!this.guildID) {
|
|
96
|
+
throw new TypeError("editGuildCommandPermissions cannot be used on global commands.");
|
|
97
|
+
}
|
|
98
|
+
return this.client.rest.applications.editGuildCommandPermissions(this.applicationID, this.guildID, this.id, options);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get this command's permissions (guild commands only).
|
|
102
|
+
*/
|
|
103
|
+
async getGuildPermission() {
|
|
104
|
+
if (!this.guildID) {
|
|
105
|
+
throw new TypeError("getGuildPermission cannot be used on global commands.");
|
|
106
|
+
}
|
|
107
|
+
return this.client.rest.applications.getGuildPermission(this.applicationID, this.guildID, this.id);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get a mention for this command.
|
|
111
|
+
* @param sub The subcommand group and/or subcommand to include (["subcommand"] or ["subcommand-group", "subcommand"]).
|
|
112
|
+
*/
|
|
113
|
+
mention(sub) {
|
|
114
|
+
let text = `${this.name}`;
|
|
115
|
+
if (sub?.length) {
|
|
116
|
+
text += ` ${sub.slice(0, 2).join(" ")}`;
|
|
117
|
+
}
|
|
118
|
+
return `</${text}:${this.id}>`;
|
|
119
|
+
}
|
|
120
|
+
toJSON() {
|
|
121
|
+
return {
|
|
122
|
+
...super.toJSON(),
|
|
123
|
+
applicationID: this.applicationID,
|
|
124
|
+
contexts: this.contexts,
|
|
125
|
+
defaultMemberPermissions: this.defaultMemberPermissions?.toJSON(),
|
|
126
|
+
description: this.description,
|
|
127
|
+
descriptionLocalizations: this.descriptionLocalizations,
|
|
128
|
+
dmPermission: this.dmPermission,
|
|
129
|
+
guildID: this.guildID ?? undefined,
|
|
130
|
+
integrationTypes: this.integrationTypes,
|
|
131
|
+
name: this.name,
|
|
132
|
+
nameLocalizations: this.nameLocalizations,
|
|
133
|
+
nsfw: this.nsfw,
|
|
134
|
+
options: this.options,
|
|
135
|
+
type: this.type,
|
|
136
|
+
version: this.version
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.default = ApplicationCommand;
|
|
141
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXBwbGljYXRpb25Db21tYW5kLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL3N0cnVjdHVyZXMvQXBwbGljYXRpb25Db21tYW5kLnRzIl0sIm5hbWVzIjpbXSwibW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d0IsRUFBRSxJQUFJLENBQUMsd0JBQXdCLEVBQUUsTUFBTSxFQUFFO1lBQ2pFLFdBQVcsRUFBZSxJQUFJLENBQUMsV0FBVztZQUMxQyx3QkFBd0IsRUFBRSxJQUFJLENBQUMsd0JBQXdCO1lBQ3ZELFlBQVksRUFBYyxJQUFJLENBQUMsWUFBWTtZQUMzQyxPQUFPLEVBQW1CLElBQUksQ0FBQyxPQUFPLElBQUksU0FBUztZQUNuRCxnQkFBZ0IsRUFBVSxJQUFJLENBQUMsZ0JBQWdCO1lBQy9DLElBQUksRUFBc0IsSUFBSSxDQUFDLElBQUk7WUFDbkMsaUJBQWlCLEVBQVMsSUFBSSxDQUFDLGlCQUFpQjtZQUNoRCxJQUFJLEVBQXNCLElBQUksQ0FBQyxJQUFJO1lBQ25DLE9BQU8sRUFBbUIsSUFBSSxDQUFDLE9BQU87WUFDdEMsSUFBSSxFQUFzQixJQUFJLENBQUMsSUFBSTtZQUNuQyxPQUFPLEVBQW1CLElBQUksQ0FBQyxPQUFPO1NBQ3pDLENBQUM7SUFDTixDQUFDO0NBQ0o7QUExSUQscUNBMElDIn0=
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** @module Attachment */
|
|
2
|
+
import Base from "./Base";
|
|
3
|
+
import type Client from "../Client";
|
|
4
|
+
import type { RawAttachment } from "../types/channels";
|
|
5
|
+
import type { JSONAttachment } from "../types/json";
|
|
6
|
+
/** Represents a file attachment. */
|
|
7
|
+
export default class Attachment extends Base {
|
|
8
|
+
/** The mime type of this attachment. */
|
|
9
|
+
contentType?: string;
|
|
10
|
+
/** The description of this attachment. */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** The duration of the attached audio file, if voice message. */
|
|
13
|
+
durationSecs?: number;
|
|
14
|
+
/** If this attachment is ephemeral. Ephemeral attachments will be removed after a set period of time. */
|
|
15
|
+
ephemeral?: boolean;
|
|
16
|
+
/** The filename of this attachment. */
|
|
17
|
+
filename: string;
|
|
18
|
+
/** The {@link Constants~AttachmentFlags | Attachment Flags } of this image. */
|
|
19
|
+
flags: number;
|
|
20
|
+
/** The height of this attachment, if an image. */
|
|
21
|
+
height?: number;
|
|
22
|
+
/** A proxied url of this attachment. */
|
|
23
|
+
proxyURL: string;
|
|
24
|
+
/** The size of this attachment. */
|
|
25
|
+
size: number;
|
|
26
|
+
/** The source url of this attachment. */
|
|
27
|
+
url: string;
|
|
28
|
+
/** Base64 encoded bytearray representing a sampled waveform for voice messages. */
|
|
29
|
+
waveform?: string | null;
|
|
30
|
+
/** The width of this attachment, if an image. */
|
|
31
|
+
width?: number;
|
|
32
|
+
constructor(data: RawAttachment, client: Client);
|
|
33
|
+
toJSON(): JSONAttachment;
|
|
34
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module Attachment */
|
|
5
|
+
const Base_1 = tslib_1.__importDefault(require("./Base"));
|
|
6
|
+
/** Represents a file attachment. */
|
|
7
|
+
class Attachment extends Base_1.default {
|
|
8
|
+
/** The mime type of this attachment. */
|
|
9
|
+
contentType;
|
|
10
|
+
/** The description of this attachment. */
|
|
11
|
+
description;
|
|
12
|
+
/** The duration of the attached audio file, if voice message. */
|
|
13
|
+
durationSecs;
|
|
14
|
+
/** If this attachment is ephemeral. Ephemeral attachments will be removed after a set period of time. */
|
|
15
|
+
ephemeral;
|
|
16
|
+
/** The filename of this attachment. */
|
|
17
|
+
filename;
|
|
18
|
+
/** The {@link Constants~AttachmentFlags | Attachment Flags } of this image. */
|
|
19
|
+
flags;
|
|
20
|
+
/** The height of this attachment, if an image. */
|
|
21
|
+
height;
|
|
22
|
+
/** A proxied url of this attachment. */
|
|
23
|
+
proxyURL;
|
|
24
|
+
/** The size of this attachment. */
|
|
25
|
+
size;
|
|
26
|
+
/** The source url of this attachment. */
|
|
27
|
+
url;
|
|
28
|
+
/** Base64 encoded bytearray representing a sampled waveform for voice messages. */
|
|
29
|
+
waveform;
|
|
30
|
+
/** The width of this attachment, if an image. */
|
|
31
|
+
width;
|
|
32
|
+
constructor(data, client) {
|
|
33
|
+
super(data.id, client);
|
|
34
|
+
this.contentType = data.content_type;
|
|
35
|
+
this.description = data.description;
|
|
36
|
+
this.durationSecs = data.duration_secs;
|
|
37
|
+
this.ephemeral = data.ephemeral;
|
|
38
|
+
this.filename = data.filename;
|
|
39
|
+
this.flags = data.flags ?? 0;
|
|
40
|
+
this.height = data.height;
|
|
41
|
+
this.proxyURL = data.proxy_url;
|
|
42
|
+
this.size = data.size;
|
|
43
|
+
this.url = data.url;
|
|
44
|
+
this.waveform = data.waveform;
|
|
45
|
+
this.width = data.width;
|
|
46
|
+
}
|
|
47
|
+
toJSON() {
|
|
48
|
+
return {
|
|
49
|
+
...super.toJSON(),
|
|
50
|
+
contentType: this.contentType,
|
|
51
|
+
description: this.description,
|
|
52
|
+
ephemeral: this.ephemeral,
|
|
53
|
+
filename: this.filename,
|
|
54
|
+
flags: this.flags,
|
|
55
|
+
height: this.height,
|
|
56
|
+
proxyURL: this.proxyURL,
|
|
57
|
+
size: this.size,
|
|
58
|
+
url: this.url,
|
|
59
|
+
width: this.width
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.default = Attachment;
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXR0YWNobWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9zdHJ1Y3R1cmVzL0F0dGFjaG1lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEseUJBQXlCO0FBQ3pCLDBEQUEwQjtBQUsxQixvQ0FBb0M7QUFDcEMsTUFBcUIsVUFBVyxTQUFRLGNBQUk7SUFDeEMsd0NBQXdDO0lBQ3hDLFdBQVcsQ0FBVTtJQ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BQUksR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDO1FBQ3RCLElBQUksQ0FBQyxHQUFHLEdBQUcsSUFBSSxDQUFDLEdBQUcsQ0FBQztRQUNwQixJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQyxRQUFRLENBQUM7UUFDOUIsSUFBSSxDQUFDLEtBQUssR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDO0lBQzVCLENBQUM7SUFFUSxNQUFNO1FBQ1gsT0FBTztZQUNILEdBQUcsS0FBSyxDQUFDLE1BQU0sRUFBRTtZQUNqQixXQUFXLEVBQUUsSUFBSSxDQUFDLFdBQVc7WUFDN0IsV0FBVyxFQUFFLElBQUksQ0FBQyxXQUFXO1lBQzdCLFNBQVMsRUFBSSxJQUFJLENBQUMsU0FBUztZQUMzQixRQUFRLEVBQUssSUFBSSxDQUFDLFFBQVE7WUFDMUIsS0FBSyxFQUFRLElBQUksQ0FBQyxLQUFLO1lBQ3ZCLE1BQU0sRUFBTyxJQUFJLENBQUMsTUFBTTtZQUN4QixRQUFRLEVBQUssSUFBSSxDQUFDLFFBQVE7WUFDMUIsSUFBSSxFQUFTLElBQUksQ0FBQyxJQUFJO1lBQ3RCLEdBQUcsRUFBVSxJQUFJLENBQUMsR0FBRztZQUNyQixLQUFLLEVBQVEsSUFBSSxDQUFDLEtBQUs7U0FDMUIsQ0FBQztJQUNOLENBQUM7Q0FDSjtBQXhERCw2QkF3REMifQ==
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @module AuditLogEntry */
|
|
2
|
+
import Base from "./Base";
|
|
3
|
+
import type User from "./User";
|
|
4
|
+
import type { AuditLogActionTypes } from "../Constants";
|
|
5
|
+
import type { AuditLogChange, AuditLogEntryOptions, RawAuditLogEntry } from "../types/audit-log";
|
|
6
|
+
import type Client from "../Client";
|
|
7
|
+
/** Represents a guild audit log entry. */
|
|
8
|
+
export default class AuditLogEntry extends Base {
|
|
9
|
+
private _cachedUser?;
|
|
10
|
+
/** The [type](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events) of this action. */
|
|
11
|
+
actionType: AuditLogActionTypes;
|
|
12
|
+
/** See the [audit log documentation](https://discord.com/developers/docs/resources/audit-log#audit-log-change-object) for more information. */
|
|
13
|
+
changes?: Array<AuditLogChange>;
|
|
14
|
+
/** Additional info for specific event types */
|
|
15
|
+
options?: AuditLogEntryOptions;
|
|
16
|
+
/** The reason for the change. */
|
|
17
|
+
reason?: string;
|
|
18
|
+
/** The ID of what was targeted (webhook, user, role, etc). */
|
|
19
|
+
targetID: string | null;
|
|
20
|
+
/** The ID of the user or application that made the changes. */
|
|
21
|
+
userID: string | null;
|
|
22
|
+
constructor(data: RawAuditLogEntry, client: Client);
|
|
23
|
+
/** The user or application that made the changes. */
|
|
24
|
+
get user(): User | undefined | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module AuditLogEntry */
|
|
5
|
+
const Base_1 = tslib_1.__importDefault(require("./Base"));
|
|
6
|
+
/** Represents a guild audit log entry. */
|
|
7
|
+
class AuditLogEntry extends Base_1.default {
|
|
8
|
+
_cachedUser;
|
|
9
|
+
/** The [type](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events) of this action. */
|
|
10
|
+
actionType;
|
|
11
|
+
/** See the [audit log documentation](https://discord.com/developers/docs/resources/audit-log#audit-log-change-object) for more information. */
|
|
12
|
+
changes;
|
|
13
|
+
/** Additional info for specific event types */
|
|
14
|
+
options;
|
|
15
|
+
/** The reason for the change. */
|
|
16
|
+
reason;
|
|
17
|
+
/** The ID of what was targeted (webhook, user, role, etc). */
|
|
18
|
+
targetID;
|
|
19
|
+
/** The ID of the user or application that made the changes. */
|
|
20
|
+
userID;
|
|
21
|
+
constructor(data, client) {
|
|
22
|
+
super(data.id, client);
|
|
23
|
+
this.actionType = data.action_type;
|
|
24
|
+
this.changes = data.changes;
|
|
25
|
+
this.options = {
|
|
26
|
+
applicationID: data.options?.application_id,
|
|
27
|
+
autoModerationRuleName: data.options?.auto_moderation_rule_name,
|
|
28
|
+
autoModerationRuleTriggerType: data.options?.auto_moderation_rule_trigger_type,
|
|
29
|
+
channelID: data.options?.channel_id,
|
|
30
|
+
count: data.options?.count,
|
|
31
|
+
deleteMemberDays: data.options?.delete_member_days,
|
|
32
|
+
id: data.options?.id,
|
|
33
|
+
integrationType: data.options?.integration_type,
|
|
34
|
+
membersRemoved: data.options?.members_removed,
|
|
35
|
+
messageID: data.options?.message_id,
|
|
36
|
+
roleName: data.options?.role_name,
|
|
37
|
+
status: data.options?.status,
|
|
38
|
+
type: data.options?.type
|
|
39
|
+
};
|
|
40
|
+
this.reason = data.reason;
|
|
41
|
+
this.targetID = data.target_id;
|
|
42
|
+
this.userID = data.user_id;
|
|
43
|
+
}
|
|
44
|
+
/** The user or application that made the changes. */
|
|
45
|
+
get user() {
|
|
46
|
+
if (this.userID !== null && this._cachedUser !== null) {
|
|
47
|
+
return this._cachedUser ?? (this._cachedUser = this.client.users.get(this.userID));
|
|
48
|
+
}
|
|
49
|
+
return this._cachedUser === null ? this._cachedUser : (this._cachedUser = null);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = AuditLogEntry;
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXVkaXRMb2dFbnRyeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9zdHJ1Y3R1cmVzL0F1ZGl0TG9nRW50cnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsNEJBQTRCO0FBQzVCLDBEQUEwQjtBQU0xQiwwQ0FBMEM7QUFDMUMsTUFBcUIsYUFBYyxTQUFRLGNBQUk7SUFDbkMsV0F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