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,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module ModalSubmitInteraction */
|
|
5
|
+
const Interaction_1 = tslib_1.__importDefault(require("./Interaction"));
|
|
6
|
+
const Permission_1 = tslib_1.__importDefault(require("./Permission"));
|
|
7
|
+
const Message_1 = tslib_1.__importDefault(require("./Message"));
|
|
8
|
+
const GuildChannel_1 = tslib_1.__importDefault(require("./GuildChannel"));
|
|
9
|
+
const Constants_1 = require("../Constants");
|
|
10
|
+
const Errors_1 = require("../util/Errors");
|
|
11
|
+
const MessageInteractionResponse_1 = tslib_1.__importDefault(require("../util/interactions/MessageInteractionResponse"));
|
|
12
|
+
const ModalSubmitInteractionComponentsWrapper_1 = tslib_1.__importDefault(require("../util/interactions/ModalSubmitInteractionComponentsWrapper"));
|
|
13
|
+
/** Represents a modal submit interaction. */
|
|
14
|
+
class ModalSubmitInteraction extends Interaction_1.default {
|
|
15
|
+
_cachedChannel;
|
|
16
|
+
_cachedGuild;
|
|
17
|
+
/** The permissions the bot has in the channel this interaction was sent from. If in a dm/group dm, this will contain `ATTACH_FILES`, `EMBED_LINKS`, and `MENTION_EVERYONE`. In addition, `USE_EXTERNAL_EMOJIS` will be included for DMs with the app's bot user. */
|
|
18
|
+
appPermissions;
|
|
19
|
+
/** Details about the authorizing user or server for the installation(s) relevant to the interaction. See [Discord's docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for more information. */
|
|
20
|
+
authorizingIntegrationOwners;
|
|
21
|
+
/** The ID of the channel this interaction was sent from. */
|
|
22
|
+
channelID;
|
|
23
|
+
/** The context this interaction was sent from. */
|
|
24
|
+
context;
|
|
25
|
+
/** The data associated with the interaction. */
|
|
26
|
+
data;
|
|
27
|
+
/** The entitlements for the user that created this interaction, and the guild it was created in. */
|
|
28
|
+
entitlements;
|
|
29
|
+
/** The id of the guild this interaction was sent from, if applicable. */
|
|
30
|
+
guildID;
|
|
31
|
+
/** The preferred [locale](https://discord.com/developers/docs/reference#locales) of the guild this interaction was sent from, if applicable. */
|
|
32
|
+
guildLocale;
|
|
33
|
+
/** The partial guild this interaction was sent from, if applicable. */
|
|
34
|
+
guildPartial;
|
|
35
|
+
/** The [locale](https://discord.com/developers/docs/reference#locales) of the invoking user. */
|
|
36
|
+
locale;
|
|
37
|
+
/** The member associated with the invoking user, if this interaction is sent from a guild. */
|
|
38
|
+
member;
|
|
39
|
+
/** The permissions of the member associated with the invoking user, if this interaction is sent from a guild. */
|
|
40
|
+
memberPermissions;
|
|
41
|
+
/** The message this interaction is from, if the modal was triggered from a component interaction. */
|
|
42
|
+
message;
|
|
43
|
+
/** The user that invoked this interaction. */
|
|
44
|
+
user;
|
|
45
|
+
constructor(data, client) {
|
|
46
|
+
super(data, client);
|
|
47
|
+
if (data.message !== undefined && data.guild_id !== undefined) {
|
|
48
|
+
data.message.guild_id = data.guild_id;
|
|
49
|
+
}
|
|
50
|
+
this.appPermissions = new Permission_1.default(data.app_permissions ?? "0");
|
|
51
|
+
this.authorizingIntegrationOwners = data.authorizing_integration_owners;
|
|
52
|
+
this.channelID = data.channel_id;
|
|
53
|
+
this.context = data.context;
|
|
54
|
+
this.data = {
|
|
55
|
+
components: new ModalSubmitInteractionComponentsWrapper_1.default(client.util.modalSubmitComponentsToParsed(data.data.components)),
|
|
56
|
+
customID: data.data.custom_id
|
|
57
|
+
};
|
|
58
|
+
this.entitlements = data.entitlements?.map(entitlement => client.util.updateEntitlement(entitlement)) ?? [];
|
|
59
|
+
this.guildID = (data.guild_id ?? null);
|
|
60
|
+
this.guildLocale = data.guild_locale;
|
|
61
|
+
this.guildPartial = data.guild;
|
|
62
|
+
this.locale = data.locale;
|
|
63
|
+
this.member = (data.member === undefined ? null : this.client.util.updateMember(data.guild_id, data.member.user.id, data.member));
|
|
64
|
+
this.memberPermissions = (data.member === undefined ? null : new Permission_1.default(data.member.permissions));
|
|
65
|
+
if (data.message !== undefined) {
|
|
66
|
+
this.message = (this.channel && "messages" in this.channel && this.channel.messages.update(data.message)) || new Message_1.default(data.message, client);
|
|
67
|
+
}
|
|
68
|
+
this.user = client.users.update(data.user ?? data.member.user);
|
|
69
|
+
}
|
|
70
|
+
/** The channel this interaction was sent from. */
|
|
71
|
+
get channel() {
|
|
72
|
+
return this._cachedChannel ??= this.client.getChannel(this.channelID);
|
|
73
|
+
}
|
|
74
|
+
/** The guild this interaction was sent from, if applicable. This will throw an error if the guild is not cached. */
|
|
75
|
+
get guild() {
|
|
76
|
+
if (this.guildID !== null && this._cachedGuild !== null) {
|
|
77
|
+
this._cachedGuild ??= this.client.guilds.get(this.guildID);
|
|
78
|
+
if (!this._cachedGuild) {
|
|
79
|
+
if (this.client.options.restMode) {
|
|
80
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
81
|
+
}
|
|
82
|
+
if (!this.client.shards.connected) {
|
|
83
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
84
|
+
}
|
|
85
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
86
|
+
}
|
|
87
|
+
return this._cachedGuild;
|
|
88
|
+
}
|
|
89
|
+
return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a followup message. Note that the returned class is not a message. The message is located in the property {@link MessageInteractionResponse#message | message}.
|
|
93
|
+
* @param options The options for creating the followup message.
|
|
94
|
+
*/
|
|
95
|
+
async createFollowup(options) {
|
|
96
|
+
const message = await this.client.rest.interactions.createFollowupMessage(this.applicationID, this.token, options);
|
|
97
|
+
return new MessageInteractionResponse_1.default(this, message, "followup");
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create a message through this interaction. This is an initial response, and more than one initial response cannot be used. Use {@link ModalSubmitInteraction#createFollowup | createFollowup}.
|
|
101
|
+
* Note that the returned class is not a message. This initial response does not return a message. You will need to call {@link MessageInteractionResponse#getMessage | MessageInteractionResponse#getMessage} on the returned class,
|
|
102
|
+
* or {@link ModalSubmitInteraction#getOriginal | getOriginal}.
|
|
103
|
+
* @note You cannot attach files in an initial response. Defer the interaction, then use {@link ModalSubmitInteraction#createFollowup | createFollowup}.
|
|
104
|
+
* @param options The options for the message.
|
|
105
|
+
*/
|
|
106
|
+
async createMessage(options) {
|
|
107
|
+
if (this.acknowledged) {
|
|
108
|
+
throw new TypeError("Interactions cannot have more than one initial response.");
|
|
109
|
+
}
|
|
110
|
+
if ("files" in options && options.files.length !== 0) {
|
|
111
|
+
this.client.emit("warn", "You cannot attach files in an initial response. Defer the interaction, then use createFollowup.");
|
|
112
|
+
}
|
|
113
|
+
this.acknowledged = true;
|
|
114
|
+
await this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.CHANNEL_MESSAGE_WITH_SOURCE, data: options });
|
|
115
|
+
return new MessageInteractionResponse_1.default(this, null, "initial");
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Defer this interaction. This is an initial response, and more than one initial response cannot be used.
|
|
119
|
+
* @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with.
|
|
120
|
+
*/
|
|
121
|
+
async defer(flags) {
|
|
122
|
+
if (this.acknowledged) {
|
|
123
|
+
throw new TypeError("Interactions cannot have more than one initial response.");
|
|
124
|
+
}
|
|
125
|
+
this.acknowledged = true;
|
|
126
|
+
return this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE, data: { flags } });
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Defer this interaction with a `DEFERRED_UPDATE_MESSAGE` response. This is an initial response, and more than one initial response cannot be used.
|
|
130
|
+
* @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with.
|
|
131
|
+
*/
|
|
132
|
+
async deferUpdate(flags) {
|
|
133
|
+
if (this.acknowledged) {
|
|
134
|
+
throw new TypeError("Interactions cannot have more than one initial response.");
|
|
135
|
+
}
|
|
136
|
+
this.acknowledged = true;
|
|
137
|
+
return this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.DEFERRED_UPDATE_MESSAGE, data: { flags } });
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Delete a follow-up message.
|
|
141
|
+
* @param messageID The ID of the message.
|
|
142
|
+
*/
|
|
143
|
+
async deleteFollowup(messageID) {
|
|
144
|
+
return this.client.rest.interactions.deleteFollowupMessage(this.applicationID, this.token, messageID);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Delete the original interaction response.
|
|
148
|
+
*/
|
|
149
|
+
async deleteOriginal() {
|
|
150
|
+
return this.client.rest.interactions.deleteOriginalMessage(this.applicationID, this.token);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Edit a followup message.
|
|
154
|
+
* @param messageID The ID of the message.
|
|
155
|
+
* @param options The options for editing the followup message.
|
|
156
|
+
*/
|
|
157
|
+
async editFollowup(messageID, options) {
|
|
158
|
+
return this.client.rest.interactions.editFollowupMessage(this.applicationID, this.token, messageID, options);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Edit the original interaction response.
|
|
162
|
+
* @param options The options for editing the original message.
|
|
163
|
+
*/
|
|
164
|
+
async editOriginal(options) {
|
|
165
|
+
return this.client.rest.interactions.editOriginalMessage(this.applicationID, this.token, options);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Edit the message this interaction is from. If this interaction has already been acknowledged, use `createFollowup`.
|
|
169
|
+
* @param options The options for editing the message.
|
|
170
|
+
*/
|
|
171
|
+
async editParent(options) {
|
|
172
|
+
if (this.acknowledged) {
|
|
173
|
+
throw new TypeError("Interactions cannot have more than one initial response.");
|
|
174
|
+
}
|
|
175
|
+
this.acknowledged = true;
|
|
176
|
+
return this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.UPDATE_MESSAGE, data: options });
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get a followup message.
|
|
180
|
+
* @param messageID The ID of the message.
|
|
181
|
+
*/
|
|
182
|
+
async getFollowup(messageID) {
|
|
183
|
+
return this.client.rest.interactions.getFollowupMessage(this.applicationID, this.token, messageID);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get the original interaction response.
|
|
187
|
+
*/
|
|
188
|
+
async getOriginal() {
|
|
189
|
+
return this.client.rest.interactions.getOriginalMessage(this.applicationID, this.token);
|
|
190
|
+
}
|
|
191
|
+
/** Whether this interaction belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
|
|
192
|
+
inCachedGuildChannel() {
|
|
193
|
+
return this.channel instanceof GuildChannel_1.default;
|
|
194
|
+
}
|
|
195
|
+
/** Whether this interaction belongs to a private channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
|
|
196
|
+
inPrivateChannel() {
|
|
197
|
+
return this.guildID === null;
|
|
198
|
+
}
|
|
199
|
+
/** Show a "premium required" response to the user. This is an initial response, and more than one initial response cannot be used. */
|
|
200
|
+
async premiumRequired() {
|
|
201
|
+
if (this.acknowledged) {
|
|
202
|
+
throw new TypeError("Interactions cannot have more than one initial response.");
|
|
203
|
+
}
|
|
204
|
+
this.acknowledged = true;
|
|
205
|
+
return this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.PREMIUM_REQUIRED, data: {} });
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Reply to this interaction. If the interaction hasn't been acknowledged, {@link ModalSubmitInteraction#createMessage | createMessage} is used. Else, {@link ModalSubmitInteraction#createFollowup | createFollowup} is used.
|
|
209
|
+
* Note the returned class is not a message. Depending on which method was used, the returned class may or may not have the sent message. {@link MessageInteractionResponse#hasMessage | hasMessage} can be used for type narrowing
|
|
210
|
+
* to check if {@link MessageInteractionResponse#message | message} is present. If it is not, the {@link MessageInteractionResponse#getMessage | getMessage} can be used.
|
|
211
|
+
* @note Due to atachments not being able to be sent in initial responses, attachments will cause a deferred response, if the interaction has not been acknowledged.
|
|
212
|
+
* @param options The options for the message.
|
|
213
|
+
*/
|
|
214
|
+
async reply(options) {
|
|
215
|
+
let useFollowup = this.acknowledged;
|
|
216
|
+
if (!useFollowup && options.files && options.files.length !== 0) {
|
|
217
|
+
await this.defer(options.flags);
|
|
218
|
+
useFollowup = true;
|
|
219
|
+
}
|
|
220
|
+
return useFollowup ? this.createFollowup(options) : this.createMessage(options);
|
|
221
|
+
}
|
|
222
|
+
toJSON() {
|
|
223
|
+
return {
|
|
224
|
+
...super.toJSON(),
|
|
225
|
+
appPermissions: this.appPermissions.toJSON(),
|
|
226
|
+
authorizingIntegrationOwners: this.authorizingIntegrationOwners,
|
|
227
|
+
channelID: this.channelID,
|
|
228
|
+
context: this.context,
|
|
229
|
+
data: this.data,
|
|
230
|
+
guildID: this.guildID ?? undefined,
|
|
231
|
+
guildLocale: this.guildLocale,
|
|
232
|
+
locale: this.locale,
|
|
233
|
+
member: this.member?.toJSON(),
|
|
234
|
+
type: this.type,
|
|
235
|
+
user: this.user.toJSON()
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
exports.default = ModalSubmitInteraction;
|
|
240
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTW9kYWxTdWJtaXRJbnRlcmFjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9zdHJ1Y3R1cmVzL01vZGFsU3VibWl0SW50ZXJhY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscUNBQXFDO0FBQ3JDLHdFQUF3QztBQUl4QyxzRUFBc0M7QUFDdEMsZ0VBQWdDO0FBQ2hDLDBFQUEwQztBQUkxQyw0Q0FBNkc7QUFjN0csMkNBQStDO0FBQy9DLHlIQUErSztBQUMvSyxtSkFBbUg7QUFFbkgsNkNBQTZDO0FBQzdDLE1BQXFCLHNCQUFzRyxTQUFRLHFCQUFXO0lBQ2xJLGNBQWMsQ0FBbUQ7SUFDakUsWUFBWSxDQUE0RDtJQUNoRixvUUFBb1E7SUFDcFEsY0FBYyxDQUFhO0lBQzNCLHVSQUF1UjtJQUN2Uiw0QkFBNEIsQ0FBK0I7SUFDM0QsNERBQTREO0lBQzVELFNBQVMsQ0FBUztJQUNsQixrREFBa0Q7SUFDbEQsT0FBTyxDQUEyQjtJQUNsQyxnREFBZ0Q7SUFDaEQsSUFBSSxDQ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FBQyxNQUFNLEVBQUU7U0FDbkQsQ0FBQztJQUNOLENBQUM7Q0FDSjtBQXpQRCx5Q0F5UEMifQ==
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/** @module OAuthApplication */
|
|
2
|
+
import type User from "./User";
|
|
3
|
+
import Team from "./Team";
|
|
4
|
+
import type Guild from "./Guild";
|
|
5
|
+
import Base from "./Base";
|
|
6
|
+
import type Client from "../Client";
|
|
7
|
+
import type { InstallParams } from "../types/oauth";
|
|
8
|
+
import type { IntegrationTypesConfig, RESTOAuthApplication } from "../types/applications";
|
|
9
|
+
import type { ApplicationIntegrationTypes, ImageFormat } from "../Constants";
|
|
10
|
+
import type { JSONOAuthApplication } from "../types/json";
|
|
11
|
+
/** Represents an oauth application. */
|
|
12
|
+
export default class OAuthApplication extends Base {
|
|
13
|
+
private _cachedGuild?;
|
|
14
|
+
/** When false, only the application's owners can invite the bot to guilds. */
|
|
15
|
+
botPublic: boolean;
|
|
16
|
+
/** When true, the applications bot will only join upon the completion of the full oauth2 code grant flow. */
|
|
17
|
+
botRequireCodeGrant: boolean;
|
|
18
|
+
/** This application's rich presence invite cover image hash, if any. */
|
|
19
|
+
coverImage: string | null;
|
|
20
|
+
/** This application's default custom authorization link, if any. */
|
|
21
|
+
customInstallURL?: string;
|
|
22
|
+
/** The description of the application. */
|
|
23
|
+
description: string;
|
|
24
|
+
/** This application's [public flags](https://discord.com/developers/docs/resources/application#application-object-application-flags). */
|
|
25
|
+
flags: number;
|
|
26
|
+
/** If this application is a game sold on Discord, the ID of the guild to which it has been linked. */
|
|
27
|
+
guildID: string | null;
|
|
28
|
+
/** The icon hash of the application. */
|
|
29
|
+
icon: string | null;
|
|
30
|
+
/** Settings for this application's in-app authorization link, if enabled. */
|
|
31
|
+
installParams?: InstallParams;
|
|
32
|
+
/** The install types available for this application. */
|
|
33
|
+
integrationTypes: Array<ApplicationIntegrationTypes>;
|
|
34
|
+
/** The configs for the install types available for this application. */
|
|
35
|
+
integrationTypesConfig: IntegrationTypesConfig;
|
|
36
|
+
/** The name of the application. */
|
|
37
|
+
name: string;
|
|
38
|
+
/** The owner of this application. */
|
|
39
|
+
owner: User;
|
|
40
|
+
/** The ID of the owner of this application. */
|
|
41
|
+
ownerID: string;
|
|
42
|
+
/** If this application is a game sold on Discord, the id of the Game's SKU. */
|
|
43
|
+
primarySKUID?: string;
|
|
44
|
+
/** A URL to this application's privacy policy. */
|
|
45
|
+
privacyPolicyURL?: string;
|
|
46
|
+
/** This application's role connections verification url. */
|
|
47
|
+
roleConnectionsVerificationURL?: string;
|
|
48
|
+
/** A list of rpc origin urls, if rpc is enabled. */
|
|
49
|
+
rpcOrigins: Array<string>;
|
|
50
|
+
/** If this application is a game sold on Discord, the slug that links to its store page. */
|
|
51
|
+
slug?: string;
|
|
52
|
+
/** The tags for this application. */
|
|
53
|
+
tags?: Array<string>;
|
|
54
|
+
/** The team that owns this application, if any. */
|
|
55
|
+
team: Team | null;
|
|
56
|
+
/** A URL to this application's terms of service. */
|
|
57
|
+
termsOfServiceURL?: string;
|
|
58
|
+
/** The type of this application. */
|
|
59
|
+
type: number | null;
|
|
60
|
+
/** The bot's hex encoded public key. */
|
|
61
|
+
verifyKey: string;
|
|
62
|
+
constructor(data: RESTOAuthApplication, client: Client);
|
|
63
|
+
protected update(data: Partial<RESTOAuthApplication>): void;
|
|
64
|
+
/** If this application is a game sold on Discord, the guild to which it has been linked. This will throw an error if the guild is not cached. */
|
|
65
|
+
get guild(): Guild | null;
|
|
66
|
+
/**
|
|
67
|
+
* The url of this application's cover image.
|
|
68
|
+
* @param format The format the url should be.
|
|
69
|
+
* @param size The dimensions of the image.
|
|
70
|
+
*/
|
|
71
|
+
coverImageURL(format?: ImageFormat, size?: number): string | null;
|
|
72
|
+
/**
|
|
73
|
+
* The url of this application's icon.
|
|
74
|
+
* @param format The format the url should be.
|
|
75
|
+
* @param size The dimensions of the image.
|
|
76
|
+
*/
|
|
77
|
+
iconURL(format?: ImageFormat, size?: number): string | null;
|
|
78
|
+
toJSON(): JSONOAuthApplication;
|
|
79
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const Team_1 = tslib_1.__importDefault(require("./Team"));
|
|
5
|
+
const Base_1 = tslib_1.__importDefault(require("./Base"));
|
|
6
|
+
const Routes = tslib_1.__importStar(require("../util/Routes"));
|
|
7
|
+
const Errors_1 = require("../util/Errors");
|
|
8
|
+
/** Represents an oauth application. */
|
|
9
|
+
class OAuthApplication extends Base_1.default {
|
|
10
|
+
_cachedGuild;
|
|
11
|
+
/** When false, only the application's owners can invite the bot to guilds. */
|
|
12
|
+
botPublic;
|
|
13
|
+
/** When true, the applications bot will only join upon the completion of the full oauth2 code grant flow. */
|
|
14
|
+
botRequireCodeGrant;
|
|
15
|
+
/** This application's rich presence invite cover image hash, if any. */
|
|
16
|
+
coverImage;
|
|
17
|
+
/** This application's default custom authorization link, if any. */
|
|
18
|
+
customInstallURL;
|
|
19
|
+
/** The description of the application. */
|
|
20
|
+
description;
|
|
21
|
+
/** This application's [public flags](https://discord.com/developers/docs/resources/application#application-object-application-flags). */
|
|
22
|
+
flags;
|
|
23
|
+
/** If this application is a game sold on Discord, the ID of the guild to which it has been linked. */
|
|
24
|
+
guildID;
|
|
25
|
+
/** The icon hash of the application. */
|
|
26
|
+
icon;
|
|
27
|
+
/** Settings for this application's in-app authorization link, if enabled. */
|
|
28
|
+
installParams;
|
|
29
|
+
/** The install types available for this application. */
|
|
30
|
+
integrationTypes;
|
|
31
|
+
/** The configs for the install types available for this application. */
|
|
32
|
+
integrationTypesConfig;
|
|
33
|
+
/** The name of the application. */
|
|
34
|
+
name;
|
|
35
|
+
/** The owner of this application. */
|
|
36
|
+
owner;
|
|
37
|
+
/** The ID of the owner of this application. */
|
|
38
|
+
ownerID;
|
|
39
|
+
/** If this application is a game sold on Discord, the id of the Game's SKU. */
|
|
40
|
+
primarySKUID;
|
|
41
|
+
/** A URL to this application's privacy policy. */
|
|
42
|
+
privacyPolicyURL;
|
|
43
|
+
/** This application's role connections verification url. */
|
|
44
|
+
roleConnectionsVerificationURL;
|
|
45
|
+
/** A list of rpc origin urls, if rpc is enabled. */
|
|
46
|
+
rpcOrigins;
|
|
47
|
+
/** If this application is a game sold on Discord, the slug that links to its store page. */
|
|
48
|
+
slug;
|
|
49
|
+
/** The tags for this application. */
|
|
50
|
+
tags;
|
|
51
|
+
/** The team that owns this application, if any. */
|
|
52
|
+
team;
|
|
53
|
+
/** A URL to this application's terms of service. */
|
|
54
|
+
termsOfServiceURL;
|
|
55
|
+
/** The type of this application. */
|
|
56
|
+
type;
|
|
57
|
+
/** The bot's hex encoded public key. */
|
|
58
|
+
verifyKey;
|
|
59
|
+
constructor(data, client) {
|
|
60
|
+
super(data.id, client);
|
|
61
|
+
this.botPublic = !!data.bot_public;
|
|
62
|
+
this.botRequireCodeGrant = !!data.bot_require_code_grant;
|
|
63
|
+
this.coverImage = null;
|
|
64
|
+
this.description = data.description;
|
|
65
|
+
this.flags = data.flags;
|
|
66
|
+
this.guildID = data.guild_id ?? null;
|
|
67
|
+
this.icon = null;
|
|
68
|
+
this.integrationTypes = [];
|
|
69
|
+
this.integrationTypesConfig = {};
|
|
70
|
+
this.name = data.name;
|
|
71
|
+
this.owner = client.users.update(data.owner);
|
|
72
|
+
this.ownerID = data.owner.id;
|
|
73
|
+
this.rpcOrigins = [];
|
|
74
|
+
this.team = null;
|
|
75
|
+
this.type = data.type;
|
|
76
|
+
this.verifyKey = data.verify_key;
|
|
77
|
+
this.update(data);
|
|
78
|
+
}
|
|
79
|
+
update(data) {
|
|
80
|
+
super.update(data);
|
|
81
|
+
if (data.bot_public !== undefined) {
|
|
82
|
+
this.botPublic = data.bot_public;
|
|
83
|
+
}
|
|
84
|
+
if (data.bot_require_code_grant !== undefined) {
|
|
85
|
+
this.botRequireCodeGrant = data.bot_require_code_grant;
|
|
86
|
+
}
|
|
87
|
+
if (data.cover_image !== undefined) {
|
|
88
|
+
this.coverImage = data.cover_image;
|
|
89
|
+
}
|
|
90
|
+
if (data.custom_install_url !== undefined) {
|
|
91
|
+
this.customInstallURL = data.custom_install_url;
|
|
92
|
+
}
|
|
93
|
+
if (data.description !== undefined) {
|
|
94
|
+
this.description = data.description;
|
|
95
|
+
}
|
|
96
|
+
if (data.flags !== undefined) {
|
|
97
|
+
this.flags = data.flags;
|
|
98
|
+
}
|
|
99
|
+
this.guildID = data.guild_id === undefined ? null : data.guild_id;
|
|
100
|
+
if (data.icon !== undefined) {
|
|
101
|
+
this.icon = data.icon;
|
|
102
|
+
}
|
|
103
|
+
if (data.install_params !== undefined) {
|
|
104
|
+
this.installParams = data.install_params;
|
|
105
|
+
}
|
|
106
|
+
if (data.integration_types !== undefined) {
|
|
107
|
+
this.integrationTypes = data.integration_types;
|
|
108
|
+
}
|
|
109
|
+
if (data.integration_types_config !== undefined) {
|
|
110
|
+
this.integrationTypesConfig = Object.fromEntries(Object.entries(data.integration_types_config).map(([key, value]) => [key, { oauth2InstallParams: value.oauth2_install_params }]));
|
|
111
|
+
}
|
|
112
|
+
if (data.name !== undefined) {
|
|
113
|
+
this.name = data.name;
|
|
114
|
+
}
|
|
115
|
+
if (data.owner !== undefined) {
|
|
116
|
+
this.owner = this.client.users.update(data.owner);
|
|
117
|
+
this.ownerID = data.owner.id;
|
|
118
|
+
}
|
|
119
|
+
if (data.primary_sku_id !== undefined) {
|
|
120
|
+
this.primarySKUID = data.primary_sku_id;
|
|
121
|
+
}
|
|
122
|
+
if (data.privacy_policy_url !== undefined) {
|
|
123
|
+
this.privacyPolicyURL = data.privacy_policy_url;
|
|
124
|
+
}
|
|
125
|
+
if (data.rpc_origins !== undefined) {
|
|
126
|
+
this.rpcOrigins = data.rpc_origins;
|
|
127
|
+
}
|
|
128
|
+
if (data.slug !== undefined) {
|
|
129
|
+
this.slug = data.slug;
|
|
130
|
+
}
|
|
131
|
+
if (data.tags !== undefined) {
|
|
132
|
+
this.tags = data.tags;
|
|
133
|
+
}
|
|
134
|
+
if (data.team !== undefined) {
|
|
135
|
+
this.team = data.team ? new Team_1.default(data.team, this.client) : null;
|
|
136
|
+
}
|
|
137
|
+
if (data.terms_of_service_url !== undefined) {
|
|
138
|
+
this.termsOfServiceURL = data.terms_of_service_url;
|
|
139
|
+
}
|
|
140
|
+
if (data.type !== undefined) {
|
|
141
|
+
this.type = data.type;
|
|
142
|
+
}
|
|
143
|
+
if (data.verify_key !== undefined) {
|
|
144
|
+
this.verifyKey = data.verify_key;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/** If this application is a game sold on Discord, the guild to which it has been linked. This will throw an error if the guild is not cached. */
|
|
148
|
+
get guild() {
|
|
149
|
+
if (this.guildID !== null && this._cachedGuild !== null) {
|
|
150
|
+
this._cachedGuild ??= this.client.guilds.get(this.guildID);
|
|
151
|
+
if (!this._cachedGuild) {
|
|
152
|
+
if (this.client.options.restMode) {
|
|
153
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
154
|
+
}
|
|
155
|
+
if (!this.client.shards.connected) {
|
|
156
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
157
|
+
}
|
|
158
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
159
|
+
}
|
|
160
|
+
return this._cachedGuild;
|
|
161
|
+
}
|
|
162
|
+
return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The url of this application's cover image.
|
|
166
|
+
* @param format The format the url should be.
|
|
167
|
+
* @param size The dimensions of the image.
|
|
168
|
+
*/
|
|
169
|
+
coverImageURL(format, size) {
|
|
170
|
+
return this.coverImage === null ? null : this.client.util.formatImage(Routes.APPLICATION_COVER(this.id, this.coverImage), format, size);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The url of this application's icon.
|
|
174
|
+
* @param format The format the url should be.
|
|
175
|
+
* @param size The dimensions of the image.
|
|
176
|
+
*/
|
|
177
|
+
iconURL(format, size) {
|
|
178
|
+
return this.icon === null ? null : this.client.util.formatImage(Routes.APPLICATION_ICON(this.id, this.icon), format, size);
|
|
179
|
+
}
|
|
180
|
+
toJSON() {
|
|
181
|
+
return {
|
|
182
|
+
...super.toJSON(),
|
|
183
|
+
botPublic: this.botPublic,
|
|
184
|
+
botRequireCodeGrant: this.botRequireCodeGrant,
|
|
185
|
+
coverImage: this.coverImage,
|
|
186
|
+
customInstallURL: this.customInstallURL,
|
|
187
|
+
description: this.description,
|
|
188
|
+
flags: this.flags,
|
|
189
|
+
guildID: this.guildID,
|
|
190
|
+
icon: this.icon,
|
|
191
|
+
installParams: this.installParams,
|
|
192
|
+
integrationTypes: this.integrationTypes,
|
|
193
|
+
integrationTypesConfig: this.integrationTypesConfig,
|
|
194
|
+
name: this.name,
|
|
195
|
+
owner: this.owner.toJSON(),
|
|
196
|
+
ownerID: this.ownerID,
|
|
197
|
+
primarySKUID: this.primarySKUID,
|
|
198
|
+
privacyPolicyURL: this.privacyPolicyURL,
|
|
199
|
+
rpcOrigins: this.rpcOrigins,
|
|
200
|
+
slug: this.slug,
|
|
201
|
+
tags: this.tags,
|
|
202
|
+
team: this.team?.toJSON() ?? null,
|
|
203
|
+
termsOfServiceURL: this.termsOfServiceURL,
|
|
204
|
+
type: this.type,
|
|
205
|
+
verifyKey: this.verifyKey
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.default = OAuthApplication;
|
|
210
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT0F1dGhBcHBsaWNhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9zdHJ1Y3R1cmVzL09BdXRoQXBwbGljYXRp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UFJLENBQUMsWUFBWTtZQUN6QyxnQkFBZ0IsRUFBUSxJQUFJLENBQUMsZ0JBQWdCO1lBQzdDLFVBQVUsRUFBYyxJQUFJLENBQUMsVUFBVTtZQUN2QyxJQUFJLEVBQW9CLElBQUksQ0FBQyxJQUFJO1lBQ2pDLElBQUksRUFBb0IsSUFBSSxDQUFDLElBQUk7WUFDakMsSUFBSSxFQUFvQixJQUFJLENBQUMsSUFBSSxFQUFFLE1BQU0sRUFBRSxJQUFJLElBQUk7WUFDbkQsaUJBQWlCLEVBQU8sSUFBSSxDQUFDLGlCQUFpQjtZQUM5QyxJQUFJLEVBQW9CLElBQUksQ0FBQyxJQUFJO1lBQ2pDLFNBQVMsRUFBZSxJQUFJLENBQUMsU0FBUztTQUV6QyxDQUFDO0lBQ04sQ0FBQztDQUNKO0FBak5ELG1DQWlOQyJ9
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** @module OAuthGuild */
|
|
2
|
+
import Base from "./Base";
|
|
3
|
+
import Permission from "./Permission";
|
|
4
|
+
import type Guild from "./Guild";
|
|
5
|
+
import type { GuildFeature, ImageFormat } from "../Constants";
|
|
6
|
+
import type { JSONOAuthGuild, RawOAuthGuild } from "../types";
|
|
7
|
+
import type Client from "../Client";
|
|
8
|
+
/** Represents a guild retrieved via oauth. */
|
|
9
|
+
export default class OAuthGuild extends Base {
|
|
10
|
+
private _cachedCompleteGuild?;
|
|
11
|
+
/** The approximate number of members in this guild (if retrieved with counts). */
|
|
12
|
+
approximateMemberCount?: number;
|
|
13
|
+
/** The approximate number of non-offline members in this guild (if retrieved with counts). */
|
|
14
|
+
approximatePresenceCount?: number;
|
|
15
|
+
/** The [features](https://discord.com/developers/docs/resources/guild#guild-object-guild-features) this guild has. */
|
|
16
|
+
features: Array<GuildFeature>;
|
|
17
|
+
/** The icon hash of this guild. */
|
|
18
|
+
icon: string | null;
|
|
19
|
+
/** The name of this guild. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** If the user is the owner of this guild. */
|
|
22
|
+
owner: boolean;
|
|
23
|
+
/** The permissions of the user in this guild. */
|
|
24
|
+
permissions: Permission;
|
|
25
|
+
constructor(data: RawOAuthGuild, client: Client);
|
|
26
|
+
/** The complete guild this OAuthGuild represents, if cached. */
|
|
27
|
+
get completeGuild(): Guild | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The url of this guild's icon.
|
|
30
|
+
* @param format The format the url should be.
|
|
31
|
+
* @param size The dimensions of the image.
|
|
32
|
+
*/
|
|
33
|
+
iconURL(format?: ImageFormat, size?: number): string | null;
|
|
34
|
+
toJSON(): JSONOAuthGuild;
|
|
35
|
+
}
|