seyfert 1.1.1 → 1.2.1
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/applications.d.ts +2 -2
- package/lib/api/Routes/channels.d.ts +2 -2
- package/lib/api/Routes/gateway.d.ts +2 -2
- package/lib/api/Routes/guilds.d.ts +2 -1
- package/lib/api/Routes/interactions.d.ts +2 -2
- package/lib/api/Routes/invites.d.ts +2 -2
- package/lib/api/Routes/stage-instances.d.ts +2 -2
- package/lib/api/Routes/stickers.d.ts +2 -2
- package/lib/api/Routes/users.d.ts +2 -2
- package/lib/api/Routes/voice.d.ts +2 -2
- package/lib/api/Routes/webhooks.d.ts +2 -2
- package/lib/builders/ActionRow.d.ts +2 -1
- package/lib/builders/ActionRow.js +3 -3
- package/lib/builders/Base.d.ts +1 -1
- package/lib/builders/Button.d.ts +2 -1
- package/lib/builders/Button.js +2 -2
- package/lib/builders/Embed.d.ts +2 -1
- package/lib/builders/Modal.d.ts +9 -2
- package/lib/builders/Modal.js +12 -3
- package/lib/builders/SelectMenu.d.ts +18 -1
- package/lib/builders/SelectMenu.js +36 -12
- package/lib/builders/index.d.ts +1 -1
- package/lib/builders/index.js +9 -9
- package/lib/builders/types.d.ts +1 -1
- package/lib/cache/index.d.ts +5 -5
- package/lib/cache/index.js +3 -3
- package/lib/cache/resources/default/base.d.ts +1 -1
- package/lib/cache/resources/default/guild-based.d.ts +1 -1
- package/lib/cache/resources/default/guild-related.d.ts +1 -1
- package/lib/cache/resources/presence.d.ts +1 -1
- package/lib/cache/resources/stage-instances.d.ts +1 -1
- package/lib/cache/resources/voice-states.d.ts +1 -1
- package/lib/client/base.d.ts +4 -3
- package/lib/client/client.d.ts +2 -1
- package/lib/client/client.js +2 -2
- package/lib/client/httpclient.d.ts +2 -1
- package/lib/client/httpclient.js +34 -32
- package/lib/client/oninteractioncreate.js +11 -12
- package/lib/client/onmessagecreate.js +2 -3
- package/lib/client/workerclient.d.ts +3 -2
- package/lib/client/workerclient.js +4 -3
- package/lib/commands/applications/chat.d.ts +3 -3
- package/lib/commands/applications/chat.js +4 -3
- package/lib/commands/applications/chatcontext.d.ts +6 -9
- package/lib/commands/applications/chatcontext.js +6 -17
- package/lib/commands/applications/menu.d.ts +2 -1
- package/lib/commands/applications/menucontext.d.ts +6 -10
- package/lib/commands/applications/menucontext.js +9 -22
- package/lib/commands/basecontex.d.ts +15 -0
- package/lib/commands/basecontex.js +34 -0
- package/lib/commands/decorators.d.ts +2 -1
- package/lib/commands/decorators.js +4 -4
- package/lib/commands/handler.js +4 -3
- package/lib/commands/optionresolver.d.ts +3 -3
- package/lib/commands/optionresolver.js +14 -14
- package/lib/common/index.d.ts +0 -1
- package/lib/common/index.js +0 -1
- package/lib/common/it/constants.d.ts +3 -1
- package/lib/common/it/constants.js +2 -0
- package/lib/common/shorters/channels.d.ts +1 -1
- package/lib/common/shorters/channels.js +4 -4
- package/lib/common/shorters/guilds.d.ts +1 -1
- package/lib/common/shorters/guilds.js +6 -1
- package/lib/common/shorters/members.d.ts +6 -1
- package/lib/common/shorters/members.js +25 -2
- package/lib/common/shorters/webhook.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +2 -1
- package/lib/common/types/util.d.ts +1 -1
- package/lib/common/types/write.d.ts +1 -1
- package/lib/components/ActionRow.d.ts +4 -3
- package/lib/components/ActionRow.js +6 -3
- package/lib/components/BaseComponent.d.ts +18 -0
- package/lib/components/BaseComponent.js +21 -0
- package/lib/components/BaseSelectMenuComponent.d.ts +10 -0
- package/lib/components/BaseSelectMenuComponent.js +22 -0
- package/lib/components/ButtonComponent.d.ts +14 -14
- package/lib/components/ButtonComponent.js +36 -25
- package/lib/components/ChannelSelectMenuComponent.d.ts +4 -4
- package/lib/components/ChannelSelectMenuComponent.js +6 -5
- package/lib/components/MentionableSelectMenuComponent.d.ts +3 -2
- package/lib/components/MentionableSelectMenuComponent.js +4 -1
- package/lib/components/RoleSelectMenuComponent.d.ts +3 -2
- package/lib/components/RoleSelectMenuComponent.js +4 -1
- package/lib/components/StringSelectMenuComponent.d.ts +3 -4
- package/lib/components/StringSelectMenuComponent.js +3 -5
- package/lib/components/TextInputComponent.d.ts +10 -5
- package/lib/components/TextInputComponent.js +24 -7
- package/lib/components/UserSelectMenuComponent.d.ts +3 -2
- package/lib/components/UserSelectMenuComponent.js +4 -1
- package/lib/components/command.d.ts +6 -5
- package/lib/components/command.js +4 -0
- package/lib/components/componentcontext.d.ts +113 -0
- package/lib/components/componentcontext.js +135 -0
- package/lib/components/handler.d.ts +3 -3
- package/lib/components/handler.js +9 -4
- package/lib/components/index.d.ts +3 -2
- package/lib/components/index.js +10 -9
- package/lib/events/handler.d.ts +2 -1
- package/lib/events/hooks/application_command.d.ts +2 -2
- package/lib/events/hooks/auto_moderation.d.ts +4 -4
- package/lib/events/hooks/channel.d.ts +1 -1
- package/lib/events/hooks/dispatch.d.ts +1 -1
- package/lib/events/hooks/entitlement.d.ts +4 -4
- package/lib/events/hooks/guild.d.ts +42 -42
- package/lib/events/hooks/integration.d.ts +19 -19
- package/lib/events/hooks/interactions.d.ts +2 -2
- package/lib/events/hooks/invite.d.ts +5 -5
- package/lib/events/hooks/message.d.ts +6 -5
- package/lib/events/hooks/presence.d.ts +7 -7
- package/lib/events/hooks/stage.d.ts +4 -4
- package/lib/events/hooks/thread.d.ts +49 -49
- package/lib/events/hooks/typing.d.ts +2 -2
- package/lib/events/hooks/user.d.ts +1 -1
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +3 -6
- package/lib/index.js +6 -7
- package/lib/langs/handler.d.ts +2 -1
- package/lib/structures/AutoModerationRule.d.ts +3 -2
- package/lib/structures/ClientUser.d.ts +1 -1
- package/lib/structures/Guild.d.ts +27 -27
- package/lib/structures/GuildEmoji.d.ts +2 -1
- package/lib/structures/GuildMember.d.ts +15 -6
- package/lib/structures/GuildMember.js +32 -6
- package/lib/structures/GuildPreview.d.ts +1 -1
- package/lib/structures/GuildRole.d.ts +2 -1
- package/lib/structures/GuildTemplate.d.ts +3 -2
- package/lib/structures/Interaction.d.ts +3 -3
- package/lib/structures/Interaction.js +33 -33
- package/lib/structures/Message.d.ts +5 -4
- package/lib/structures/Sticker.d.ts +2 -1
- package/lib/structures/User.d.ts +6 -3
- package/lib/structures/User.js +2 -1
- package/lib/structures/Webhook.d.ts +63 -4
- package/lib/structures/Webhook.js +53 -0
- package/lib/structures/channels.d.ts +2 -2
- package/lib/structures/extra/BaseGuild.d.ts +2 -1
- package/lib/structures/extra/BaseGuild.js +3 -3
- package/lib/structures/extra/BitField.d.ts +2 -2
- package/lib/structures/extra/BitField.js +2 -2
- package/lib/structures/extra/Permissions.d.ts +1 -1
- package/lib/structures/extra/functions.d.ts +2 -1
- package/lib/structures/extra/functions.js +2 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +17 -0
- package/lib/websocket/SharedTypes.d.ts +2 -1
- package/lib/websocket/SharedTypes.js +1 -0
- package/lib/websocket/discord/shard.d.ts +2 -1
- package/lib/websocket/discord/shard.js +30 -41
- package/lib/websocket/discord/sharder.d.ts +3 -2
- package/lib/websocket/discord/sharder.js +7 -6
- package/lib/websocket/discord/shared.d.ts +2 -1
- package/lib/websocket/discord/worker.d.ts +1 -1
- package/lib/websocket/discord/workermanager.d.ts +3 -2
- package/lib/websocket/discord/workermanager.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Declare = exports.Middlewares = exports.AutoLoad = exports.Options = exports.Group = exports.Groups = exports.GroupsT = exports.LocalesT = exports.Locales = exports.InteractionContextTypes = exports.IntegrationTypes = void 0;
|
|
4
|
-
const
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
5
|
var IntegrationTypes;
|
|
6
6
|
(function (IntegrationTypes) {
|
|
7
7
|
IntegrationTypes[IntegrationTypes["GUILD_INSTALL"] = 0] = "GUILD_INSTALL";
|
|
@@ -76,13 +76,13 @@ function Declare(declare) {
|
|
|
76
76
|
contexts = declare.contexts?.map(i => InteractionContextTypes[i]);
|
|
77
77
|
integration_types = declare.integrationTypes?.map(i => IntegrationTypes[i]);
|
|
78
78
|
default_member_permissions = Array.isArray(declare.defaultMemberPermissions)
|
|
79
|
-
? declare.defaultMemberPermissions?.reduce((acc, prev) => acc |
|
|
79
|
+
? declare.defaultMemberPermissions?.reduce((acc, prev) => acc | v10_1.PermissionFlagsBits[prev], BigInt(0)).toString()
|
|
80
80
|
: declare.defaultMemberPermissions;
|
|
81
81
|
botPermissions = Array.isArray(declare.botPermissions)
|
|
82
|
-
? declare.botPermissions?.reduce((acc, prev) => acc |
|
|
82
|
+
? declare.botPermissions?.reduce((acc, prev) => acc | v10_1.PermissionFlagsBits[prev], BigInt(0))
|
|
83
83
|
: declare.botPermissions;
|
|
84
84
|
description = '';
|
|
85
|
-
type =
|
|
85
|
+
type = v10_1.ApplicationCommandType.ChatInput;
|
|
86
86
|
guild_id;
|
|
87
87
|
constructor(...args) {
|
|
88
88
|
super(...args);
|
package/lib/commands/handler.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandHandler = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
4
5
|
const node_path_1 = require("node:path");
|
|
5
6
|
const common_1 = require("../common");
|
|
6
7
|
const chat_1 = require("./applications/chat");
|
|
@@ -116,7 +117,7 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
116
117
|
command.description_localizations = {};
|
|
117
118
|
for (const locale of Object.keys(client.langs.values)) {
|
|
118
119
|
const locales = this.client.langs.aliases.find(x => x[0] === locale)?.[1] ?? [];
|
|
119
|
-
if (Object.values(
|
|
120
|
+
if (Object.values(v10_1.Locale).includes(locale))
|
|
120
121
|
locales.push(locale);
|
|
121
122
|
if (command.__t.name) {
|
|
122
123
|
for (const i of locales) {
|
|
@@ -141,7 +142,7 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
141
142
|
options.description_localizations = {};
|
|
142
143
|
for (const locale of Object.keys(client.langs.values)) {
|
|
143
144
|
const locales = this.client.langs.aliases.find(x => x[0] === locale)?.[1] ?? [];
|
|
144
|
-
if (Object.values(
|
|
145
|
+
if (Object.values(v10_1.Locale).includes(locale))
|
|
145
146
|
locales.push(locale);
|
|
146
147
|
if (options.locales.name) {
|
|
147
148
|
for (const i of locales) {
|
|
@@ -163,7 +164,7 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
163
164
|
command.groups = {};
|
|
164
165
|
for (const locale of Object.keys(client.langs.values)) {
|
|
165
166
|
const locales = this.client.langs.aliases.find(x => x[0] === locale)?.[1] ?? [];
|
|
166
|
-
if (Object.values(
|
|
167
|
+
if (Object.values(v10_1.Locale).includes(locale))
|
|
167
168
|
locales.push(locale);
|
|
168
169
|
for (const group in command.__tGroups) {
|
|
169
170
|
command.groups[group] ??= {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type APIApplicationCommandInteractionDataOption, type APIAttachment, type APIGuildMember, type APIInteractionDataResolvedChannel, type APIInteractionGuildMember, type APIRole, type APIUser, ApplicationCommandOptionType } from 'discord-api-types/v10';
|
|
1
2
|
import { Attachment, GuildMember } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
import { ApplicationCommandOptionType } from '../common';
|
|
3
|
+
import type { MakeRequired } from '../common';
|
|
4
4
|
import type { AllChannels } from '../structures';
|
|
5
5
|
import { GuildRole, InteractionGuildMember, User } from '../structures';
|
|
6
6
|
import type { Command, CommandAutocompleteOption, SubCommand } from './applications/chat';
|
|
@@ -31,7 +31,7 @@ export declare class OptionResolver {
|
|
|
31
31
|
getGroup(): string | null;
|
|
32
32
|
get(name: string): OptionResolved | undefined;
|
|
33
33
|
getHoisted(name: string): OptionResolved | undefined;
|
|
34
|
-
getValue(name: string): string | number | boolean | Attachment | GuildRole | GuildMember | User | import("..").BaseChannel<import("discord-api-types/
|
|
34
|
+
getValue(name: string): string | number | boolean | Attachment | GuildRole | GuildMember | User | import("..").BaseChannel<import("discord-api-types/v10").ChannelType> | import("..").DMChannel | import("..").CategoryChannel | InteractionGuildMember | undefined;
|
|
35
35
|
private getTypedOption;
|
|
36
36
|
getChannel(name: string, required?: true): AllChannels;
|
|
37
37
|
getString(name: string, required?: true): string;
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.OptionResolver = void 0;
|
|
7
|
+
const v10_1 = require("discord-api-types/v10");
|
|
7
8
|
const __1 = require("..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
9
|
const structures_1 = require("../structures");
|
|
10
10
|
const channels_1 = __importDefault(require("../structures/channels"));
|
|
11
11
|
class OptionResolver {
|
|
@@ -23,11 +23,11 @@ class OptionResolver {
|
|
|
23
23
|
this.guildId = guildId;
|
|
24
24
|
this.resolved = resolved;
|
|
25
25
|
this.hoistedOptions = this.options = options.map(option => this.transformOption(option, resolved));
|
|
26
|
-
if (this.hoistedOptions[0]?.type ===
|
|
26
|
+
if (this.hoistedOptions[0]?.type === v10_1.ApplicationCommandOptionType.Subcommand) {
|
|
27
27
|
this.subCommand = this.hoistedOptions[0].name;
|
|
28
28
|
this.hoistedOptions = this.hoistedOptions[0].options ?? [];
|
|
29
29
|
}
|
|
30
|
-
if (this.hoistedOptions[0]?.type ===
|
|
30
|
+
if (this.hoistedOptions[0]?.type === v10_1.ApplicationCommandOptionType.SubcommandGroup) {
|
|
31
31
|
this.group = this.hoistedOptions[0].name;
|
|
32
32
|
this.subCommand = this.hoistedOptions[0].options[0].name;
|
|
33
33
|
this.hoistedOptions = this.hoistedOptions[0].options[0].options ?? [];
|
|
@@ -69,22 +69,22 @@ class OptionResolver {
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
switch (option.type) {
|
|
72
|
-
case
|
|
72
|
+
case v10_1.ApplicationCommandOptionType.Attachment:
|
|
73
73
|
return option.attachment;
|
|
74
|
-
case
|
|
74
|
+
case v10_1.ApplicationCommandOptionType.Boolean:
|
|
75
75
|
return option.value;
|
|
76
|
-
case
|
|
76
|
+
case v10_1.ApplicationCommandOptionType.Channel:
|
|
77
77
|
return option.channel;
|
|
78
|
-
case
|
|
79
|
-
case
|
|
78
|
+
case v10_1.ApplicationCommandOptionType.Integer:
|
|
79
|
+
case v10_1.ApplicationCommandOptionType.Number:
|
|
80
80
|
return option.value;
|
|
81
|
-
case
|
|
81
|
+
case v10_1.ApplicationCommandOptionType.Role:
|
|
82
82
|
return option.role;
|
|
83
|
-
case
|
|
83
|
+
case v10_1.ApplicationCommandOptionType.String:
|
|
84
84
|
return option.value;
|
|
85
|
-
case
|
|
85
|
+
case v10_1.ApplicationCommandOptionType.User:
|
|
86
86
|
return option.member ?? option.user;
|
|
87
|
-
case
|
|
87
|
+
case v10_1.ApplicationCommandOptionType.Mentionable:
|
|
88
88
|
return option.member ?? option.user ?? option.role;
|
|
89
89
|
default:
|
|
90
90
|
return;
|
|
@@ -101,11 +101,11 @@ class OptionResolver {
|
|
|
101
101
|
return option;
|
|
102
102
|
}
|
|
103
103
|
getChannel(name) {
|
|
104
|
-
const option = this.getTypedOption(name, [
|
|
104
|
+
const option = this.getTypedOption(name, [v10_1.ApplicationCommandOptionType.Channel]);
|
|
105
105
|
return option.channel;
|
|
106
106
|
}
|
|
107
107
|
getString(name) {
|
|
108
|
-
const option = this.getTypedOption(name, [
|
|
108
|
+
const option = this.getTypedOption(name, [v10_1.ApplicationCommandOptionType.String]);
|
|
109
109
|
return option.value;
|
|
110
110
|
}
|
|
111
111
|
transformOption(option, resolved) {
|
package/lib/common/index.d.ts
CHANGED
package/lib/common/index.js
CHANGED
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./it/constants"), exports);
|
|
18
18
|
__exportStar(require("./it/utils"), exports);
|
|
19
19
|
//
|
|
20
|
-
__exportStar(require("discord-api-types/v10"), exports);
|
|
21
20
|
__exportStar(require("./it/colors"), exports);
|
|
22
21
|
__exportStar(require("./it/logger"), exports);
|
|
23
22
|
__exportStar(require("./shorters/channels"), exports);
|
|
@@ -28,7 +28,9 @@ export declare enum EmbedColors {
|
|
|
28
28
|
Blurple = 5793266,
|
|
29
29
|
Greyple = 10070709,
|
|
30
30
|
DarkButNotBlack = 2895667,
|
|
31
|
-
NotQuiteBlack = 2303786
|
|
31
|
+
NotQuiteBlack = 2303786,
|
|
32
|
+
DiscordDark = 3224376,
|
|
33
|
+
DiscordLight = 16382457
|
|
32
34
|
}
|
|
33
35
|
export declare const DiscordEpoch = 1420070400000n;
|
|
34
36
|
export declare const BASE_HOST = "https://discord.com";
|
|
@@ -33,6 +33,8 @@ var EmbedColors;
|
|
|
33
33
|
EmbedColors[EmbedColors["Greyple"] = 10070709] = "Greyple";
|
|
34
34
|
EmbedColors[EmbedColors["DarkButNotBlack"] = 2895667] = "DarkButNotBlack";
|
|
35
35
|
EmbedColors[EmbedColors["NotQuiteBlack"] = 2303786] = "NotQuiteBlack";
|
|
36
|
+
EmbedColors[EmbedColors["DiscordDark"] = 3224376] = "DiscordDark";
|
|
37
|
+
EmbedColors[EmbedColors["DiscordLight"] = 16382457] = "DiscordLight";
|
|
36
38
|
})(EmbedColors || (exports.EmbedColors = EmbedColors = {}));
|
|
37
39
|
exports.DiscordEpoch = 1420070400000n;
|
|
38
40
|
exports.BASE_HOST = 'https://discord.com';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RESTPatchAPIChannelJSONBody } from '
|
|
1
|
+
import { type RESTPatchAPIChannelJSONBody } from 'discord-api-types/v10';
|
|
2
2
|
import { Message, type GuildMember, type GuildRole } from '../../structures';
|
|
3
3
|
import { type AllChannels } from '../../structures/channels';
|
|
4
4
|
import { PermissionsBitField } from '../../structures/extra/Permissions';
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ChannelShorter = void 0;
|
|
7
|
-
const
|
|
7
|
+
const v10_1 = require("discord-api-types/v10");
|
|
8
8
|
const structures_1 = require("../../structures");
|
|
9
9
|
const channels_1 = __importDefault(require("../../structures/channels"));
|
|
10
10
|
const Permissions_1 = require("../../structures/extra/Permissions");
|
|
@@ -86,7 +86,7 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
86
86
|
}
|
|
87
87
|
async memberPermissions(channelId, member, checkAdmin = true) {
|
|
88
88
|
const permissions = await member.fetchPermissions();
|
|
89
|
-
if (checkAdmin && permissions.has(
|
|
89
|
+
if (checkAdmin && permissions.has(v10_1.PermissionFlagsBits.Administrator)) {
|
|
90
90
|
return new Permissions_1.PermissionsBitField(Permissions_1.PermissionsBitField.All);
|
|
91
91
|
}
|
|
92
92
|
const overwrites = await this.overwritesFor(channelId, member);
|
|
@@ -107,7 +107,7 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
107
107
|
if (overwrite.id === member.guildId) {
|
|
108
108
|
everyoneOverwrites = overwrite;
|
|
109
109
|
}
|
|
110
|
-
else if (member.roles.
|
|
110
|
+
else if (member.roles.keys.includes(overwrite.id)) {
|
|
111
111
|
roleOverwrites.push(overwrite);
|
|
112
112
|
}
|
|
113
113
|
else if (overwrite.id === member.id) {
|
|
@@ -121,7 +121,7 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
async rolePermissions(channelId, role, checkAdmin = true) {
|
|
124
|
-
if (checkAdmin && role.permissions.has(
|
|
124
|
+
if (checkAdmin && role.permissions.has(v10_1.PermissionFlagsBits.Administrator)) {
|
|
125
125
|
return new Permissions_1.PermissionsBitField(Permissions_1.PermissionsBitField.All);
|
|
126
126
|
}
|
|
127
127
|
const channelOverwrites = (await this.client.cache.overwrites?.get(channelId)) ?? [];
|
|
@@ -24,7 +24,7 @@ export declare class GuildShorter extends BaseShorter {
|
|
|
24
24
|
*/
|
|
25
25
|
widgetURL(id: string, style?: GuildWidgetStyle): Promise<import("discord-api-types/v10").APIGuildWidgetSettings>;
|
|
26
26
|
list(query?: RESTGetAPICurrentUserGuildsQuery): Promise<AnonymousGuild[]>;
|
|
27
|
-
fetchSelf(id: string): Promise<GuildMember>;
|
|
27
|
+
fetchSelf(id: string, force?: boolean): Promise<GuildMember>;
|
|
28
28
|
leave(id: string): Promise<void | undefined>;
|
|
29
29
|
/**
|
|
30
30
|
* Provides access to channel-related functionality in a guild.
|
|
@@ -54,7 +54,12 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
54
54
|
.guilds.get({ query })
|
|
55
55
|
.then(guilds => guilds.map(guild => new structures_1.AnonymousGuild(this.client, { ...guild, splash: null })));
|
|
56
56
|
}
|
|
57
|
-
async fetchSelf(id) {
|
|
57
|
+
async fetchSelf(id, force = false) {
|
|
58
|
+
if (!force) {
|
|
59
|
+
const self = await this.client.cache.members?.get(this.client.botId, id);
|
|
60
|
+
if (self)
|
|
61
|
+
return self;
|
|
62
|
+
}
|
|
58
63
|
const self = await this.client.proxy.guilds(id).members(this.client.botId).get();
|
|
59
64
|
await this.client.cache.members?.patch(self.user.id, id, self);
|
|
60
65
|
return new structures_1.GuildMember(this.client, self, self.user, id);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersSearchQuery, RESTPatchAPIGuildMemberJSONBody, RESTPutAPIGuildBanJSONBody, RESTPutAPIGuildMemberJSONBody } from 'discord-api-types/v10';
|
|
2
2
|
import { GuildMember } from '../../structures';
|
|
3
|
+
import { PermissionsBitField } from '../../structures/extra/Permissions';
|
|
4
|
+
import type { GuildMemberResolvable } from '../types/resolvables';
|
|
3
5
|
import { BaseShorter } from './base';
|
|
4
6
|
export declare class MemberShorter extends BaseShorter {
|
|
5
7
|
/**
|
|
@@ -86,4 +88,7 @@ export declare class MemberShorter extends BaseShorter {
|
|
|
86
88
|
* @param id The ID of the role to remove.
|
|
87
89
|
*/
|
|
88
90
|
removeRole(guildId: string, memberId: string, id: string): Promise<never>;
|
|
91
|
+
listRoles(guildId: string, memberId: string, force?: boolean): Promise<import("../../structures").GuildRole[]>;
|
|
92
|
+
sortRoles(guildId: string, memberId: string, force?: boolean): Promise<import("../../structures").GuildRole[]>;
|
|
93
|
+
permissions(guildId: string, memberId: string, force?: boolean): Promise<PermissionsBitField>;
|
|
89
94
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MemberShorter = void 0;
|
|
4
|
-
const
|
|
4
|
+
const globals_1 = require("discord-api-types/globals");
|
|
5
5
|
const structures_1 = require("../../structures");
|
|
6
|
+
const Permissions_1 = require("../../structures/extra/Permissions");
|
|
6
7
|
const base_1 = require("./base");
|
|
7
8
|
class MemberShorter extends base_1.BaseShorter {
|
|
8
9
|
/**
|
|
@@ -13,7 +14,7 @@ class MemberShorter extends base_1.BaseShorter {
|
|
|
13
14
|
*/
|
|
14
15
|
async resolve(guildId, resolve) {
|
|
15
16
|
if (typeof resolve === 'string') {
|
|
16
|
-
const match = resolve.match(
|
|
17
|
+
const match = resolve.match(globals_1.FormattingPatterns.User)?.groups;
|
|
17
18
|
if (match?.id) {
|
|
18
19
|
return this.fetch(guildId, match.id);
|
|
19
20
|
}
|
|
@@ -160,5 +161,27 @@ class MemberShorter extends base_1.BaseShorter {
|
|
|
160
161
|
removeRole(guildId, memberId, id) {
|
|
161
162
|
return this.client.proxy.guilds(guildId).members(memberId).roles(id).delete();
|
|
162
163
|
}
|
|
164
|
+
async listRoles(guildId, memberId, force = false) {
|
|
165
|
+
if (!force) {
|
|
166
|
+
const member = await this.client.cache.members?.get(memberId, guildId);
|
|
167
|
+
if (member) {
|
|
168
|
+
const roles = (await this.client.cache.roles?.bulk(member.roles.keys)) ?? [];
|
|
169
|
+
if (roles.length)
|
|
170
|
+
return roles;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const member = await this.client.members.fetch(guildId, memberId, force);
|
|
174
|
+
const allRoles = await this.client.roles.list(guildId, force);
|
|
175
|
+
const rolesId = member.roles.keys.concat(guildId);
|
|
176
|
+
return allRoles.filter(role => rolesId.includes(role.id));
|
|
177
|
+
}
|
|
178
|
+
async sortRoles(guildId, memberId, force = false) {
|
|
179
|
+
const roles = await this.listRoles(guildId, memberId, force);
|
|
180
|
+
return roles.sort((a, b) => b.position - a.position);
|
|
181
|
+
}
|
|
182
|
+
async permissions(guildId, memberId, force = false) {
|
|
183
|
+
const roles = await this.listRoles(guildId, memberId, force);
|
|
184
|
+
return new Permissions_1.PermissionsBitField(roles.map(x => BigInt(x.permissions.bits)));
|
|
185
|
+
}
|
|
163
186
|
}
|
|
164
187
|
exports.MemberShorter = MemberShorter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIChannelWebhookJSONBody } from '
|
|
1
|
+
import type { RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIChannelWebhookJSONBody } from 'discord-api-types/v10';
|
|
2
2
|
import { Webhook, WebhookMessage, type MessageWebhookMethodEditParams, type MessageWebhookMethodWriteParams } from '../../structures';
|
|
3
3
|
import { BaseShorter } from './base';
|
|
4
4
|
export declare class WebhookShorter extends BaseShorter {
|
|
@@ -17,7 +17,7 @@ export declare class WebhookShorter extends BaseShorter {
|
|
|
17
17
|
* @param options The optional parameters including token and reason.
|
|
18
18
|
* @returns A Promise that resolves when the webhook is edited.
|
|
19
19
|
*/
|
|
20
|
-
edit(webhookId: string, body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, options: WebhookShorterOptionalParams): Promise<import("discord-api-types/
|
|
20
|
+
edit(webhookId: string, body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, options: WebhookShorterOptionalParams): Promise<import("discord-api-types/v10").RESTGetAPIWebhookWithTokenResult>;
|
|
21
21
|
/**
|
|
22
22
|
* Fetches a webhook.
|
|
23
23
|
* @param webhookId The ID of the webhook.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { APIPartialEmoji
|
|
1
|
+
import type { APIPartialEmoji } from 'discord-api-types/v10';
|
|
2
|
+
import type { EmbedColors } from '..';
|
|
2
3
|
import type { Attachment, AttachmentDataType, AttachmentResolvable } from '../../builders';
|
|
3
4
|
import type { GuildMember } from '../../structures';
|
|
4
5
|
export type EmojiResolvable = string | Partial<APIPartialEmoji> | `<${string | undefined}:${string}:${string}>`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GatewayIntentBits, PermissionFlagsBits } from '
|
|
1
|
+
import type { GatewayIntentBits, PermissionFlagsBits } from 'discord-api-types/v10';
|
|
2
2
|
export type ToClass<T, This> = new (...args: any[]) => {
|
|
3
3
|
[K in keyof T]: T[K] extends (...args: any[]) => any ? ReturnType<T[K]> extends Promise<T> ? (...args: Parameters<T[K]>) => Promise<This> : ReturnType<T[K]> extends T ? (...args: Parameters<T[K]>) => This : T[K] : T[K];
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { APIActionRowComponent, APIEmbed, APIInteractionResponseCallbackData, APIInteractionResponseChannelMessageWithSource, APIMessageActionRowComponent, APIModalInteractionResponse, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPostAPIChannelMessageJSONBody, RESTPostAPIWebhookWithTokenJSONBody } from '
|
|
1
|
+
import type { APIActionRowComponent, APIEmbed, APIInteractionResponseCallbackData, APIInteractionResponseChannelMessageWithSource, APIMessageActionRowComponent, APIModalInteractionResponse, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPostAPIChannelMessageJSONBody, RESTPostAPIWebhookWithTokenJSONBody } from 'discord-api-types/v10';
|
|
2
2
|
import type { RawFile } from '../../api';
|
|
3
3
|
import type { ActionRow, Attachment, AttachmentBuilder, BuilderComponents, Embed, Modal } from '../../builders';
|
|
4
4
|
import type { OmitInsert } from './util';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { APIMessageActionRowComponent, ComponentType } from '
|
|
2
|
-
import { BaseComponent } from '
|
|
1
|
+
import type { APIMessageActionRowComponent, ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
3
|
import type { ActionRowMessageComponents } from './index';
|
|
4
4
|
export declare class MessageActionRowComponent<T extends ActionRowMessageComponents> extends BaseComponent<ComponentType.ActionRow> {
|
|
5
|
+
private ComponentsFactory;
|
|
5
6
|
constructor(data: {
|
|
6
7
|
type: ComponentType.ActionRow;
|
|
7
8
|
components: APIMessageActionRowComponent[];
|
|
8
9
|
});
|
|
9
|
-
components: T[];
|
|
10
|
+
get components(): T[];
|
|
10
11
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageActionRowComponent = void 0;
|
|
4
|
-
const BaseComponent_1 = require("
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
5
|
const index_1 = require("./index");
|
|
6
6
|
class MessageActionRowComponent extends BaseComponent_1.BaseComponent {
|
|
7
|
+
ComponentsFactory;
|
|
7
8
|
constructor(data) {
|
|
8
9
|
super(data);
|
|
9
|
-
this.
|
|
10
|
+
this.ComponentsFactory = data.components.map(index_1.componentFactory);
|
|
11
|
+
}
|
|
12
|
+
get components() {
|
|
13
|
+
return this.ComponentsFactory;
|
|
10
14
|
}
|
|
11
|
-
components;
|
|
12
15
|
}
|
|
13
16
|
exports.MessageActionRowComponent = MessageActionRowComponent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIButtonComponent, type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APIStringSelectComponent, type APITextInputComponent, type APIUserSelectComponent, ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
export declare class BaseComponent<T extends ComponentType> {
|
|
3
|
+
data: APIComponentsMap[T];
|
|
4
|
+
constructor(data: APIComponentsMap[T]);
|
|
5
|
+
get type(): ComponentType;
|
|
6
|
+
toJSON(): APIComponentsMap[T];
|
|
7
|
+
toBuilder(): import("../builders").BuilderComponents | import("../builders").ActionRow<import("../builders").BuilderComponents>;
|
|
8
|
+
}
|
|
9
|
+
export interface APIComponentsMap {
|
|
10
|
+
[ComponentType.ActionRow]: APIActionRowComponent<APIActionRowComponentTypes>;
|
|
11
|
+
[ComponentType.Button]: APIButtonComponent;
|
|
12
|
+
[ComponentType.ChannelSelect]: APIChannelSelectComponent;
|
|
13
|
+
[ComponentType.MentionableSelect]: APIMentionableSelectComponent;
|
|
14
|
+
[ComponentType.RoleSelect]: APIRoleSelectComponent;
|
|
15
|
+
[ComponentType.StringSelect]: APIStringSelectComponent;
|
|
16
|
+
[ComponentType.UserSelect]: APIUserSelectComponent;
|
|
17
|
+
[ComponentType.TextInput]: APITextInputComponent;
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseComponent = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
|
+
const builders_1 = require("../builders");
|
|
6
|
+
class BaseComponent {
|
|
7
|
+
data;
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
get type() {
|
|
12
|
+
return this.data.type;
|
|
13
|
+
}
|
|
14
|
+
toJSON() {
|
|
15
|
+
return this.data;
|
|
16
|
+
}
|
|
17
|
+
toBuilder() {
|
|
18
|
+
return (0, builders_1.fromComponent)(this.data);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.BaseComponent = BaseComponent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
|
+
export type APISelectMenuComponentTypes = ComponentType.ChannelSelect | ComponentType.MentionableSelect | ComponentType.RoleSelect | ComponentType.StringSelect | ComponentType.UserSelect;
|
|
4
|
+
export declare class BaseSelectMenuComponent<T extends APISelectMenuComponentTypes> extends BaseComponent<T> {
|
|
5
|
+
get customId(): string;
|
|
6
|
+
get disabed(): boolean | undefined;
|
|
7
|
+
get max(): number | undefined;
|
|
8
|
+
get min(): number | undefined;
|
|
9
|
+
get placeholder(): string | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseSelectMenuComponent = void 0;
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
|
+
class BaseSelectMenuComponent extends BaseComponent_1.BaseComponent {
|
|
6
|
+
get customId() {
|
|
7
|
+
return this.data.custom_id;
|
|
8
|
+
}
|
|
9
|
+
get disabed() {
|
|
10
|
+
return this.data.disabled;
|
|
11
|
+
}
|
|
12
|
+
get max() {
|
|
13
|
+
return this.data.max_values;
|
|
14
|
+
}
|
|
15
|
+
get min() {
|
|
16
|
+
return this.data.min_values;
|
|
17
|
+
}
|
|
18
|
+
get placeholder() {
|
|
19
|
+
return this.data.placeholder;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.BaseSelectMenuComponent = BaseSelectMenuComponent;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { BaseComponent } from '
|
|
1
|
+
import type { ButtonStyle, ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { Button, type ButtonStylesForID } from '../builders';
|
|
3
|
+
import { BaseComponent } from './BaseComponent';
|
|
4
4
|
export declare class LinkButtonComponent extends BaseComponent<ComponentType.Button> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
label
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
get style(): ButtonStyle.Link;
|
|
6
|
+
get url(): string;
|
|
7
|
+
get label(): string | undefined;
|
|
8
|
+
get disabled(): boolean | undefined;
|
|
9
|
+
get emoji(): import("discord-api-types/v10").APIMessageComponentEmoji | undefined;
|
|
10
|
+
toBuilder(): Button<false>;
|
|
11
11
|
}
|
|
12
12
|
export type ButtonStyleExludeLink = Exclude<ButtonStyle, ButtonStyle.Link>;
|
|
13
13
|
export declare class ButtonComponent extends BaseComponent<ComponentType.Button> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
emoji
|
|
18
|
-
|
|
14
|
+
get style(): ButtonStylesForID;
|
|
15
|
+
get label(): string | undefined;
|
|
16
|
+
get disabled(): boolean | undefined;
|
|
17
|
+
get emoji(): import("discord-api-types/v10").APIMessageComponentEmoji | undefined;
|
|
18
|
+
toBuilder(): Button<true>;
|
|
19
19
|
}
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ButtonComponent = exports.LinkButtonComponent = void 0;
|
|
4
|
-
const
|
|
5
|
-
const BaseComponent_1 = require("
|
|
4
|
+
const builders_1 = require("../builders");
|
|
5
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
6
6
|
class LinkButtonComponent extends BaseComponent_1.BaseComponent {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
disabled
|
|
18
|
-
|
|
7
|
+
get style() {
|
|
8
|
+
return this.data.style;
|
|
9
|
+
}
|
|
10
|
+
get url() {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
return this.data.url;
|
|
13
|
+
}
|
|
14
|
+
get label() {
|
|
15
|
+
return this.data.label;
|
|
16
|
+
}
|
|
17
|
+
get disabled() {
|
|
18
|
+
return this.data.disabled;
|
|
19
|
+
}
|
|
20
|
+
get emoji() {
|
|
21
|
+
return this.data.emoji;
|
|
22
|
+
}
|
|
23
|
+
toBuilder() {
|
|
24
|
+
return new builders_1.Button(this.data);
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
exports.LinkButtonComponent = LinkButtonComponent;
|
|
21
28
|
class ButtonComponent extends BaseComponent_1.BaseComponent {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
emoji
|
|
32
|
-
|
|
29
|
+
get style() {
|
|
30
|
+
return this.data.style;
|
|
31
|
+
}
|
|
32
|
+
get label() {
|
|
33
|
+
return this.data.label;
|
|
34
|
+
}
|
|
35
|
+
get disabled() {
|
|
36
|
+
return this.data.disabled;
|
|
37
|
+
}
|
|
38
|
+
get emoji() {
|
|
39
|
+
return this.data.emoji;
|
|
40
|
+
}
|
|
41
|
+
toBuilder() {
|
|
42
|
+
return new builders_1.Button(this.data);
|
|
43
|
+
}
|
|
33
44
|
}
|
|
34
45
|
exports.ButtonComponent = ButtonComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { BaseSelectMenuComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseSelectMenuComponent } from './BaseSelectMenuComponent';
|
|
3
3
|
export declare class ChannelSelectMenuComponent extends BaseSelectMenuComponent<ComponentType.ChannelSelect> {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
get channelsTypes(): import("discord-api-types/v10").ChannelType[] | undefined;
|
|
5
|
+
get defaultValues(): import("discord-api-types/v10").APISelectMenuDefaultValue<import("discord-api-types/v10").SelectMenuDefaultValueType.Channel>[] | undefined;
|
|
6
6
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChannelSelectMenuComponent = void 0;
|
|
4
|
-
const BaseSelectMenuComponent_1 = require("
|
|
4
|
+
const BaseSelectMenuComponent_1 = require("./BaseSelectMenuComponent");
|
|
5
5
|
class ChannelSelectMenuComponent extends BaseSelectMenuComponent_1.BaseSelectMenuComponent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
get channelsTypes() {
|
|
7
|
+
return this.data.channel_types;
|
|
8
|
+
}
|
|
9
|
+
get defaultValues() {
|
|
10
|
+
return this.data.default_values;
|
|
9
11
|
}
|
|
10
|
-
channelTypes;
|
|
11
12
|
}
|
|
12
13
|
exports.ChannelSelectMenuComponent = ChannelSelectMenuComponent;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from '
|
|
2
|
-
import { BaseSelectMenuComponent } from '
|
|
1
|
+
import type { ComponentType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseSelectMenuComponent } from './BaseSelectMenuComponent';
|
|
3
3
|
export declare class MentionableSelectMenuComponent extends BaseSelectMenuComponent<ComponentType.MentionableSelect> {
|
|
4
|
+
get defaultValues(): import("discord-api-types/v10").APISelectMenuDefaultValue<import("discord-api-types/v10").SelectMenuDefaultValueType.Role | import("discord-api-types/v10").SelectMenuDefaultValueType.User>[] | undefined;
|
|
4
5
|
}
|