seyfert 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/Routes/guilds.d.ts +12 -1
- package/lib/api/Routes/index.d.ts +3 -1
- package/lib/api/Routes/invites.d.ts +1 -1
- package/lib/api/Routes/oauth2.d.ts +11 -0
- package/lib/api/Routes/oauth2.js +2 -0
- package/lib/api/Routes/skus.d.ts +11 -4
- package/lib/api/Routes/users.d.ts +2 -1
- package/lib/api/Routes/voice.d.ts +4 -0
- package/lib/api/Routes/webhooks.d.ts +1 -1
- package/lib/api/api.d.ts +15 -5
- package/lib/api/api.js +243 -114
- package/lib/api/bucket.js +13 -7
- package/lib/api/shared.d.ts +3 -1
- package/lib/api/utils/constants.d.ts +1 -1
- package/lib/api/utils/constants.js +1 -1
- package/lib/builders/Attachment.d.ts +6 -1
- package/lib/builders/Attachment.js +13 -9
- package/lib/builders/CheckboxGroup.js +1 -1
- package/lib/builders/FileUpload.d.ts +8 -1
- package/lib/builders/FileUpload.js +9 -0
- package/lib/builders/RadioGroup.js +1 -1
- package/lib/client/base.d.ts +3 -3
- package/lib/client/collectors.d.ts +10 -8
- package/lib/client/transformers.d.ts +5 -0
- package/lib/client/workerclient.d.ts +8 -1
- package/lib/client/workerclient.js +28 -9
- package/lib/commands/applications/chat.d.ts +6 -4
- package/lib/commands/applications/options.d.ts +6 -4
- package/lib/commands/applications/shared.d.ts +2 -2
- package/lib/commands/handle.d.ts +7 -3
- package/lib/commands/handle.js +36 -11
- package/lib/commands/handler.js +11 -0
- package/lib/commands/optionresolver.d.ts +6 -7
- package/lib/common/it/error.d.ts +13 -0
- package/lib/common/it/error.js +15 -1
- package/lib/common/it/logger.js +12 -9
- package/lib/common/shorters/application.d.ts +1 -1
- package/lib/common/shorters/application.js +1 -1
- package/lib/common/shorters/bans.js +1 -1
- package/lib/common/shorters/guilds.js +5 -1
- package/lib/common/shorters/interaction.js +7 -4
- package/lib/common/shorters/invites.d.ts +5 -0
- package/lib/common/shorters/members.js +2 -1
- package/lib/common/shorters/messages.js +2 -2
- package/lib/common/shorters/threads.js +1 -1
- package/lib/common/shorters/webhook.js +3 -3
- package/lib/common/types/util.d.ts +7 -0
- package/lib/components/componentcommand.js +2 -2
- package/lib/components/customId.d.ts +3 -0
- package/lib/components/customId.js +11 -0
- package/lib/components/handler.js +2 -3
- package/lib/components/modalcommand.js +2 -2
- package/lib/events/hooks/invite.d.ts +1 -0
- package/lib/events/hooks/presence.d.ts +1 -0
- package/lib/events/hooks/thread.d.ts +1 -0
- package/lib/structures/AnonymousGuild.d.ts +1 -1
- package/lib/structures/AnonymousGuild.js +1 -1
- package/lib/structures/Guild.d.ts +3 -0
- package/lib/structures/GuildMember.d.ts +2 -2
- package/lib/structures/GuildMember.js +22 -4
- package/lib/structures/GuildPreview.d.ts +1 -1
- package/lib/structures/GuildPreview.js +1 -1
- package/lib/structures/GuildRole.d.ts +13 -0
- package/lib/structures/GuildRole.js +21 -0
- package/lib/structures/GuildTemplate.js +1 -1
- package/lib/structures/Interaction.d.ts +7 -7
- package/lib/structures/Interaction.js +35 -21
- package/lib/structures/Message.d.ts +2 -1
- package/lib/structures/channels.d.ts +29 -16
- package/lib/structures/channels.js +59 -19
- package/lib/structures/extra/BaseGuild.d.ts +4 -4
- package/lib/structures/extra/BaseGuild.js +4 -4
- package/lib/types/gateway.d.ts +243 -239
- package/lib/types/index.d.ts +2 -2
- package/lib/types/payloads/_interactions/_applicationCommands/_chatInput/attachment.d.ts +5 -2
- package/lib/types/payloads/_interactions/_applicationCommands/_chatInput/shared.d.ts +2 -2
- package/lib/types/payloads/_interactions/_applicationCommands/_chatInput/shared.js +1 -1
- package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +7 -7
- package/lib/types/payloads/_interactions/_applicationCommands/contextMenu.d.ts +13 -13
- package/lib/types/payloads/_interactions/_applicationCommands/permissions.d.ts +4 -4
- package/lib/types/payloads/_interactions/_applicationCommands/permissions.js +2 -2
- package/lib/types/payloads/_interactions/applicationCommands.d.ts +10 -10
- package/lib/types/payloads/_interactions/applicationCommands.js +4 -4
- package/lib/types/payloads/_interactions/autocomplete.d.ts +2 -2
- package/lib/types/payloads/_interactions/base.d.ts +13 -7
- package/lib/types/payloads/_interactions/modalSubmit.d.ts +4 -4
- package/lib/types/payloads/_interactions/responses.d.ts +10 -10
- package/lib/types/payloads/_interactions/responses.js +2 -2
- package/lib/types/payloads/application.d.ts +21 -15
- package/lib/types/payloads/application.js +7 -7
- package/lib/types/payloads/auditLog.d.ts +22 -17
- package/lib/types/payloads/auditLog.js +7 -2
- package/lib/types/payloads/autoModeration.d.ts +11 -11
- package/lib/types/payloads/autoModeration.js +5 -5
- package/lib/types/payloads/channel.d.ts +87 -78
- package/lib/types/payloads/channel.js +16 -11
- package/lib/types/payloads/components.d.ts +41 -31
- package/lib/types/payloads/components.js +9 -5
- package/lib/types/payloads/emoji.d.ts +2 -2
- package/lib/types/payloads/emoji.js +1 -1
- package/lib/types/payloads/gateway.d.ts +33 -29
- package/lib/types/payloads/gateway.js +5 -5
- package/lib/types/payloads/guild.d.ts +68 -68
- package/lib/types/payloads/guild.js +14 -14
- package/lib/types/payloads/guildScheduledEvent.d.ts +11 -11
- package/lib/types/payloads/guildScheduledEvent.js +3 -3
- package/lib/types/payloads/index.d.ts +2 -2
- package/lib/types/payloads/interactions.d.ts +3 -3
- package/lib/types/payloads/invite.d.ts +11 -11
- package/lib/types/payloads/invite.js +3 -3
- package/lib/types/payloads/monetization.d.ts +4 -4
- package/lib/types/payloads/monetization.js +2 -2
- package/lib/types/payloads/oauth2.d.ts +21 -17
- package/lib/types/payloads/oauth2.js +21 -17
- package/lib/types/payloads/permissions.d.ts +5 -5
- package/lib/types/payloads/permissions.js +2 -2
- package/lib/types/payloads/poll.d.ts +7 -7
- package/lib/types/payloads/poll.js +2 -2
- package/lib/types/payloads/soundboard.d.ts +2 -2
- package/lib/types/payloads/soundboard.js +1 -1
- package/lib/types/payloads/stageInstance.d.ts +5 -5
- package/lib/types/payloads/stageInstance.js +1 -1
- package/lib/types/payloads/sticker.d.ts +8 -8
- package/lib/types/payloads/sticker.js +3 -3
- package/lib/types/payloads/teams.d.ts +8 -8
- package/lib/types/payloads/teams.js +3 -3
- package/lib/types/payloads/template.d.ts +3 -3
- package/lib/types/payloads/template.js +1 -1
- package/lib/types/payloads/user.d.ts +24 -22
- package/lib/types/payloads/user.js +7 -5
- package/lib/types/payloads/voice.d.ts +4 -4
- package/lib/types/payloads/voice.js +1 -1
- package/lib/types/payloads/webhokEvents.d.ts +5 -5
- package/lib/types/payloads/webhokEvents.js +2 -2
- package/lib/types/payloads/webhook.d.ts +4 -4
- package/lib/types/payloads/webhook.js +1 -1
- package/lib/types/rest/application.d.ts +14 -14
- package/lib/types/rest/auditLog.d.ts +1 -1
- package/lib/types/rest/autoModeration.d.ts +7 -7
- package/lib/types/rest/channel.d.ts +79 -74
- package/lib/types/rest/channel.js +1 -1
- package/lib/types/rest/emoji.d.ts +8 -8
- package/lib/types/rest/gateway.d.ts +2 -2
- package/lib/types/rest/guild.d.ts +98 -98
- package/lib/types/rest/guild.js +5 -5
- package/lib/types/rest/guildScheduledEvent.d.ts +11 -11
- package/lib/types/rest/index.d.ts +34 -3
- package/lib/types/rest/index.js +33 -2
- package/lib/types/rest/interactions.d.ts +48 -48
- package/lib/types/rest/invite.d.ts +5 -5
- package/lib/types/rest/monetization.d.ts +9 -9
- package/lib/types/rest/monetization.js +1 -1
- package/lib/types/rest/oauth2.d.ts +22 -18
- package/lib/types/rest/poll.d.ts +4 -4
- package/lib/types/rest/soundboard.d.ts +8 -8
- package/lib/types/rest/stageInstance.d.ts +6 -6
- package/lib/types/rest/sticker.d.ts +10 -10
- package/lib/types/rest/template.d.ts +11 -11
- package/lib/types/rest/user.d.ts +18 -14
- package/lib/types/rest/voice.d.ts +5 -5
- package/lib/types/rest/webhook.d.ts +38 -38
- package/lib/types/utils/index.d.ts +19 -19
- package/lib/types/utils/index.js +19 -19
- package/lib/websocket/SharedTypes.d.ts +2 -2
- package/lib/websocket/constants/index.js +2 -2
- package/lib/websocket/discord/heartbeater.d.ts +1 -0
- package/lib/websocket/discord/heartbeater.js +8 -0
- package/lib/websocket/discord/shard.d.ts +19 -10
- package/lib/websocket/discord/shard.js +254 -121
- package/lib/websocket/discord/sharder.d.ts +2 -2
- package/lib/websocket/discord/sharder.js +1 -1
- package/lib/websocket/discord/shared.d.ts +7 -2
- package/lib/websocket/discord/workermanager.d.ts +3 -1
- package/lib/websocket/discord/workermanager.js +31 -24
- package/package.json +2 -2
|
@@ -94,6 +94,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
94
94
|
title: x.title,
|
|
95
95
|
description: x.description,
|
|
96
96
|
filename: x.filename,
|
|
97
|
+
is_spoiler: x.spoiler,
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
return {
|
|
@@ -103,10 +104,20 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
else if (files?.length) {
|
|
106
|
-
payload.attachments = files
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
payload.attachments = files.map((file, i) => {
|
|
108
|
+
if (file instanceof builders_1.AttachmentBuilder)
|
|
109
|
+
return { id: i.toString(), ...(0, builders_1.resolveAttachment)(file) };
|
|
110
|
+
if (file instanceof builders_1.Attachment) {
|
|
111
|
+
return {
|
|
112
|
+
id: i.toString(),
|
|
113
|
+
title: file.title,
|
|
114
|
+
description: file.description,
|
|
115
|
+
filename: file.filename,
|
|
116
|
+
is_spoiler: file.spoiler,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return { id: i.toString(), filename: file.filename };
|
|
120
|
+
});
|
|
110
121
|
}
|
|
111
122
|
return payload;
|
|
112
123
|
}
|
|
@@ -118,7 +129,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
118
129
|
const data = body.data instanceof builders_1.Modal ? body.data : rest;
|
|
119
130
|
const parsedFiles = files ? await (0, builders_1.resolveFiles)(files) : undefined;
|
|
120
131
|
await (this.replied = this.__reply({
|
|
121
|
-
body: BaseInteraction.transformBodyRequest({ data, type: body.type },
|
|
132
|
+
body: BaseInteraction.transformBodyRequest({ data, type: body.type }, files, this.client),
|
|
122
133
|
files: parsedFiles,
|
|
123
134
|
}).then(() => (this.replied = true)));
|
|
124
135
|
return;
|
|
@@ -353,6 +364,7 @@ class EntryPointInteraction extends ApplicationCommandInteraction {
|
|
|
353
364
|
const response = await this.client.proxy
|
|
354
365
|
.interactions(this.id)(this.token)
|
|
355
366
|
.callback.post({
|
|
367
|
+
auth: false,
|
|
356
368
|
body,
|
|
357
369
|
query: { with_response: true },
|
|
358
370
|
});
|
|
@@ -446,13 +458,15 @@ class MentionableSelectMenuInteraction extends SelectMenuInteraction {
|
|
|
446
458
|
super(client, interaction);
|
|
447
459
|
this.__reply = __reply;
|
|
448
460
|
const resolved = interaction.data.resolved;
|
|
449
|
-
this.roles =
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
this.members =
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
this.users =
|
|
461
|
+
this.roles = this.values
|
|
462
|
+
.filter(x => resolved.roles?.[x])
|
|
463
|
+
.map(x => transformers_1.Transformers.GuildRole(this.client, resolved.roles[x], this.guildId));
|
|
464
|
+
this.members = this.values
|
|
465
|
+
.filter(x => resolved.members?.[x])
|
|
466
|
+
.map(x => transformers_1.Transformers.InteractionGuildMember(this.client, resolved.members[x], resolved.users[x], this.guildId));
|
|
467
|
+
this.users = this.values
|
|
468
|
+
.filter(x => resolved.users?.[x])
|
|
469
|
+
.map(x => transformers_1.Transformers.User(this.client, resolved.users[x]));
|
|
456
470
|
}
|
|
457
471
|
isMentionableSelectMenu() {
|
|
458
472
|
return true;
|
|
@@ -482,9 +496,9 @@ class UserSelectMenuInteraction extends SelectMenuInteraction {
|
|
|
482
496
|
this.__reply = __reply;
|
|
483
497
|
const resolved = interaction.data.resolved;
|
|
484
498
|
this.users = this.values.map(x => transformers_1.Transformers.User(this.client, resolved.users[x]));
|
|
485
|
-
this.members =
|
|
486
|
-
|
|
487
|
-
|
|
499
|
+
this.members = this.values
|
|
500
|
+
.filter(x => resolved.members?.[x])
|
|
501
|
+
.map(x => transformers_1.Transformers.InteractionGuildMember(this.client, resolved.members[x], resolved.users[x], this.guildId));
|
|
488
502
|
}
|
|
489
503
|
isUserSelectMenu() {
|
|
490
504
|
return true;
|
|
@@ -632,14 +646,14 @@ let ModalSubmitInteraction = class ModalSubmitInteraction extends BaseInteractio
|
|
|
632
646
|
return value;
|
|
633
647
|
}
|
|
634
648
|
getFiles(customId, required) {
|
|
635
|
-
const
|
|
636
|
-
if (
|
|
649
|
+
const component = this.getComponent(customId, [types_1.ComponentType.FileUpload]);
|
|
650
|
+
if (component && 'values' in component) {
|
|
637
651
|
const attachments = this.data.resolved?.attachments;
|
|
638
652
|
if (attachments) {
|
|
639
|
-
return
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
653
|
+
return component.values
|
|
654
|
+
.map(x => attachments[x])
|
|
655
|
+
.filter((x) => !!x)
|
|
656
|
+
.map(x => new builders_1.Attachment(this.client, { ...x, proxy_url: x.url }));
|
|
643
657
|
}
|
|
644
658
|
if (required)
|
|
645
659
|
throw new common_1.SeyfertError('INTERNAL_ERROR', {
|
|
@@ -6,13 +6,14 @@ import { type ObjectToLower } from '../common';
|
|
|
6
6
|
import type { EmojiResolvable } from '../common/types/resolvables';
|
|
7
7
|
import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../common/types/write';
|
|
8
8
|
import type { TopLevelComponents } from '../components';
|
|
9
|
-
import type { APIChannelMention, APIEmbed, APIMessage, GatewayMessageCreateDispatchData } from '../types';
|
|
9
|
+
import type { APIChannelMention, APIEmbed, APIMessage, GatewayMessageCreateDispatchData, TextChannelType } from '../types';
|
|
10
10
|
import { DiscordBase } from './extra/DiscordBase';
|
|
11
11
|
import type { MessageWebhookMethodEditParams, MessageWebhookMethodWriteParams } from './Webhook';
|
|
12
12
|
export type MessageData = APIMessage | GatewayMessageCreateDispatchData;
|
|
13
13
|
export interface BaseMessage extends DiscordBase, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll' | 'embeds'>> {
|
|
14
14
|
timestamp?: number;
|
|
15
15
|
guildId?: string;
|
|
16
|
+
channelType?: TextChannelType;
|
|
16
17
|
author: UserStructure;
|
|
17
18
|
member?: GuildMemberStructure;
|
|
18
19
|
components: TopLevelComponents[];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Collection, type
|
|
1
|
+
import { Collection, type ReturnCache } from '..';
|
|
2
2
|
import type { Overwrites } from '../cache/resources/overwrites';
|
|
3
|
-
import { type BaseChannelStructure, type BaseGuildChannelStructure, type CategoryChannelStructure, type DirectoryChannelStructure, type DMChannelStructure, type ForumChannelStructure, type GuildMemberStructure, type GuildStructure, type MediaChannelStructure, type MessageStructure, type NewsChannelStructure, type StageChannelStructure, type TextGuildChannelStructure, type ThreadChannelStructure, type UserStructure, type VoiceChannelStructure, type VoiceStateStructure, type WebhookStructure } from '../client';
|
|
3
|
+
import { type BaseChannelStructure, type BaseGuildChannelStructure, type CategoryChannelStructure, type DirectoryChannelStructure, type DMChannelStructure, type ForumChannelStructure, type GroupDMChannelStructure, type GuildMemberStructure, type GuildStructure, type MediaChannelStructure, type MessageStructure, type NewsChannelStructure, type StageChannelStructure, type TextGuildChannelStructure, type ThreadChannelStructure, type UserStructure, type VoiceChannelStructure, type VoiceStateStructure, type WebhookStructure } from '../client';
|
|
4
4
|
import type { SeyfertChannelMap, UsingClient } from '../commands';
|
|
5
|
-
import { type ChannelShorterOverwriteBody, type CreateInviteFromChannel, type EmojiResolvable, type MessageCreateBodyRequest, type MessageUpdateBodyRequest, type MethodContext, type ObjectToLower, type StringToNumber, type ThreadOnlyCreateBodyRequest, type ToClass } from '../common';
|
|
6
|
-
import { type APIChannelBase, type APIDMChannel, type APIGuildCategoryChannel, type APIGuildChannel, type APIGuildForumChannel, type APIGuildForumDefaultReactionEmoji, type APIGuildForumTag, type APIGuildMediaChannel, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APINewsChannel, type APITextChannel, type APIThreadChannel, ChannelType, type RESTGetAPIChannelMessageReactionUsersQuery, type RESTGetAPIChannelMessagesPinsQuery, type RESTGetAPIChannelMessagesQuery, type RESTPatchAPIChannelJSONBody, type RESTPatchAPIGuildChannelPositionsJSONBody, type RESTPostAPIChannelWebhookJSONBody, type RESTPostAPIGuildChannelJSONBody, type SortOrderType, type ThreadAutoArchiveDuration, VideoQualityMode } from '../types';
|
|
5
|
+
import { type ChannelShorterOverwriteBody, type CreateInviteFromChannel, type EmojiResolvable, type MessageCreateBodyRequest, type MessageUpdateBodyRequest, type MethodContext, type ObjectToLower, type ResolverProps, type StringToNumber, type ThreadOnlyCreateBodyRequest, type ToClass } from '../common';
|
|
6
|
+
import { type APIChannelBase, type APIDMChannel, type APIGuildCategoryChannel, type APIGuildChannel, type APIGuildForumChannel, type APIGuildForumDefaultReactionEmoji, type APIGuildForumTag, type APIGuildMediaChannel, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APIInteractionDataResolvedChannel, type APINewsChannel, type APITextChannel, type APIThreadChannel, ChannelType, type RESTGetAPIChannelMessageReactionUsersQuery, type RESTGetAPIChannelMessagesPinsQuery, type RESTGetAPIChannelMessagesQuery, type RESTPatchAPIChannelJSONBody, type RESTPatchAPIGuildChannelPositionsJSONBody, type RESTPostAPIChannelWebhookJSONBody, type RESTPostAPIGuildChannelJSONBody, type SortOrderType, type ThreadAutoArchiveDuration, VideoQualityMode } from '../types';
|
|
7
7
|
import { DiscordBase } from './extra/DiscordBase';
|
|
8
|
+
import { PermissionsBitField } from './extra/Permissions';
|
|
8
9
|
import type { GuildMember } from './GuildMember';
|
|
9
10
|
import type { GuildRole } from './GuildRole';
|
|
10
11
|
export declare class BaseNoEditableChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
|
|
11
12
|
type: T;
|
|
12
|
-
constructor(client: UsingClient, data: APIChannelBase<ChannelType>);
|
|
13
13
|
static __intent__(id: '@me'): 'DirectMessages';
|
|
14
14
|
static __intent__(id: string): 'DirectMessages' | 'Guilds';
|
|
15
15
|
/** The URL to the channel */
|
|
@@ -156,6 +156,7 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
|
156
156
|
slug?: string | undefined;
|
|
157
157
|
coverImage?: string | undefined;
|
|
158
158
|
flags?: import("../types").ApplicationFlags | undefined;
|
|
159
|
+
flagsNew?: string | undefined;
|
|
159
160
|
approximateGuildCount?: number | undefined;
|
|
160
161
|
approximateUserInstallCount?: number | undefined;
|
|
161
162
|
redirectUris?: string[] | undefined;
|
|
@@ -329,6 +330,7 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
|
329
330
|
slug?: string | undefined;
|
|
330
331
|
coverImage?: string | undefined;
|
|
331
332
|
flags?: import("../types").ApplicationFlags | undefined;
|
|
333
|
+
flagsNew?: string | undefined;
|
|
332
334
|
approximateGuildCount?: number | undefined;
|
|
333
335
|
approximateUserInstallCount?: number | undefined;
|
|
334
336
|
redirectUris?: string[] | undefined;
|
|
@@ -484,6 +486,7 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
|
484
486
|
slug?: string | undefined;
|
|
485
487
|
coverImage?: string | undefined;
|
|
486
488
|
flags?: import("../types").ApplicationFlags | undefined;
|
|
489
|
+
flagsNew?: string | undefined;
|
|
487
490
|
approximateGuildCount?: number | undefined;
|
|
488
491
|
approximateUserInstallCount?: number | undefined;
|
|
489
492
|
redirectUris?: string[] | undefined;
|
|
@@ -563,28 +566,28 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
|
563
566
|
edit: (overwriteId: string, body: ChannelShorterOverwriteBody, reason?: string) => Promise<void>;
|
|
564
567
|
delete: (overwriteId: string, reason?: string) => Promise<void>;
|
|
565
568
|
};
|
|
566
|
-
memberPermissions(member: GuildMember, checkAdmin?: boolean): Promise<
|
|
567
|
-
rolePermissions(role: GuildRole, checkAdmin?: boolean): Promise<
|
|
569
|
+
memberPermissions(member: GuildMember, checkAdmin?: boolean): Promise<PermissionsBitField>;
|
|
570
|
+
rolePermissions(role: GuildRole, checkAdmin?: boolean): Promise<PermissionsBitField>;
|
|
568
571
|
overwritesFor(member: GuildMember): Promise<{
|
|
569
572
|
everyone: {
|
|
570
573
|
type: import("../types").OverwriteType;
|
|
571
574
|
id: string;
|
|
572
|
-
deny:
|
|
573
|
-
allow:
|
|
575
|
+
deny: PermissionsBitField;
|
|
576
|
+
allow: PermissionsBitField;
|
|
574
577
|
guildId: string;
|
|
575
578
|
} | undefined;
|
|
576
579
|
roles: {
|
|
577
580
|
type: import("../types").OverwriteType;
|
|
578
581
|
id: string;
|
|
579
|
-
deny:
|
|
580
|
-
allow:
|
|
582
|
+
deny: PermissionsBitField;
|
|
583
|
+
allow: PermissionsBitField;
|
|
581
584
|
guildId: string;
|
|
582
585
|
}[];
|
|
583
586
|
member: {
|
|
584
587
|
type: import("../types").OverwriteType;
|
|
585
588
|
id: string;
|
|
586
|
-
deny:
|
|
587
|
-
allow:
|
|
589
|
+
deny: PermissionsBitField;
|
|
590
|
+
allow: PermissionsBitField;
|
|
588
591
|
guildId: string;
|
|
589
592
|
} | undefined;
|
|
590
593
|
}>;
|
|
@@ -659,12 +662,13 @@ export declare class MessagesMethods extends DiscordBase {
|
|
|
659
662
|
set: (messageId: string, reason?: string) => Promise<undefined>;
|
|
660
663
|
delete: (messageId: string, reason?: string) => Promise<undefined>;
|
|
661
664
|
};
|
|
662
|
-
static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest, files:
|
|
665
|
+
static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest, files: ResolverProps['files'], self: UsingClient): T;
|
|
663
666
|
}
|
|
664
667
|
export interface TextBaseGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type' | 'permission_overwrites' | 'guild_id'>>, MessagesMethods {
|
|
665
668
|
}
|
|
666
669
|
export declare class TextBaseGuildChannel extends BaseGuildChannel {
|
|
667
670
|
}
|
|
671
|
+
export declare function channelFrom<T extends APIInteractionDataResolvedChannel>(data: T, client: UsingClient): ResolvedChannel<SeyfertChannelMap[T['type'] & keyof SeyfertChannelMap]>;
|
|
668
672
|
export declare function channelFrom(data: APIChannelBase<ChannelType>, client: UsingClient): AllChannels;
|
|
669
673
|
export interface TopicableGuildChannel extends BaseChannel<ChannelType> {
|
|
670
674
|
}
|
|
@@ -788,9 +792,18 @@ export declare class NewsChannel extends BaseGuildChannel {
|
|
|
788
792
|
export declare class DirectoryChannel extends BaseChannel<ChannelType.GuildDirectory> {
|
|
789
793
|
}
|
|
790
794
|
export type AllGuildChannels = TextGuildChannelStructure | VoiceChannelStructure | MediaChannelStructure | ForumChannelStructure | ThreadChannelStructure | CategoryChannelStructure | NewsChannelStructure | DirectoryChannelStructure | StageChannelStructure;
|
|
791
|
-
export type AllTextableChannels = TextGuildChannelStructure | VoiceChannelStructure | DMChannelStructure | NewsChannelStructure | ThreadChannelStructure;
|
|
795
|
+
export type AllTextableChannels = TextGuildChannelStructure | VoiceChannelStructure | DMChannelStructure | GroupDMChannelStructure | NewsChannelStructure | ThreadChannelStructure;
|
|
792
796
|
export type AllGuildTextableChannels = TextGuildChannelStructure | VoiceChannelStructure | NewsChannelStructure | ThreadChannelStructure;
|
|
793
797
|
export type AllGuildVoiceChannels = VoiceChannelStructure | StageChannelStructure;
|
|
794
|
-
export type AllChannels = BaseChannelStructure | BaseGuildChannelStructure | TextGuildChannelStructure | DMChannelStructure | VoiceChannelStructure | MediaChannelStructure | ForumChannelStructure | ThreadChannelStructure | CategoryChannelStructure | NewsChannelStructure | DirectoryChannelStructure | StageChannelStructure;
|
|
798
|
+
export type AllChannels = BaseChannelStructure | BaseGuildChannelStructure | TextGuildChannelStructure | DMChannelStructure | GroupDMChannelStructure | VoiceChannelStructure | MediaChannelStructure | ForumChannelStructure | ThreadChannelStructure | CategoryChannelStructure | NewsChannelStructure | DirectoryChannelStructure | StageChannelStructure;
|
|
799
|
+
export interface ResolvedChannelPermissions {
|
|
800
|
+
/** Computed permissions for the invoking user in the resolved guild channel. */
|
|
801
|
+
permissions: PermissionsBitField;
|
|
802
|
+
/** Computed permissions for the bot user in the resolved guild channel. */
|
|
803
|
+
appPermissions?: PermissionsBitField;
|
|
804
|
+
}
|
|
805
|
+
type WithResolvedChannelPermissions<T extends AllChannels, Permissions extends Partial<ResolvedChannelPermissions>> = T extends AllGuildChannels | BaseGuildChannelStructure ? T & Permissions : T;
|
|
806
|
+
export type ResolvedChannel<T extends AllChannels = SeyfertChannelMap[keyof SeyfertChannelMap]> = WithResolvedChannelPermissions<T, ResolvedChannelPermissions>;
|
|
807
|
+
export type MaybeResolvedChannel<T extends AllChannels = SeyfertChannelMap[keyof SeyfertChannelMap]> = WithResolvedChannelPermissions<T, Partial<ResolvedChannelPermissions>>;
|
|
795
808
|
export type GuildChannelTypes = ChannelType.GuildAnnouncement | ChannelType.GuildVoice | ChannelType.GuildText | ChannelType.GuildStageVoice | ChannelType.GuildForum | ChannelType.GuildMedia | ChannelType.GuildCategory | ChannelType.AnnouncementThread | ChannelType.PrivateThread | ChannelType.PublicThread;
|
|
796
809
|
export {};
|
|
@@ -15,10 +15,8 @@ const common_1 = require("../common");
|
|
|
15
15
|
const mixer_1 = require("../deps/mixer");
|
|
16
16
|
const types_1 = require("../types");
|
|
17
17
|
const DiscordBase_1 = require("./extra/DiscordBase");
|
|
18
|
+
const Permissions_1 = require("./extra/Permissions");
|
|
18
19
|
class BaseNoEditableChannel extends DiscordBase_1.DiscordBase {
|
|
19
|
-
constructor(client, data) {
|
|
20
|
-
super(client, data);
|
|
21
|
-
}
|
|
22
20
|
static __intent__(id) {
|
|
23
21
|
return id === '@me' ? 'DirectMessages' : 'Guilds';
|
|
24
22
|
}
|
|
@@ -224,6 +222,7 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
|
|
|
224
222
|
title: x.title,
|
|
225
223
|
description: x.description,
|
|
226
224
|
filename: x.filename,
|
|
225
|
+
is_spoiler: x.spoiler,
|
|
227
226
|
};
|
|
228
227
|
}
|
|
229
228
|
return {
|
|
@@ -233,10 +232,20 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
|
|
|
233
232
|
}) ?? undefined;
|
|
234
233
|
}
|
|
235
234
|
else if (files?.length) {
|
|
236
|
-
payload.attachments = files
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
payload.attachments = files.map((file, i) => {
|
|
236
|
+
if (file instanceof builders_1.AttachmentBuilder)
|
|
237
|
+
return { id: i.toString(), ...(0, builders_1.resolveAttachment)(file) };
|
|
238
|
+
if (file instanceof builders_1.Attachment) {
|
|
239
|
+
return {
|
|
240
|
+
id: i.toString(),
|
|
241
|
+
title: file.title,
|
|
242
|
+
description: file.description,
|
|
243
|
+
filename: file.filename,
|
|
244
|
+
is_spoiler: file.spoiler,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return { id: i.toString(), filename: file.filename };
|
|
248
|
+
});
|
|
240
249
|
}
|
|
241
250
|
return payload;
|
|
242
251
|
}
|
|
@@ -249,36 +258,67 @@ exports.TextBaseGuildChannel = TextBaseGuildChannel = __decorate([
|
|
|
249
258
|
(0, mixer_1.mix)(MessagesMethods)
|
|
250
259
|
], TextBaseGuildChannel);
|
|
251
260
|
function channelFrom(data, client) {
|
|
261
|
+
let channel;
|
|
252
262
|
switch (data.type) {
|
|
253
263
|
case types_1.ChannelType.GuildStageVoice:
|
|
254
|
-
|
|
264
|
+
channel = client_1.Transformers.StageChannel(client, data);
|
|
265
|
+
break;
|
|
255
266
|
case types_1.ChannelType.GuildMedia:
|
|
256
|
-
|
|
267
|
+
channel = client_1.Transformers.MediaChannel(client, data);
|
|
268
|
+
break;
|
|
257
269
|
case types_1.ChannelType.DM:
|
|
258
|
-
|
|
270
|
+
case types_1.ChannelType.GroupDM:
|
|
271
|
+
channel = client_1.Transformers.DMChannel(client, data);
|
|
272
|
+
break;
|
|
259
273
|
case types_1.ChannelType.GuildForum:
|
|
260
|
-
|
|
274
|
+
channel = client_1.Transformers.ForumChannel(client, data);
|
|
275
|
+
break;
|
|
261
276
|
case types_1.ChannelType.AnnouncementThread:
|
|
262
277
|
case types_1.ChannelType.PrivateThread:
|
|
263
278
|
case types_1.ChannelType.PublicThread:
|
|
264
|
-
|
|
279
|
+
channel = client_1.Transformers.ThreadChannel(client, data);
|
|
280
|
+
break;
|
|
265
281
|
case types_1.ChannelType.GuildDirectory:
|
|
266
|
-
|
|
282
|
+
channel = client_1.Transformers.DirectoryChannel(client, data);
|
|
283
|
+
break;
|
|
267
284
|
case types_1.ChannelType.GuildVoice:
|
|
268
|
-
|
|
285
|
+
channel = client_1.Transformers.VoiceChannel(client, data);
|
|
286
|
+
break;
|
|
269
287
|
case types_1.ChannelType.GuildText:
|
|
270
|
-
|
|
288
|
+
channel = client_1.Transformers.TextGuildChannel(client, data);
|
|
289
|
+
break;
|
|
271
290
|
case types_1.ChannelType.GuildCategory:
|
|
272
|
-
|
|
291
|
+
channel = client_1.Transformers.CategoryChannel(client, data);
|
|
292
|
+
break;
|
|
273
293
|
case types_1.ChannelType.GuildAnnouncement:
|
|
274
|
-
|
|
294
|
+
channel = client_1.Transformers.NewsChannel(client, data);
|
|
295
|
+
break;
|
|
275
296
|
default: {
|
|
276
297
|
if ('guild_id' in data) {
|
|
277
|
-
|
|
298
|
+
channel = client_1.Transformers.BaseGuildChannel(client, data);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
channel = client_1.Transformers.BaseChannel(client, data);
|
|
278
302
|
}
|
|
279
|
-
return client_1.Transformers.BaseChannel(client, data);
|
|
280
303
|
}
|
|
281
304
|
}
|
|
305
|
+
if (channel.type !== types_1.ChannelType.DM &&
|
|
306
|
+
channel.type !== types_1.ChannelType.GroupDM &&
|
|
307
|
+
'permissions' in data &&
|
|
308
|
+
typeof data.permissions === 'string') {
|
|
309
|
+
const appPermissions = 'app_permissions' in data && typeof data.app_permissions === 'string'
|
|
310
|
+
? data.app_permissions
|
|
311
|
+
: 'appPermissions' in data
|
|
312
|
+
? data.appPermissions
|
|
313
|
+
: undefined;
|
|
314
|
+
Object.assign(channel, {
|
|
315
|
+
permissions: new Permissions_1.PermissionsBitField(BigInt(data.permissions)),
|
|
316
|
+
...(typeof appPermissions === 'string'
|
|
317
|
+
? { appPermissions: new Permissions_1.PermissionsBitField(BigInt(appPermissions)) }
|
|
318
|
+
: {}),
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return channel;
|
|
282
322
|
}
|
|
283
323
|
class TopicableGuildChannel extends DiscordBase_1.DiscordBase {
|
|
284
324
|
setTopic(topic, reason) {
|
|
@@ -13,7 +13,7 @@ export declare class BaseGuild extends DiscordBase<APIPartialGuild> {
|
|
|
13
13
|
get partnered(): boolean;
|
|
14
14
|
/**
|
|
15
15
|
* If the guild is verified.
|
|
16
|
-
* @link https://discord.com/developers/
|
|
16
|
+
* @link https://docs.discord.com/developers/resources/guild#guild-object-guild-features
|
|
17
17
|
*/
|
|
18
18
|
get verified(): boolean;
|
|
19
19
|
/**
|
|
@@ -27,19 +27,19 @@ export declare class BaseGuild extends DiscordBase<APIPartialGuild> {
|
|
|
27
27
|
leave(): Promise<void | undefined>;
|
|
28
28
|
/**
|
|
29
29
|
* iconURL gets the current guild icon.
|
|
30
|
-
* @link https://discord.com/developers/
|
|
30
|
+
* @link https://docs.discord.com/developers/reference#image-formatting
|
|
31
31
|
*/
|
|
32
32
|
iconURL(options?: ImageOptions): string | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* splashURL gets the current guild splash as a string.
|
|
35
|
-
* @link https://discord.com/developers/
|
|
35
|
+
* @link https://docs.discord.com/developers/reference#image-formatting
|
|
36
36
|
* @param options - Image options for the splash url.
|
|
37
37
|
* @returns Splash url or void.
|
|
38
38
|
*/
|
|
39
39
|
splashURL(options?: ImageOptions): string | undefined;
|
|
40
40
|
/**
|
|
41
41
|
* bannerURL gets the current guild banner as a string.
|
|
42
|
-
* @link https://discord.com/developers/
|
|
42
|
+
* @link https://docs.discord.com/developers/reference#image-formatting
|
|
43
43
|
* @param options - Image options for the banner url.
|
|
44
44
|
* @returns Banner url or void
|
|
45
45
|
*/
|
|
@@ -16,7 +16,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* If the guild is verified.
|
|
19
|
-
* @link https://discord.com/developers/
|
|
19
|
+
* @link https://docs.discord.com/developers/resources/guild#guild-object-guild-features
|
|
20
20
|
*/
|
|
21
21
|
get verified() {
|
|
22
22
|
if (!this.features) {
|
|
@@ -41,7 +41,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* iconURL gets the current guild icon.
|
|
44
|
-
* @link https://discord.com/developers/
|
|
44
|
+
* @link https://docs.discord.com/developers/reference#image-formatting
|
|
45
45
|
*/
|
|
46
46
|
iconURL(options) {
|
|
47
47
|
if (!this.icon)
|
|
@@ -50,7 +50,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
|
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* splashURL gets the current guild splash as a string.
|
|
53
|
-
* @link https://discord.com/developers/
|
|
53
|
+
* @link https://docs.discord.com/developers/reference#image-formatting
|
|
54
54
|
* @param options - Image options for the splash url.
|
|
55
55
|
* @returns Splash url or void.
|
|
56
56
|
*/
|
|
@@ -61,7 +61,7 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* bannerURL gets the current guild banner as a string.
|
|
64
|
-
* @link https://discord.com/developers/
|
|
64
|
+
* @link https://docs.discord.com/developers/reference#image-formatting
|
|
65
65
|
* @param options - Image options for the banner url.
|
|
66
66
|
* @returns Banner url or void
|
|
67
67
|
*/
|