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,34 @@
|
|
|
1
|
+
/** @module GuildChannel */
|
|
2
|
+
import Channel from "./Channel";
|
|
3
|
+
import type Guild from "./Guild";
|
|
4
|
+
import type CategoryChannel from "./CategoryChannel";
|
|
5
|
+
import type TextChannel from "./TextChannel";
|
|
6
|
+
import type AnnouncementChannel from "./AnnouncementChannel";
|
|
7
|
+
import type ForumChannel from "./ForumChannel";
|
|
8
|
+
import type Client from "../Client";
|
|
9
|
+
import type { EditChannelOptionsMap, GuildChannels, RawGuildChannel } from "../types/channels";
|
|
10
|
+
import type { JSONGuildChannel } from "../types/json";
|
|
11
|
+
/** Represents a guild channel. */
|
|
12
|
+
export default class GuildChannel extends Channel {
|
|
13
|
+
private _cachedGuild?;
|
|
14
|
+
private _cachedParent?;
|
|
15
|
+
/** The id of the guild this channel is in. */
|
|
16
|
+
guildID: string;
|
|
17
|
+
/** The name of this channel. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** The ID of the parent of this channel, if applicable. */
|
|
20
|
+
parentID: string | null;
|
|
21
|
+
type: GuildChannels;
|
|
22
|
+
constructor(data: RawGuildChannel, client: Client);
|
|
23
|
+
protected update(data: Partial<RawGuildChannel>): void;
|
|
24
|
+
/** The guild associated with this channel. This will throw an error if the guild is not cached. */
|
|
25
|
+
get guild(): Guild;
|
|
26
|
+
/** The parent of this channel, if applicable. This will be a text/announcement/forum channel if we're in a thread, category otherwise. */
|
|
27
|
+
get parent(): TextChannel | AnnouncementChannel | CategoryChannel | ForumChannel | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Edit this channel.
|
|
30
|
+
* @param options The options for editing the channel.
|
|
31
|
+
*/
|
|
32
|
+
edit(options: EditChannelOptionsMap[this["type"]]): Promise<this>;
|
|
33
|
+
toJSON(): JSONGuildChannel;
|
|
34
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module GuildChannel */
|
|
5
|
+
const Channel_1 = tslib_1.__importDefault(require("./Channel"));
|
|
6
|
+
const Errors_1 = require("../util/Errors");
|
|
7
|
+
/** Represents a guild channel. */
|
|
8
|
+
class GuildChannel extends Channel_1.default {
|
|
9
|
+
_cachedGuild;
|
|
10
|
+
_cachedParent;
|
|
11
|
+
/** The id of the guild this channel is in. */
|
|
12
|
+
guildID;
|
|
13
|
+
/** The name of this channel. */
|
|
14
|
+
name;
|
|
15
|
+
/** The ID of the parent of this channel, if applicable. */
|
|
16
|
+
parentID;
|
|
17
|
+
constructor(data, client) {
|
|
18
|
+
super(data, client);
|
|
19
|
+
this.guildID = data.guild_id;
|
|
20
|
+
this.name = data.name;
|
|
21
|
+
this.parentID = data.parent_id;
|
|
22
|
+
}
|
|
23
|
+
update(data) {
|
|
24
|
+
super.update(data);
|
|
25
|
+
if (data.guild_id !== undefined) {
|
|
26
|
+
this.guildID = data.guild_id;
|
|
27
|
+
}
|
|
28
|
+
if (data.name !== undefined) {
|
|
29
|
+
this.name = data.name;
|
|
30
|
+
}
|
|
31
|
+
if (data.parent_id !== undefined) {
|
|
32
|
+
this.parentID = data.parent_id;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** The guild associated with this channel. This will throw an error if the guild is not cached. */
|
|
36
|
+
get guild() {
|
|
37
|
+
this._cachedGuild ??= this.client.guilds.get(this.guildID);
|
|
38
|
+
if (!this._cachedGuild) {
|
|
39
|
+
if (this.client.options.restMode) {
|
|
40
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
41
|
+
}
|
|
42
|
+
if (!this.client.shards.connected) {
|
|
43
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
44
|
+
}
|
|
45
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
46
|
+
}
|
|
47
|
+
return this._cachedGuild;
|
|
48
|
+
}
|
|
49
|
+
/** The parent of this channel, if applicable. This will be a text/announcement/forum channel if we're in a thread, category otherwise. */
|
|
50
|
+
get parent() {
|
|
51
|
+
if (this.parentID !== null && this._cachedParent !== null) {
|
|
52
|
+
return this._cachedParent ?? (this._cachedParent = this.client.getChannel(this.parentID));
|
|
53
|
+
}
|
|
54
|
+
return this._cachedParent === null ? this._cachedParent : (this._cachedParent = null);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Edit this channel.
|
|
58
|
+
* @param options The options for editing the channel.
|
|
59
|
+
*/
|
|
60
|
+
async edit(options) {
|
|
61
|
+
// edit is called down the chain
|
|
62
|
+
return this.client.rest.channels.edit(this.id, options);
|
|
63
|
+
}
|
|
64
|
+
toJSON() {
|
|
65
|
+
return {
|
|
66
|
+
...super.toJSON(),
|
|
67
|
+
guildID: this.guildID,
|
|
68
|
+
name: this.name,
|
|
69
|
+
parentID: this.par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
|
3
|
+
import type Client from "../Client";
|
|
4
|
+
import type { GuildFeature, ImageFormat } from "../Constants";
|
|
5
|
+
import type { GuildEmoji, RawGuildPreview, RawSticker } from "../types/guilds";
|
|
6
|
+
import type { JSONGuildPreview } from "../types/json";
|
|
7
|
+
/** Represents a preview of a guild. */
|
|
8
|
+
export default class GuildPreview extends Base {
|
|
9
|
+
/** The approximate number of members in this guild. */
|
|
10
|
+
approximateMemberCount: number;
|
|
11
|
+
/** The approximate number of online members in this guild. */
|
|
12
|
+
approximatePresenceCount: number;
|
|
13
|
+
/** The description of this guild. */
|
|
14
|
+
description: string | null;
|
|
15
|
+
/** The discovery splash hash of this guild. */
|
|
16
|
+
discoverySplash: string | null;
|
|
17
|
+
/** The emojis of this guild. */
|
|
18
|
+
emojis: Array<GuildEmoji>;
|
|
19
|
+
/** The [features](https://discord.com/developers/docs/resources/guild#guild-object-guild-features) of this guild. */
|
|
20
|
+
features: Array<GuildFeature>;
|
|
21
|
+
/** The icon hash of this guild. */
|
|
22
|
+
icon: string | null;
|
|
23
|
+
/** The name of this guild. */
|
|
24
|
+
name: string;
|
|
25
|
+
/** The invite splash of this guild. */
|
|
26
|
+
splash: string | null;
|
|
27
|
+
/** The stickers in this guild. */
|
|
28
|
+
stickers: Array<RawSticker>;
|
|
29
|
+
constructor(data: RawGuildPreview, client: Client);
|
|
30
|
+
protected update(data: RawGuildPreview): void;
|
|
31
|
+
/**
|
|
32
|
+
* The url of this guild's discovery splash.
|
|
33
|
+
* @param format The format the url should be.
|
|
34
|
+
* @param size The dimensions of the image.
|
|
35
|
+
*/
|
|
36
|
+
discoverySplashURL(format?: ImageFormat, size?: number): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* The url of this guild's icon.
|
|
39
|
+
* @param format The format the url should be.
|
|
40
|
+
* @param size The dimensions of the image.
|
|
41
|
+
*/
|
|
42
|
+
iconURL(format?: ImageFormat, size?: number): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* The url of this guild's invite splash.
|
|
45
|
+
* @param format The format the url should be.
|
|
46
|
+
* @param size The dimensions of the image.
|
|
47
|
+
*/
|
|
48
|
+
splashURL(format?: ImageFormat, size?: number): string | null;
|
|
49
|
+
toJSON(): JSONGuildPreview;
|
|
50
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module GuildPreview */
|
|
5
|
+
const Base_1 = tslib_1.__importDefault(require("./Base"));
|
|
6
|
+
const Routes = tslib_1.__importStar(require("../util/Routes"));
|
|
7
|
+
/** Represents a preview of a guild. */
|
|
8
|
+
class GuildPreview extends Base_1.default {
|
|
9
|
+
/** The approximate number of members in this guild. */
|
|
10
|
+
approximateMemberCount;
|
|
11
|
+
/** The approximate number of online members in this guild. */
|
|
12
|
+
approximatePresenceCount;
|
|
13
|
+
/** The description of this guild. */
|
|
14
|
+
description;
|
|
15
|
+
/** The discovery splash hash of this guild. */
|
|
16
|
+
discoverySplash;
|
|
17
|
+
/** The emojis of this guild. */
|
|
18
|
+
emojis;
|
|
19
|
+
/** The [features](https://discord.com/developers/docs/resources/guild#guild-object-guild-features) of this guild. */
|
|
20
|
+
features;
|
|
21
|
+
/** The icon hash of this guild. */
|
|
22
|
+
icon;
|
|
23
|
+
/** The name of this guild. */
|
|
24
|
+
name;
|
|
25
|
+
/** The invite splash of this guild. */
|
|
26
|
+
splash;
|
|
27
|
+
/** The stickers in this guild. */
|
|
28
|
+
stickers;
|
|
29
|
+
constructor(data, client) {
|
|
30
|
+
super(data.id, client);
|
|
31
|
+
this.approximateMemberCount = 0;
|
|
32
|
+
this.approximatePresenceCount = 0;
|
|
33
|
+
this.description = null;
|
|
34
|
+
this.discoverySplash = null;
|
|
35
|
+
this.emojis = [];
|
|
36
|
+
this.features = [];
|
|
37
|
+
this.icon = null;
|
|
38
|
+
this.name = data.name;
|
|
39
|
+
this.splash = null;
|
|
40
|
+
this.stickers = [];
|
|
41
|
+
this.update(data);
|
|
42
|
+
}
|
|
43
|
+
update(data) {
|
|
44
|
+
if (data.approximate_member_count !== undefined) {
|
|
45
|
+
this.approximateMemberCount = data.approximate_member_count;
|
|
46
|
+
}
|
|
47
|
+
if (data.approximate_presence_count !== undefined) {
|
|
48
|
+
this.approximatePresenceCount = data.approximate_presence_count;
|
|
49
|
+
}
|
|
50
|
+
if (data.description !== undefined) {
|
|
51
|
+
this.description = data.description;
|
|
52
|
+
}
|
|
53
|
+
if (data.discovery_splash !== undefined) {
|
|
54
|
+
this.discoverySplash = data.discovery_splash;
|
|
55
|
+
}
|
|
56
|
+
if (data.emojis !== undefined) {
|
|
57
|
+
this.emojis = data.emojis.map(emoji => ({
|
|
58
|
+
...emoji,
|
|
59
|
+
user: emoji.user === undefined ? undefined : this.client.users.update(emoji.user)
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
if (data.features !== undefined) {
|
|
63
|
+
this.features = data.features;
|
|
64
|
+
}
|
|
65
|
+
if (data.icon !== undefined) {
|
|
66
|
+
this.icon = data.icon;
|
|
67
|
+
}
|
|
68
|
+
if (data.name !== undefined) {
|
|
69
|
+
this.name = data.name;
|
|
70
|
+
}
|
|
71
|
+
if (data.splash !== undefined) {
|
|
72
|
+
this.splash = data.splash;
|
|
73
|
+
}
|
|
74
|
+
if (data.stickers !== undefined) {
|
|
75
|
+
this.stickers = data.stickers;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The url of this guild's discovery splash.
|
|
80
|
+
* @param format The format the url should be.
|
|
81
|
+
* @param size The dimensions of the image.
|
|
82
|
+
*/
|
|
83
|
+
discoverySplashURL(format, size) {
|
|
84
|
+
return this.discoverySplash === null ? null : this.client.util.formatImage(Routes.GUILD_DISCOVERY_SPLASH(this.id, this.discoverySplash), format, size);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The url of this guild's icon.
|
|
88
|
+
* @param format The format the url should be.
|
|
89
|
+
* @param size The dimensions of the image.
|
|
90
|
+
*/
|
|
91
|
+
iconURL(format, size) {
|
|
92
|
+
return this.icon === null ? null : this.client.util.formatImage(Routes.GUILD_ICON(this.id, this.icon), format, size);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The url of this guild's invite splash.
|
|
96
|
+
* @param format The format the url should be.
|
|
97
|
+
* @param size The dimensions of the image.
|
|
98
|
+
*/
|
|
99
|
+
splashURL(format, size) {
|
|
100
|
+
return this.splash === null ? null : this.client.util.formatImage(Routes.GUILD_SPLASH(this.id, this.splash), format, size);
|
|
101
|
+
}
|
|
102
|
+
toJSON() {
|
|
103
|
+
return {
|
|
104
|
+
...super.toJSON(),
|
|
105
|
+
approximateMemberCount: this.approximateMemberCount,
|
|
106
|
+
approximatePresenceCount: this.approximatePresenceCount,
|
|
107
|
+
description: this.description,
|
|
108
|
+
discoverySplash: this.discoverySplash,
|
|
109
|
+
emojis: this.emojis,
|
|
110
|
+
features: this.features,
|
|
111
|
+
icon: this.icon,
|
|
112
|
+
name: this.name,
|
|
113
|
+
splash: this.splash,
|
|
114
|
+
stickers: this.stickers
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.default = GuildPreview;
|
|
119
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR3VpbGRQcmV2aWV3LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL3N0cnVjdHVyZXMvR3VpbGRQcmV2aWV3LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDJCQUEyQjtBQUMzQiwwREFBMEI7QUFLMUIsK0RBQXlDO0FBRXpDLHVDQUF1QztBQUN2QyxNQUFxQixZQUFhLFNBQVEsY0FBSTtJQUMxQyx1REFBdUQ7SUFDdkQsc0JBQXNCLENBQVM7SUFDL0IsOERBQThEO0lBQzlEL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RO1NBQzFDLENBQUM7SUFDTixDQUFDO0NBQ0o7QUFsSEQsK0JBa0hDIn0=
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** @module GuildScheduledEvent */
|
|
2
|
+
import Base from "./Base";
|
|
3
|
+
import type User from "./User";
|
|
4
|
+
import type Guild from "./Guild";
|
|
5
|
+
import type StageChannel from "./StageChannel";
|
|
6
|
+
import type Client from "../Client";
|
|
7
|
+
import type { ImageFormat, GuildScheduledEventEntityTypes, GuildScheduledEventPrivacyLevels, GuildScheduledEventStatuses } from "../Constants";
|
|
8
|
+
import type { RawScheduledEvent, ScheduledEventEntityMetadata } from "../types/scheduled-events";
|
|
9
|
+
import type { JSONScheduledEvent } from "../types/json";
|
|
10
|
+
/** Represents a guild scheduled event. */
|
|
11
|
+
export default class GuildScheduledEvent extends Base {
|
|
12
|
+
private _cachedChannel?;
|
|
13
|
+
private _cachedGuild?;
|
|
14
|
+
/** The id of the channel in which the event will be hosted. `null` if entityType is `EXTERNAL` */
|
|
15
|
+
channelID: string | null;
|
|
16
|
+
/** The creator of the event. Not present on events created before October 25th, 2021. */
|
|
17
|
+
creator?: User;
|
|
18
|
+
/** The description of the event. */
|
|
19
|
+
description?: string | null;
|
|
20
|
+
/** The id of the entity associated with the event. */
|
|
21
|
+
entityID: string | null;
|
|
22
|
+
/** The [metadata](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type) associated with the event. */
|
|
23
|
+
entityMetadata: ScheduledEventEntityMetadata | null;
|
|
24
|
+
/** The [entity type](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) of the event */
|
|
25
|
+
entityType: GuildScheduledEventEntityTypes;
|
|
26
|
+
/** The id of the guild this scheduled event belongs to. */
|
|
27
|
+
guildID: string;
|
|
28
|
+
/** The cover image of this event. */
|
|
29
|
+
image: string | null;
|
|
30
|
+
/** The name of the event. */
|
|
31
|
+
name: string;
|
|
32
|
+
/** The [privacy level](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) of the event. */
|
|
33
|
+
privacyLevel: GuildScheduledEventPrivacyLevels;
|
|
34
|
+
/** The time at which the event will end. Required if entityType is `EXTERNAL`. */
|
|
35
|
+
scheduledEndTime: Date | null;
|
|
36
|
+
/** The time at which the event will start. */
|
|
37
|
+
scheduledStartTime: Date;
|
|
38
|
+
/** The [status](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) of the event. */
|
|
39
|
+
status: GuildScheduledEventStatuses;
|
|
40
|
+
/** The number of users subscribed to the event. */
|
|
41
|
+
userCount: number;
|
|
42
|
+
constructor(data: RawScheduledEvent, client: Client);
|
|
43
|
+
protected update(data: Partial<RawScheduledEvent>): void;
|
|
44
|
+
/** The channel in which the event will be hosted. `null` if entityType is `EXTERNAL` */
|
|
45
|
+
get channel(): StageChannel | null | undefined;
|
|
46
|
+
/** The guild this scheduled event belongs to. This will throw an error if the guild is not cached. */
|
|
47
|
+
get guild(): Guild;
|
|
48
|
+
/**
|
|
49
|
+
* Delete this scheduled event.
|
|
50
|
+
* @param reason The reason for deleting the scheduled event. Discord's docs do not explicitly state a reason can be provided, so it may not be used.
|
|
51
|
+
*/
|
|
52
|
+
deleteScheduledEvent(reason?: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* The url of this event's cover image.
|
|
55
|
+
* @param format The format of the image.
|
|
56
|
+
* @param size The size of the image.
|
|
57
|
+
*/
|
|
58
|
+
imageURL(format?: ImageFormat, size?: number): string | null;
|
|
59
|
+
toJSON(): JSONScheduledEvent;
|
|
60
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/** @module GuildScheduledEvent */
|
|
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 a guild scheduled event. */
|
|
9
|
+
class GuildScheduledEvent extends Base_1.default {
|
|
10
|
+
_cachedChannel;
|
|
11
|
+
_cachedGuild;
|
|
12
|
+
/** The id of the channel in which the event will be hosted. `null` if entityType is `EXTERNAL` */
|
|
13
|
+
channelID;
|
|
14
|
+
/** The creator of the event. Not present on events created before October 25th, 2021. */
|
|
15
|
+
creator;
|
|
16
|
+
/** The description of the event. */
|
|
17
|
+
description;
|
|
18
|
+
/** The id of the entity associated with the event. */
|
|
19
|
+
entityID;
|
|
20
|
+
/** The [metadata](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type) associated with the event. */
|
|
21
|
+
entityMetadata;
|
|
22
|
+
/** The [entity type](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) of the event */
|
|
23
|
+
entityType;
|
|
24
|
+
/** The id of the guild this scheduled event belongs to. */
|
|
25
|
+
guildID;
|
|
26
|
+
/** The cover image of this event. */
|
|
27
|
+
image;
|
|
28
|
+
/** The name of the event. */
|
|
29
|
+
name;
|
|
30
|
+
/** The [privacy level](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) of the event. */
|
|
31
|
+
privacyLevel;
|
|
32
|
+
/** The time at which the event will end. Required if entityType is `EXTERNAL`. */
|
|
33
|
+
scheduledEndTime;
|
|
34
|
+
/** The time at which the event will start. */
|
|
35
|
+
scheduledStartTime;
|
|
36
|
+
/** The [status](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) of the event. */
|
|
37
|
+
status;
|
|
38
|
+
/** The number of users subscribed to the event. */
|
|
39
|
+
userCount;
|
|
40
|
+
constructor(data, client) {
|
|
41
|
+
super(data.id, client);
|
|
42
|
+
this.channelID = data.channel_id;
|
|
43
|
+
this.entityID = null;
|
|
44
|
+
this.entityMetadata = null;
|
|
45
|
+
this.entityType = data.entity_type;
|
|
46
|
+
this.guildID = data.guild_id;
|
|
47
|
+
this.image = null;
|
|
48
|
+
this.name = data.name;
|
|
49
|
+
this.privacyLevel = data.privacy_level;
|
|
50
|
+
this.scheduledEndTime = data.scheduled_end_time ? new Date(data.scheduled_end_time) : null;
|
|
51
|
+
this.scheduledStartTime = new Date(data.scheduled_start_time);
|
|
52
|
+
this.status = data.status;
|
|
53
|
+
this.userCount = 0;
|
|
54
|
+
if (data.creator) {
|
|
55
|
+
this.creator = client.users.update(data.creator);
|
|
56
|
+
}
|
|
57
|
+
this.update(data);
|
|
58
|
+
}
|
|
59
|
+
update(data) {
|
|
60
|
+
if (data.channel_id !== undefined) {
|
|
61
|
+
this.channelID = data.channel_id;
|
|
62
|
+
}
|
|
63
|
+
if (data.description !== undefined) {
|
|
64
|
+
this.description = data.description;
|
|
65
|
+
}
|
|
66
|
+
if (data.entity_id !== undefined) {
|
|
67
|
+
this.entityID = data.entity_id;
|
|
68
|
+
}
|
|
69
|
+
if (data.entity_metadata !== undefined) {
|
|
70
|
+
this.entityMetadata = data.entity_metadata;
|
|
71
|
+
}
|
|
72
|
+
if (data.entity_type !== undefined) {
|
|
73
|
+
this.entityType = data.entity_type;
|
|
74
|
+
}
|
|
75
|
+
if (data.image !== undefined) {
|
|
76
|
+
this.image = data.image;
|
|
77
|
+
}
|
|
78
|
+
if (data.name !== undefined) {
|
|
79
|
+
this.name = data.name;
|
|
80
|
+
}
|
|
81
|
+
if (data.privacy_level !== undefined) {
|
|
82
|
+
this.privacyLevel = data.privacy_level;
|
|
83
|
+
}
|
|
84
|
+
if (data.scheduled_end_time !== undefined) {
|
|
85
|
+
this.scheduledEndTime = data.scheduled_end_time ? new Date(data.scheduled_end_time) : null;
|
|
86
|
+
}
|
|
87
|
+
if (data.scheduled_start_time !== undefined) {
|
|
88
|
+
this.scheduledStartTime = new Date(data.scheduled_start_time);
|
|
89
|
+
}
|
|
90
|
+
if (data.status !== undefined) {
|
|
91
|
+
this.status = data.status;
|
|
92
|
+
}
|
|
93
|
+
if (data.user_count !== undefined) {
|
|
94
|
+
this.userCount = data.user_count;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** The channel in which the event will be hosted. `null` if entityType is `EXTERNAL` */
|
|
98
|
+
get channel() {
|
|
99
|
+
if (this.channelID !== null) {
|
|
100
|
+
return this._cachedChannel ??= this.client.getChannel(this.channelID);
|
|
101
|
+
}
|
|
102
|
+
return this._cachedChannel === null ? this._cachedChannel : (this._cachedChannel = null);
|
|
103
|
+
}
|
|
104
|
+
/** The guild this scheduled event belongs to. This will throw an error if the guild is not cached. */
|
|
105
|
+
get guild() {
|
|
106
|
+
this._cachedGuild ??= this.client.guilds.get(this.guildID);
|
|
107
|
+
if (!this._cachedGuild) {
|
|
108
|
+
if (this.client.options.restMode) {
|
|
109
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
110
|
+
}
|
|
111
|
+
if (!this.client.shards.connected) {
|
|
112
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
113
|
+
}
|
|
114
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
115
|
+
}
|
|
116
|
+
return this._cachedGuild;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Delete this scheduled event.
|
|
120
|
+
* @param reason The reason for deleting the scheduled event. Discord's docs do not explicitly state a reason can be provided, so it may not be used.
|
|
121
|
+
*/
|
|
122
|
+
async deleteScheduledEvent(reason) {
|
|
123
|
+
return this.client.rest.guilds.deleteScheduledEvent(this.guildID, this.id, reason);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The url of this event's cover image.
|
|
127
|
+
* @param format The format of the image.
|
|
128
|
+
* @param size The size of the image.
|
|
129
|
+
*/
|
|
130
|
+
imageURL(format, size) {
|
|
131
|
+
return this.image ? this.client.util.formatImage(Routes.GUILD_SCHEDULED_EVENT_COVER(this.id, this.image), format, size) : null;
|
|
132
|
+
}
|
|
133
|
+
toJSON() {
|
|
134
|
+
return {
|
|
135
|
+
...super.toJSON(),
|
|
136
|
+
channelID: this.channelID,
|
|
137
|
+
creator: this.creator?.toJSON(),
|
|
138
|
+
description: this.description,
|
|
139
|
+
entityID: this.entityID,
|
|
140
|
+
entityMetadata: this.entityMetadata,
|
|
141
|
+
entityType: this.entityType,
|
|
142
|
+
guildID: this.guildID,
|
|
143
|
+
image: this.image,
|
|
144
|
+
name: this.name,
|
|
145
|
+
privacyLevel: this.privacyLevel,
|
|
146
|
+
scheduledEndTime: this.scheduledEndTime?.getTime() ?? null,
|
|
147
|
+
scheduledStartTime: this.scheduledStartTime.getTime(),
|
|
148
|
+
status: this.status,
|
|
149
|
+
userCount: this.userCount
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.default = GuildScheduledEvent;
|
|
154
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR3VpbGRTY2hlZHVsZWRFdmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9zdHJ1Y3R1cmVzL0d1aWxkU2NoZWR1bGVkRXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsa0NBQWtDO0FBQ2xDLDBEQUEwQjtBQU0xQiwrREFBeUM7QUFHekMsMkNBQStDO0FBRS9DLDBDQUEwQztBQUMxQyxNQUFxQixtQkFBb0IsU0FBUSxjQUFJO0lBQ3pDLGNBQWMsQ0FBdUI7SUFDckMsWUFBWSxDQUFTO0lBQzdCLGtHQUFrRztJQUNsRyxTQUFTLENBQWdCO0lBQ3pCLHlGQUF5RjtJQUN6RixPQUFPLENBQVE7SUFDZixvQ0FBb0M7SU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UFBYSxJQUFJLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRTtZQUMxQyxXQUFXLEVBQVMsSUFBSSxDQUFDLFdBQVc7WUFDcEMsUUFBUSxFQUFZLElBQUksQ0FBQyxRQUFRO1lBQ2pDLGNBQWMsRUFBTSxJQUFJLENBQUMsY0FBYztZQUN2QyxVQUFVLEVBQVUsSUFBSSxDQUFDLFVBQVU7WUFDbkMsT0FBTyxFQUFhLElBQUksQ0FBQyxPQUFPO1lBQ2hDLEtBQUssRUFBZSxJQUFJLENBQUMsS0FBSztZQUM5QixJQUFJLEVBQWdCLElBQUksQ0FBQyxJQUFJO1lBQzdCLFlBQVksRUFBUSxJQUFJLENBQUMsWUFBWTtZQUNyQyxnQkFBZ0IsRUFBSSxJQUFJLENBQUMsZ0JBQWdCLEVBQUUsT0FBTyxFQUFFLElBQUksSUFBSTtZQUM1RCxrQkFBa0IsRUFBRSxJQUFJLENBQUMsa0JBQWtCLENBQUMsT0FBTyxFQUFFO1lBQ3JELE1BQU0sRUFBYyxJQUFJLENBQUMsTUFBTTtZQUMvQixTQUFTLEVBQVcsSUFBSSxDQUFDLFNBQVM7U0FDckMsQ0FBQztJQUNOLENBQUM7Q0FDSjtBQXpKRCxzQ0F5SkMifQ==
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @module GuildTemplate */
|
|
2
|
+
import type Guild from "./Guild";
|
|
3
|
+
import type User from "./User";
|
|
4
|
+
import type Client from "../Client";
|
|
5
|
+
import type { CreateGuildFromTemplateOptions, EditGuildTemplateOptions, RawGuildTemplate } from "../types/guild-template";
|
|
6
|
+
import type { RawGuild } from "../types/guilds";
|
|
7
|
+
import type { JSONGuildTemplate } from "../types/json";
|
|
8
|
+
/** Represents a guild template. */
|
|
9
|
+
export default class GuildTemplate {
|
|
10
|
+
private _cachedSourceGuild?;
|
|
11
|
+
client: Client;
|
|
12
|
+
/** The code of the template. */
|
|
13
|
+
code: string;
|
|
14
|
+
/** When this template was created. */
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
/** The creator of this template. */
|
|
17
|
+
creator: User;
|
|
18
|
+
/** The description of this template. */
|
|
19
|
+
description: string | null;
|
|
20
|
+
/** If this template has unsynced changes. */
|
|
21
|
+
isDirty: boolean | null;
|
|
22
|
+
/** The name of this template. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** A snapshot of the guild. */
|
|
25
|
+
serializedSourceGuild: Partial<RawGuild>;
|
|
26
|
+
/** The ID of the source guild of this template. */
|
|
27
|
+
sourceGuildID: string;
|
|
28
|
+
/** When this template was last updated. */
|
|
29
|
+
updatedAt: Date;
|
|
30
|
+
/** The amount of times this template has been used. */
|
|
31
|
+
usageCount: number;
|
|
32
|
+
constructor(data: RawGuildTemplate, client: Client);
|
|
33
|
+
protected update(data: Partial<RawGuildTemplate>): void;
|
|
34
|
+
/** The source guild of this template. This will throw an error if the guild is not cached. */
|
|
35
|
+
get sourceGuild(): Guild;
|
|
36
|
+
/**
|
|
37
|
+
* Create a guild from this template. This can only be used by bots in less than 10 guilds.
|
|
38
|
+
* @param options The options for creating the guild.
|
|
39
|
+
*/
|
|
40
|
+
createGuild(options: CreateGuildFromTemplateOptions): Promise<Guild>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete this template.
|
|
43
|
+
*/
|
|
44
|
+
delete(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Edit this template.
|
|
47
|
+
* @param options The options for editing the template.
|
|
48
|
+
*/
|
|
49
|
+
editTemplate(options: EditGuildTemplateOptions): Promise<GuildTemplate>;
|
|
50
|
+
/**
|
|
51
|
+
* Sync this template.
|
|
52
|
+
*/
|
|
53
|
+
syncTemplate(): Promise<GuildTemplate>;
|
|
54
|
+
toJSON(): JSONGuildTemplate;
|
|
55
|
+
}
|