seyfert 0.1.0 → 1.0.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/README.md +19 -30
- package/lib/api/CDN.d.ts +0 -8
- package/lib/api/CDN.js +7 -13
- package/lib/api/Router.d.ts +2 -2
- package/lib/api/Router.js +1 -1
- package/lib/api/Routes/applications.d.ts +1 -1
- package/lib/api/Routes/channels.d.ts +1 -1
- package/lib/api/Routes/gateway.d.ts +1 -1
- package/lib/api/Routes/guilds.d.ts +1 -1
- package/lib/api/Routes/interactions.d.ts +1 -1
- package/lib/api/Routes/invites.d.ts +1 -1
- package/lib/api/Routes/stage-instances.d.ts +1 -1
- package/lib/api/Routes/stickers.d.ts +1 -1
- package/lib/api/Routes/users.d.ts +1 -1
- package/lib/api/Routes/voice.d.ts +1 -1
- package/lib/api/Routes/webhooks.d.ts +1 -1
- package/lib/api/api.d.ts +44 -0
- package/lib/api/api.js +354 -0
- package/lib/api/bucket.d.ts +19 -0
- package/lib/api/bucket.js +71 -0
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.js +1 -1
- package/lib/api/shared.d.ts +33 -5
- package/lib/api/shared.js +2 -7
- package/lib/api/utils/constants.d.ts +1 -30
- package/lib/api/utils/constants.js +2 -41
- package/lib/api/utils/types.d.ts +1 -320
- package/lib/api/utils/utils.d.ts +0 -38
- package/lib/api/utils/utils.js +1 -139
- package/lib/builders/ActionRow.js +1 -1
- package/lib/builders/Attachment.d.ts +14 -6
- package/lib/builders/Attachment.js +30 -7
- package/lib/builders/Button.d.ts +5 -14
- package/lib/builders/Button.js +0 -11
- package/lib/builders/{MessageEmbed.d.ts → Embed.d.ts} +15 -15
- package/lib/builders/{MessageEmbed.js → Embed.js} +16 -16
- package/lib/builders/Modal.js +1 -1
- package/lib/builders/SelectMenu.d.ts +14 -15
- package/lib/builders/SelectMenu.js +19 -18
- package/lib/builders/index.d.ts +1 -1
- package/lib/builders/index.js +1 -1
- package/lib/builders/types.d.ts +2 -2
- package/lib/cache/adapters/default.d.ts +1 -0
- package/lib/cache/adapters/default.js +3 -2
- package/lib/cache/adapters/redis.d.ts +3 -3
- package/lib/cache/adapters/redis.js +14 -5
- package/lib/cache/adapters/types.d.ts +1 -0
- package/lib/cache/adapters/workeradapter.d.ts +10 -1
- package/lib/cache/adapters/workeradapter.js +8 -3
- package/lib/cache/index.d.ts +18 -5
- package/lib/cache/index.js +23 -9
- package/lib/cache/resources/channels.d.ts +6 -2
- package/lib/cache/resources/channels.js +12 -6
- package/lib/cache/resources/default/base.d.ts +17 -16
- package/lib/cache/resources/default/base.js +25 -24
- package/lib/cache/resources/default/guild-based.d.ts +22 -19
- package/lib/cache/resources/default/guild-based.js +32 -31
- package/lib/cache/resources/default/guild-related.d.ts +22 -19
- package/lib/cache/resources/default/guild-related.js +37 -43
- package/lib/cache/resources/emojis.d.ts +4 -2
- package/lib/cache/resources/emojis.js +8 -6
- package/lib/cache/resources/guilds.d.ts +4 -2
- package/lib/cache/resources/guilds.js +15 -8
- package/lib/cache/resources/members.d.ts +4 -2
- package/lib/cache/resources/members.js +16 -13
- package/lib/cache/resources/overwrites.d.ts +25 -0
- package/lib/cache/resources/overwrites.js +39 -0
- package/lib/cache/resources/presence.js +3 -4
- package/lib/cache/resources/roles.d.ts +4 -2
- package/lib/cache/resources/roles.js +8 -6
- package/lib/cache/resources/stickers.d.ts +4 -2
- package/lib/cache/resources/stickers.js +8 -6
- package/lib/cache/resources/threads.d.ts +4 -2
- package/lib/cache/resources/threads.js +8 -6
- package/lib/cache/resources/users.d.ts +4 -2
- package/lib/cache/resources/users.js +8 -6
- package/lib/cache/resources/voice-states.d.ts +3 -3
- package/lib/cache/resources/voice-states.js +6 -7
- package/lib/client/base.d.ts +48 -16
- package/lib/client/base.js +19 -15
- package/lib/client/client.d.ts +15 -4
- package/lib/client/client.js +26 -28
- package/lib/client/httpclient.d.ts +3 -5
- package/lib/client/httpclient.js +29 -16
- package/lib/client/{oninteraction.d.ts → oninteractioncreate.d.ts} +1 -1
- package/lib/client/{oninteraction.js → oninteractioncreate.js} +34 -23
- package/lib/client/onmessagecreate.d.ts +3 -0
- package/lib/client/onmessagecreate.js +337 -0
- package/lib/client/workerclient.d.ts +19 -2
- package/lib/client/workerclient.js +156 -46
- package/lib/collection.d.ts +1 -1
- package/lib/collection.js +9 -6
- package/lib/commands/applications/chat.d.ts +32 -25
- package/lib/commands/applications/chat.js +51 -34
- package/lib/commands/applications/chatcontext.d.ts +34 -16
- package/lib/commands/applications/chatcontext.js +99 -20
- package/lib/commands/applications/menu.d.ts +9 -8
- package/lib/commands/applications/menu.js +14 -5
- package/lib/commands/applications/menucontext.d.ts +27 -10
- package/lib/commands/applications/menucontext.js +51 -7
- package/lib/commands/applications/options.d.ts +13 -13
- package/lib/commands/applications/shared.d.ts +7 -2
- package/lib/commands/decorators.d.ts +14 -14
- package/lib/commands/decorators.js +9 -5
- package/lib/commands/handler.d.ts +2 -1
- package/lib/commands/handler.js +60 -14
- package/lib/commands/index.d.ts +1 -1
- package/lib/commands/index.js +2 -1
- package/lib/commands/optionresolver.d.ts +6 -5
- package/lib/commands/optionresolver.js +10 -6
- package/lib/common/bot/watcher.d.ts +3 -3
- package/lib/common/bot/watcher.js +3 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +2 -1
- package/lib/common/it/logger.d.ts +11 -0
- package/lib/common/it/logger.js +51 -2
- package/lib/common/it/utils.d.ts +3 -13
- package/lib/common/it/utils.js +9 -30
- package/lib/common/shorters/channels.d.ts +55 -5
- package/lib/common/shorters/channels.js +59 -0
- package/lib/common/shorters/guilds.d.ts +5 -2
- package/lib/common/shorters/guilds.js +18 -0
- package/lib/common/shorters/messages.js +0 -2
- package/lib/common/shorters/overwrites.d.ts +29 -0
- package/lib/common/shorters/overwrites.js +63 -0
- package/lib/common/shorters/roles.js +3 -3
- package/lib/common/shorters/webhook.d.ts +2 -2
- package/lib/common/types/util.d.ts +3 -2
- package/lib/common/types/write.d.ts +3 -7
- package/lib/components/handler.d.ts +11 -17
- package/lib/components/handler.js +45 -93
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -1
- package/lib/components/listener.d.ts +2 -2
- package/lib/components/listener.js +2 -3
- package/lib/events/event.d.ts +2 -2
- package/lib/events/handler.d.ts +3 -2
- package/lib/events/handler.js +14 -6
- package/lib/events/hooks/dispatch.d.ts +2 -1
- package/lib/events/hooks/dispatch.js +5 -1
- package/lib/events/hooks/thread.d.ts +63 -63
- package/lib/index.d.ts +8 -5
- package/lib/index.js +20 -10
- package/lib/langs/handler.d.ts +6 -4
- package/lib/langs/handler.js +10 -8
- package/lib/langs/router.d.ts +8 -9
- package/lib/langs/router.js +5 -5
- package/lib/structures/ClientUser.d.ts +1 -16
- package/lib/structures/ClientUser.js +0 -31
- package/lib/structures/Guild.d.ts +1 -1
- package/lib/structures/GuildMember.d.ts +12 -0
- package/lib/structures/GuildMember.js +14 -0
- package/lib/structures/GuildRole.d.ts +4 -2
- package/lib/structures/GuildRole.js +4 -1
- package/lib/structures/GuildTemplate.js +1 -1
- package/lib/structures/Interaction.d.ts +2 -0
- package/lib/structures/Interaction.js +12 -13
- package/lib/structures/Message.d.ts +7 -2
- package/lib/structures/Message.js +6 -3
- package/lib/structures/Sticker.d.ts +1 -1
- package/lib/structures/Sticker.js +1 -1
- package/lib/structures/User.d.ts +5 -0
- package/lib/structures/User.js +3 -0
- package/lib/structures/Webhook.d.ts +1 -1
- package/lib/structures/Webhook.js +1 -1
- package/lib/structures/channels.d.ts +45 -6
- package/lib/structures/channels.js +23 -7
- package/lib/structures/extra/BitField.d.ts +9 -6
- package/lib/structures/extra/BitField.js +27 -3
- package/lib/structures/extra/Permissions.d.ts +6 -1
- package/lib/structures/extra/Permissions.js +7 -0
- package/lib/websocket/constants/index.js +1 -3
- package/lib/websocket/discord/basesocket.js +0 -1
- package/lib/websocket/discord/shared.d.ts +2 -0
- package/lib/websocket/discord/worker.d.ts +23 -7
- package/lib/websocket/discord/workermanager.d.ts +32 -5
- package/lib/websocket/discord/workermanager.js +98 -29
- package/package.json +23 -21
- package/lib/api/REST.d.ts +0 -127
- package/lib/api/REST.js +0 -424
- package/lib/api/errors/DiscordAPIError.d.ts +0 -51
- package/lib/api/errors/DiscordAPIError.js +0 -81
- package/lib/api/errors/HTTPError.d.ts +0 -20
- package/lib/api/errors/HTTPError.js +0 -28
- package/lib/api/errors/RateLimitError.d.ts +0 -19
- package/lib/api/errors/RateLimitError.js +0 -37
- package/lib/api/handlers/BurstHandler.d.ts +0 -51
- package/lib/api/handlers/BurstHandler.js +0 -124
- package/lib/api/handlers/SequentialHandler.d.ts +0 -81
- package/lib/api/handlers/SequentialHandler.js +0 -365
- package/lib/api/handlers/Shared.d.ts +0 -14
- package/lib/api/handlers/Shared.js +0 -125
- package/lib/api/interfaces/Handler.d.ts +0 -21
- package/lib/api/interfaces/Handler.js +0 -2
- package/lib/websocket/discord/handlemessage.d.ts +0 -0
- package/lib/websocket/discord/handlemessage.js +0 -1
- package/lib/websocket/discord/memberUpdate.d.ts +0 -16
- package/lib/websocket/discord/memberUpdate.js +0 -47
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Overwrites = void 0;
|
|
4
|
+
const utils_1 = require("../../common/it/utils");
|
|
5
|
+
const Permissions_1 = require("../../structures/extra/Permissions");
|
|
6
|
+
const guild_related_1 = require("./default/guild-related");
|
|
7
|
+
class Overwrites extends guild_related_1.GuildRelatedResource {
|
|
8
|
+
namespace = 'overwrite';
|
|
9
|
+
parse(data, _id, _guild_id) {
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
get(id) {
|
|
13
|
+
return (0, utils_1.fakePromise)(super.get(id)).then(rawOverwrites => rawOverwrites
|
|
14
|
+
? rawOverwrites.map(rawOverwrite => ({
|
|
15
|
+
allow: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.allow)),
|
|
16
|
+
deny: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.deny)),
|
|
17
|
+
id: rawOverwrite.id,
|
|
18
|
+
type: rawOverwrite.type,
|
|
19
|
+
}))
|
|
20
|
+
: undefined);
|
|
21
|
+
}
|
|
22
|
+
values(guild) {
|
|
23
|
+
return (0, utils_1.fakePromise)(super.values(guild)).then(values => values.map(rawOverwrites => rawOverwrites.map(rawOverwrite => ({
|
|
24
|
+
allow: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.allow)),
|
|
25
|
+
deny: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.deny)),
|
|
26
|
+
id: rawOverwrite.id,
|
|
27
|
+
type: rawOverwrite.type,
|
|
28
|
+
}))));
|
|
29
|
+
}
|
|
30
|
+
bulk(ids) {
|
|
31
|
+
return (0, utils_1.fakePromise)(super.bulk(ids)).then(values => values.map(rawOverwrites => rawOverwrites.map(rawOverwrite => ({
|
|
32
|
+
allow: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.allow)),
|
|
33
|
+
deny: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.deny)),
|
|
34
|
+
id: rawOverwrite.id,
|
|
35
|
+
type: rawOverwrite.type,
|
|
36
|
+
}))));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Overwrites = Overwrites;
|
|
@@ -5,10 +5,9 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
5
5
|
class Presences extends guild_related_1.GuildRelatedResource {
|
|
6
6
|
namespace = 'presence';
|
|
7
7
|
parse(data, key, guild_id) {
|
|
8
|
-
super.parse(data, key, guild_id);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return data;
|
|
8
|
+
const { user, ...rest } = super.parse(data, key, guild_id);
|
|
9
|
+
rest.user_id ??= key;
|
|
10
|
+
return rest;
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
exports.Presences = Presences;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ReturnCache } from '../..';
|
|
1
2
|
import { GuildRole } from '../../structures';
|
|
2
3
|
import { GuildRelatedResource } from './default/guild-related';
|
|
3
4
|
export declare class Roles extends GuildRelatedResource {
|
|
4
5
|
namespace: string;
|
|
5
|
-
get(id: string):
|
|
6
|
-
|
|
6
|
+
get(id: string): ReturnCache<GuildRole | undefined>;
|
|
7
|
+
bulk(ids: string[]): ReturnCache<GuildRole[]>;
|
|
8
|
+
values(guild: string): ReturnCache<GuildRole[]>;
|
|
7
9
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Roles = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
4
5
|
const structures_1 = require("../../structures");
|
|
5
6
|
const guild_related_1 = require("./default/guild-related");
|
|
6
7
|
class Roles extends guild_related_1.GuildRelatedResource {
|
|
7
8
|
namespace = 'role';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return rawRole ? new structures_1.GuildRole(this.client, rawRole, rawRole.guild_id) : undefined;
|
|
9
|
+
get(id) {
|
|
10
|
+
return (0, common_1.fakePromise)(super.get(id)).then(rawRole => rawRole ? new structures_1.GuildRole(this.client, rawRole, rawRole.guild_id) : undefined);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
bulk(ids) {
|
|
13
|
+
return (0, common_1.fakePromise)(super.bulk(ids)).then(roles => roles.map(rawRole => new structures_1.GuildRole(this.client, rawRole, rawRole.guild_id)));
|
|
14
|
+
}
|
|
15
|
+
values(guild) {
|
|
16
|
+
return (0, common_1.fakePromise)(super.values(guild)).then(roles => roles.map(rawRole => new structures_1.GuildRole(this.client, rawRole, rawRole.guild_id)));
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
exports.Roles = Roles;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ReturnCache } from '../..';
|
|
1
2
|
import { Sticker } from '../../structures';
|
|
2
3
|
import { GuildRelatedResource } from './default/guild-related';
|
|
3
4
|
export declare class Stickers extends GuildRelatedResource {
|
|
4
5
|
namespace: string;
|
|
5
|
-
get(id: string):
|
|
6
|
-
|
|
6
|
+
get(id: string): ReturnCache<Sticker | undefined>;
|
|
7
|
+
bulk(ids: string[]): ReturnCache<Sticker[]>;
|
|
8
|
+
values(guild: string): ReturnCache<Sticker[]>;
|
|
7
9
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Stickers = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
4
5
|
const structures_1 = require("../../structures");
|
|
5
6
|
const guild_related_1 = require("./default/guild-related");
|
|
6
7
|
class Stickers extends guild_related_1.GuildRelatedResource {
|
|
7
8
|
namespace = 'sticker';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return rawSticker ? new structures_1.Sticker(this.client, rawSticker) : undefined;
|
|
9
|
+
get(id) {
|
|
10
|
+
return (0, common_1.fakePromise)(super.get(id)).then(rawSticker => rawSticker ? new structures_1.Sticker(this.client, rawSticker) : undefined);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
bulk(ids) {
|
|
13
|
+
return (0, common_1.fakePromise)(super.bulk(ids)).then(emojis => emojis.map(rawSticker => new structures_1.Sticker(this.client, rawSticker)));
|
|
14
|
+
}
|
|
15
|
+
values(guild) {
|
|
16
|
+
return (0, common_1.fakePromise)(super.values(guild)).then(emojis => emojis.map(rawSticker => new structures_1.Sticker(this.client, rawSticker)));
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
exports.Stickers = Stickers;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ReturnCache } from '../..';
|
|
1
2
|
import { ThreadChannel } from '../../structures';
|
|
2
3
|
import { GuildRelatedResource } from './default/guild-related';
|
|
3
4
|
export declare class Threads extends GuildRelatedResource {
|
|
4
5
|
namespace: string;
|
|
5
|
-
get(id: string):
|
|
6
|
-
|
|
6
|
+
get(id: string): ReturnCache<ThreadChannel | undefined>;
|
|
7
|
+
bulk(ids: string[]): ReturnCache<ThreadChannel[]>;
|
|
8
|
+
values(guild: string): ReturnCache<ThreadChannel[]>;
|
|
7
9
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Threads = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
4
5
|
const structures_1 = require("../../structures");
|
|
5
6
|
const guild_related_1 = require("./default/guild-related");
|
|
6
7
|
class Threads extends guild_related_1.GuildRelatedResource {
|
|
7
8
|
namespace = 'thread';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return rawThread ? new structures_1.ThreadChannel(this.client, rawThread) : undefined;
|
|
9
|
+
get(id) {
|
|
10
|
+
return (0, common_1.fakePromise)(super.get(id)).then(rawThread => rawThread ? new structures_1.ThreadChannel(this.client, rawThread) : undefined);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
bulk(ids) {
|
|
13
|
+
return (0, common_1.fakePromise)(super.bulk(ids)).then(threads => threads.map(rawThread => new structures_1.ThreadChannel(this.client, rawThread)));
|
|
14
|
+
}
|
|
15
|
+
values(guild) {
|
|
16
|
+
return (0, common_1.fakePromise)(super.values(guild)).then(threads => threads.map(rawThread => new structures_1.ThreadChannel(this.client, rawThread)));
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
exports.Threads = Threads;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ReturnCache } from '../..';
|
|
1
2
|
import { User } from '../../structures';
|
|
2
3
|
import { BaseResource } from './default/base';
|
|
3
4
|
export declare class Users extends BaseResource {
|
|
4
5
|
namespace: string;
|
|
5
|
-
get(id: string):
|
|
6
|
-
|
|
6
|
+
get(id: string): ReturnCache<User | undefined>;
|
|
7
|
+
bulk(ids: string[]): ReturnCache<User[]>;
|
|
8
|
+
values(): ReturnCache<User[]>;
|
|
7
9
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Users = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
4
5
|
const structures_1 = require("../../structures");
|
|
5
6
|
const base_1 = require("./default/base");
|
|
6
7
|
class Users extends base_1.BaseResource {
|
|
7
8
|
namespace = 'user';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return rawUser ? new structures_1.User(this.client, rawUser) : undefined;
|
|
9
|
+
get(id) {
|
|
10
|
+
return (0, common_1.fakePromise)(super.get(id)).then(rawUser => (rawUser ? new structures_1.User(this.client, rawUser) : undefined));
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
bulk(ids) {
|
|
13
|
+
return (0, common_1.fakePromise)(super.bulk(ids)).then(users => users.map(rawUser => new structures_1.User(this.client, rawUser)));
|
|
14
|
+
}
|
|
15
|
+
values() {
|
|
16
|
+
return (0, common_1.fakePromise)(super.values()).then(users => users.map(rawUser => new structures_1.User(this.client, rawUser)));
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
exports.Users = Users;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GatewayVoiceState } from '../../common';
|
|
2
|
-
import {
|
|
3
|
-
export declare class VoiceStates extends
|
|
2
|
+
import { GuildBasedResource } from './default/guild-based';
|
|
3
|
+
export declare class VoiceStates extends GuildBasedResource<VoiceStateResource> {
|
|
4
4
|
namespace: string;
|
|
5
|
-
parse(data: any,
|
|
5
|
+
parse(data: any, id: string, guild_id: string): VoiceStateResource;
|
|
6
6
|
}
|
|
7
7
|
export type VoiceStateResource = Omit<GatewayVoiceState, 'member'> & {
|
|
8
8
|
guild_id: string;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VoiceStates = void 0;
|
|
4
|
-
const
|
|
5
|
-
class VoiceStates extends
|
|
6
|
-
namespace = '
|
|
7
|
-
parse(data,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return data;
|
|
4
|
+
const guild_based_1 = require("./default/guild-based");
|
|
5
|
+
class VoiceStates extends guild_based_1.GuildBasedResource {
|
|
6
|
+
namespace = 'voice_state';
|
|
7
|
+
parse(data, id, guild_id) {
|
|
8
|
+
const { member, ...rest } = super.parse(data, id, guild_id);
|
|
9
|
+
return rest;
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
exports.VoiceStates = VoiceStates;
|
package/lib/client/base.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiHandler } from '../api';
|
|
2
2
|
import type { Adapter } from '../cache';
|
|
3
3
|
import { Cache } from '../cache';
|
|
4
4
|
import type { RegisteredMiddlewares } from '../commands';
|
|
5
|
-
import type {
|
|
5
|
+
import type { MiddlewareContext } from '../commands/applications/shared';
|
|
6
6
|
import { CommandHandler } from '../commands/handler';
|
|
7
|
-
import { Logger, type MakeRequired } from '../common';
|
|
7
|
+
import { Logger, type LocaleString, type MakeRequired } from '../common';
|
|
8
8
|
import type { DeepPartial, IntentStrings, OmitInsert } from '../common/types/util';
|
|
9
9
|
import { ComponentHandler } from '../components/handler';
|
|
10
10
|
import { LangsHandler } from '../langs/handler';
|
|
11
11
|
import type { ChatInputCommandInteraction, MessageCommandInteraction, UserCommandInteraction } from '../structures';
|
|
12
12
|
export declare class BaseClient {
|
|
13
|
-
rest:
|
|
13
|
+
rest: ApiHandler;
|
|
14
14
|
cache: Cache;
|
|
15
15
|
users: {
|
|
16
16
|
createDM: (userId: string, force?: boolean) => Promise<import("../structures").DMChannel>;
|
|
17
17
|
deleteDM: (userId: string, reason?: string | undefined) => Promise<import("../structures").DMChannel>;
|
|
18
18
|
fetch: (userId: string, force?: boolean) => Promise<import("../structures").User>;
|
|
19
|
-
write: (userId: string, body: Omit<import("discord-api-types/rest/v10/channel").RESTPostAPIChannelMessageJSONBody, "
|
|
19
|
+
write: (userId: string, body: Omit<import("discord-api-types/rest/v10/channel").RESTPostAPIChannelMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<import("../structures").Message>;
|
|
20
20
|
};
|
|
21
21
|
channels: {
|
|
22
22
|
fetch: (id: string, force?: boolean | undefined) => Promise<import("../structures").AllChannels>;
|
|
@@ -34,11 +34,38 @@ export declare class BaseClient {
|
|
|
34
34
|
set: (messageId: string, channelId: string, reason?: string | undefined) => Promise<never>;
|
|
35
35
|
delete: (messageId: string, channelId: string, reason?: string | undefined) => Promise<never>;
|
|
36
36
|
};
|
|
37
|
+
overwrites: {
|
|
38
|
+
memberPermissions: (channelId: string, member: import("../structures").GuildMember, checkAdmin?: boolean) => Promise<import("../structures/extra/Permissions").PermissionsBitField>;
|
|
39
|
+
overwritesFor: (channelId: string, member: import("../structures").GuildMember) => Promise<{
|
|
40
|
+
everyone: {
|
|
41
|
+
type: number;
|
|
42
|
+
id: string;
|
|
43
|
+
deny: import("../structures/extra/Permissions").PermissionsBitField;
|
|
44
|
+
allow: import("../structures/extra/Permissions").PermissionsBitField;
|
|
45
|
+
} | undefined;
|
|
46
|
+
roles: {
|
|
47
|
+
type: number;
|
|
48
|
+
id: string;
|
|
49
|
+
deny: import("../structures/extra/Permissions").PermissionsBitField;
|
|
50
|
+
allow: import("../structures/extra/Permissions").PermissionsBitField;
|
|
51
|
+
}[];
|
|
52
|
+
member: {
|
|
53
|
+
type: number;
|
|
54
|
+
id: string;
|
|
55
|
+
deny: import("../structures/extra/Permissions").PermissionsBitField;
|
|
56
|
+
allow: import("../structures/extra/Permissions").PermissionsBitField;
|
|
57
|
+
} | undefined;
|
|
58
|
+
}>;
|
|
59
|
+
rolePermissions: (channelId: string, role: import("../structures").GuildRole, checkAdmin?: boolean) => Promise<import("../structures/extra/Permissions").PermissionsBitField>;
|
|
60
|
+
};
|
|
37
61
|
};
|
|
38
62
|
guilds: {
|
|
39
63
|
create: (body: import("discord-api-types/rest/v10/guild").RESTPostAPIGuildsJSONBody) => Promise<import("../structures").Guild<"api">>;
|
|
40
64
|
fetch: (id: string, force?: boolean) => Promise<import("../structures").Guild<"cached"> | import("../structures").Guild<"api">>;
|
|
41
65
|
widgetURL: (id: string, style?: import("discord-api-types/payloads/v10/guild").GuildWidgetStyle | undefined) => Promise<import("discord-api-types/payloads/v10/guild").APIGuildWidgetSettings>;
|
|
66
|
+
list: (query?: import("discord-api-types/rest/v10/user").RESTGetAPICurrentUserGuildsQuery | undefined) => Promise<import("../structures").AnonymousGuild[]>;
|
|
67
|
+
fetchSelf: (id: string) => Promise<import("../structures").GuildMember>;
|
|
68
|
+
leave: (id: string) => Promise<void | undefined>;
|
|
42
69
|
channels: {
|
|
43
70
|
list: (guildId: string, force?: boolean) => Promise<import("../structures").AllChannels[]>;
|
|
44
71
|
fetch: (guildId: string, channelId: string, force?: boolean | undefined) => Promise<import("../structures").AllChannels>;
|
|
@@ -80,8 +107,8 @@ export declare class BaseClient {
|
|
|
80
107
|
};
|
|
81
108
|
};
|
|
82
109
|
messages: {
|
|
83
|
-
write: (channelId: string, { files, ...body }: Omit<import("discord-api-types/rest/v10/channel").RESTPostAPIChannelMessageJSONBody, "
|
|
84
|
-
edit: (messageId: string, channelId: string, { files, ...body }: Omit<import("discord-api-types/rest/v10/channel").RESTPatchAPIChannelMessageJSONBody, "
|
|
110
|
+
write: (channelId: string, { files, ...body }: Omit<import("discord-api-types/rest/v10/channel").RESTPostAPIChannelMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<import("../structures").Message>;
|
|
111
|
+
edit: (messageId: string, channelId: string, { files, ...body }: Omit<import("discord-api-types/rest/v10/channel").RESTPatchAPIChannelMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps) => Promise<import("../structures").Message>;
|
|
85
112
|
crosspost: (messageId: string, channelId: string, reason?: string | undefined) => Promise<import("../structures").Message>;
|
|
86
113
|
delete: (messageId: string, channelId: string, reason?: string | undefined) => Promise<void>;
|
|
87
114
|
fetch: (messageId: string, channelId: string) => Promise<import("../structures").Message>;
|
|
@@ -120,11 +147,11 @@ export declare class BaseClient {
|
|
|
120
147
|
fetch: (webhookId: string, token?: string | undefined) => Promise<import("../structures").Webhook>;
|
|
121
148
|
messages: {
|
|
122
149
|
write: (webhookId: string, token: string, { body: data, ...payload }: {
|
|
123
|
-
body: Omit<import("discord-api-types/rest/v10/webhook").RESTPostAPIWebhookWithTokenJSONBody, "
|
|
150
|
+
body: Omit<import("discord-api-types/rest/v10/webhook").RESTPostAPIWebhookWithTokenJSONBody, "components" | "embeds"> & import("../common").ResolverProps;
|
|
124
151
|
query?: import("discord-api-types/rest/v10/webhook").RESTPostAPIWebhookWithTokenQuery | undefined;
|
|
125
152
|
}) => Promise<import("../structures").WebhookMessage | null>;
|
|
126
153
|
edit: (webhookId: string, token: string, { messageId, body: data, ...json }: {
|
|
127
|
-
body: Omit<import("discord-api-types/rest/v10/webhook").RESTPatchAPIWebhookWithTokenMessageJSONBody, "
|
|
154
|
+
body: Omit<import("discord-api-types/rest/v10/webhook").RESTPatchAPIWebhookWithTokenMessageJSONBody, "components" | "embeds"> & import("../common").ResolverProps;
|
|
128
155
|
messageId: string;
|
|
129
156
|
query?: import("discord-api-types/rest/v10/webhook").RESTGetAPIWebhookWithTokenMessageQuery | undefined;
|
|
130
157
|
}) => Promise<import("../structures").WebhookMessage>;
|
|
@@ -149,8 +176,8 @@ export declare class BaseClient {
|
|
|
149
176
|
};
|
|
150
177
|
debugger?: Logger;
|
|
151
178
|
logger: Logger;
|
|
152
|
-
commands: CommandHandler;
|
|
153
179
|
langs: LangsHandler;
|
|
180
|
+
commands: CommandHandler;
|
|
154
181
|
components: ComponentHandler;
|
|
155
182
|
private _applicationId?;
|
|
156
183
|
private _botId?;
|
|
@@ -164,15 +191,17 @@ export declare class BaseClient {
|
|
|
164
191
|
set applicationId(id: string);
|
|
165
192
|
get applicationId(): string;
|
|
166
193
|
get proxy(): import("../api").APIRoutes;
|
|
167
|
-
setServices({ rest, cache,
|
|
194
|
+
setServices({ rest, cache, langs, middlewares }: ServicesOptions): void;
|
|
168
195
|
protected execute(..._options: unknown[]): Promise<void>;
|
|
169
196
|
start(options?: Pick<DeepPartial<StartOptions>, 'langsDir' | 'commandsDir' | 'connection' | 'token' | 'componentsDir'>): Promise<void>;
|
|
170
197
|
protected onPacket(..._packet: unknown[]): Promise<void>;
|
|
171
198
|
uploadCommands(applicationId?: string): Promise<void>;
|
|
172
199
|
loadCommands(dir?: string): Promise<void>;
|
|
173
200
|
loadComponents(dir?: string): Promise<void>;
|
|
174
|
-
t(locale: string): DefaultLocale;
|
|
175
201
|
loadLangs(dir?: string): Promise<void>;
|
|
202
|
+
t(locale: string): import("..").__InternalParseLocale<import("../commands").DefaultLocale> & {
|
|
203
|
+
get(locale?: string | undefined): import("../commands").DefaultLocale;
|
|
204
|
+
};
|
|
176
205
|
getRC<T extends InternalRuntimeConfigHTTP | InternalRuntimeConfig = InternalRuntimeConfigHTTP | InternalRuntimeConfig>(): Promise<{
|
|
177
206
|
debug: boolean;
|
|
178
207
|
} & Omit<T, "debug" | "locations"> & {
|
|
@@ -180,9 +209,9 @@ export declare class BaseClient {
|
|
|
180
209
|
langs: string | undefined;
|
|
181
210
|
events: string | undefined;
|
|
182
211
|
components: string | undefined;
|
|
212
|
+
commands: string | undefined;
|
|
183
213
|
base: string;
|
|
184
214
|
output: string;
|
|
185
|
-
commands: string;
|
|
186
215
|
}>;
|
|
187
216
|
}
|
|
188
217
|
export interface BaseClientOptions {
|
|
@@ -208,7 +237,7 @@ interface RC extends Variables {
|
|
|
208
237
|
locations: {
|
|
209
238
|
base: string;
|
|
210
239
|
output: string;
|
|
211
|
-
commands
|
|
240
|
+
commands?: string;
|
|
212
241
|
langs?: string;
|
|
213
242
|
templates?: string;
|
|
214
243
|
events?: string;
|
|
@@ -233,12 +262,15 @@ export type RuntimeConfig = OmitInsert<InternalRuntimeConfig, 'intents', {
|
|
|
233
262
|
intents?: IntentStrings | number;
|
|
234
263
|
}>;
|
|
235
264
|
export type ServicesOptions = {
|
|
236
|
-
rest?:
|
|
265
|
+
rest?: ApiHandler;
|
|
237
266
|
cache?: {
|
|
238
267
|
adapter: Adapter;
|
|
239
268
|
disabledCache?: Cache['disabledCache'];
|
|
240
269
|
};
|
|
241
|
-
|
|
270
|
+
langs?: {
|
|
271
|
+
default?: string;
|
|
272
|
+
aliases?: Record<string, LocaleString[]>;
|
|
273
|
+
};
|
|
242
274
|
middlewares?: Record<string, MiddlewareContext>;
|
|
243
275
|
};
|
|
244
276
|
export {};
|
package/lib/client/base.js
CHANGED
|
@@ -14,8 +14,6 @@ const webhook_1 = require("../common/shorters/webhook");
|
|
|
14
14
|
const handler_2 = require("../components/handler");
|
|
15
15
|
const handler_3 = require("../langs/handler");
|
|
16
16
|
class BaseClient {
|
|
17
|
-
/** @internal */
|
|
18
|
-
__handleGuilds = new Set();
|
|
19
17
|
rest;
|
|
20
18
|
cache;
|
|
21
19
|
users = new common_1.UsersShorter(this).users;
|
|
@@ -30,8 +28,8 @@ class BaseClient {
|
|
|
30
28
|
logger = new common_1.Logger({
|
|
31
29
|
name: '[Seyfert]',
|
|
32
30
|
});
|
|
33
|
-
commands = new handler_1.CommandHandler(this.logger);
|
|
34
31
|
langs = new handler_3.LangsHandler(this.logger);
|
|
32
|
+
commands = new handler_1.CommandHandler(this.logger, this);
|
|
35
33
|
components = new handler_2.ComponentHandler(this.logger, this);
|
|
36
34
|
_applicationId;
|
|
37
35
|
_botId;
|
|
@@ -63,15 +61,18 @@ class BaseClient {
|
|
|
63
61
|
get proxy() {
|
|
64
62
|
return new api_1.Router(this.rest).createProxy();
|
|
65
63
|
}
|
|
66
|
-
setServices({ rest, cache,
|
|
64
|
+
setServices({ rest, cache, langs, middlewares }) {
|
|
67
65
|
if (rest) {
|
|
68
66
|
this.rest = rest;
|
|
69
67
|
}
|
|
70
68
|
if (cache) {
|
|
71
69
|
this.cache = new cache_1.Cache(this.cache?.intents ?? 0, cache.adapter, cache.disabledCache ?? this.cache?.disabledCache, this);
|
|
72
70
|
}
|
|
73
|
-
if (
|
|
74
|
-
|
|
71
|
+
if (langs) {
|
|
72
|
+
if (langs.default)
|
|
73
|
+
this.langs.defaultLang = langs.default;
|
|
74
|
+
if (langs.aliases)
|
|
75
|
+
this.langs.aliases = Object.entries(langs.aliases);
|
|
75
76
|
}
|
|
76
77
|
if (middlewares) {
|
|
77
78
|
this.middlewares = middlewares;
|
|
@@ -99,9 +100,11 @@ class BaseClient {
|
|
|
99
100
|
const token = options?.token ?? tokenRC;
|
|
100
101
|
if (!this.rest) {
|
|
101
102
|
BaseClient.assertString(token, 'token is not a string');
|
|
102
|
-
this.rest = new api_1.
|
|
103
|
+
this.rest = new api_1.ApiHandler({
|
|
103
104
|
token,
|
|
104
|
-
|
|
105
|
+
baseUrl: 'api/v10',
|
|
106
|
+
domain: 'https://discord.com',
|
|
107
|
+
debug: (await this.getRC()).debug,
|
|
105
108
|
});
|
|
106
109
|
}
|
|
107
110
|
if (!this.cache) {
|
|
@@ -139,9 +142,10 @@ class BaseClient {
|
|
|
139
142
|
}
|
|
140
143
|
async loadCommands(dir) {
|
|
141
144
|
dir ??= await this.getRC().then(x => x.commands);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
if (dir) {
|
|
146
|
+
await this.commands.load(dir, this);
|
|
147
|
+
this.logger.info('CommandHandler loaded');
|
|
148
|
+
}
|
|
145
149
|
}
|
|
146
150
|
async loadComponents(dir) {
|
|
147
151
|
dir ??= await this.getRC().then(x => x.components);
|
|
@@ -150,9 +154,6 @@ class BaseClient {
|
|
|
150
154
|
this.logger.info('ComponentHandler loaded');
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
|
-
t(locale) {
|
|
154
|
-
return this.langs.get(locale);
|
|
155
|
-
}
|
|
156
157
|
async loadLangs(dir) {
|
|
157
158
|
dir ??= await this.getRC().then(x => x.langs);
|
|
158
159
|
if (dir) {
|
|
@@ -160,6 +161,9 @@ class BaseClient {
|
|
|
160
161
|
this.logger.info('LangsHandler loaded');
|
|
161
162
|
}
|
|
162
163
|
}
|
|
164
|
+
t(locale) {
|
|
165
|
+
return this.langs.get(locale);
|
|
166
|
+
}
|
|
163
167
|
async getRC() {
|
|
164
168
|
const { locations, debug, ...env } = (await (0, common_1.magicImport)((0, node_path_1.join)(process.cwd(), 'seyfert.config.js')).then(x => x.default ?? x));
|
|
165
169
|
return {
|
|
@@ -169,9 +173,9 @@ class BaseClient {
|
|
|
169
173
|
langs: locations.langs ? (0, node_path_1.join)(process.cwd(), locations.output, locations.langs) : undefined,
|
|
170
174
|
events: 'events' in locations && locations.events ? (0, node_path_1.join)(process.cwd(), locations.output, locations.events) : undefined,
|
|
171
175
|
components: locations.components ? (0, node_path_1.join)(process.cwd(), locations.output, locations.components) : undefined,
|
|
176
|
+
commands: locations.commands ? (0, node_path_1.join)(process.cwd(), locations.output, locations.commands) : undefined,
|
|
172
177
|
base: (0, node_path_1.join)(process.cwd(), locations.base),
|
|
173
178
|
output: (0, node_path_1.join)(process.cwd(), locations.output),
|
|
174
|
-
commands: (0, node_path_1.join)(process.cwd(), locations.output, locations.commands),
|
|
175
179
|
};
|
|
176
180
|
}
|
|
177
181
|
}
|
package/lib/client/client.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Command, CommandContext, Message, SubCommand } from '..';
|
|
2
|
+
import { type DeepPartial, type GatewayDispatchPayload, type GatewayPresenceUpdateData, type If } from '../common';
|
|
2
3
|
import { EventHandler } from '../events';
|
|
3
4
|
import { ClientUser } from '../structures';
|
|
4
|
-
import { ShardManager } from '../websocket';
|
|
5
|
+
import { ShardManager, type ShardManagerOptions } from '../websocket';
|
|
5
6
|
import { MemberUpdateHandler } from '../websocket/discord/events/memberUpdate';
|
|
6
7
|
import { PresenceUpdateHandler } from '../websocket/discord/events/presenceUpdate';
|
|
7
8
|
import type { BaseClientOptions, ServicesOptions, StartOptions } from './base';
|
|
8
9
|
import { BaseClient } from './base';
|
|
9
10
|
export declare class Client<Ready extends boolean = boolean> extends BaseClient {
|
|
11
|
+
private __handleGuilds?;
|
|
10
12
|
gateway: ShardManager;
|
|
11
13
|
events: EventHandler;
|
|
12
14
|
me: If<Ready, ClientUser>;
|
|
@@ -27,6 +29,15 @@ export declare class Client<Ready extends boolean = boolean> extends BaseClient
|
|
|
27
29
|
}
|
|
28
30
|
export interface ClientOptions extends BaseClientOptions {
|
|
29
31
|
presence?: (shardId: number) => GatewayPresenceUpdateData;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
shards?: {
|
|
33
|
+
start: number;
|
|
34
|
+
end: number;
|
|
35
|
+
};
|
|
36
|
+
commands?: {
|
|
37
|
+
prefix: (message: Message) => Promise<string[]> | string[];
|
|
38
|
+
deferReplyResponse?: (ctx: CommandContext) => Parameters<Message['write']>[0];
|
|
39
|
+
reply?: (ctx: CommandContext) => boolean;
|
|
40
|
+
argsParser?: (content: string, command: SubCommand | Command) => Record<string, string>;
|
|
41
|
+
};
|
|
42
|
+
handlePayload?: ShardManagerOptions['handlePayload'];
|
|
32
43
|
}
|