seyfert 4.4.1 → 5.0.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/README.md +7 -1
- package/lib/api/Routes/cdn.d.ts +2 -2
- package/lib/api/Routes/guilds.d.ts +2 -2
- package/lib/api/Routes/invites.d.ts +2 -2
- package/lib/api/api.d.ts +20 -8
- package/lib/api/api.js +198 -44
- package/lib/api/shared.d.ts +30 -1
- package/lib/api/utils/constants.d.ts +1 -1
- package/lib/api/utils/constants.js +1 -1
- package/lib/api/utils/utils.d.ts +2 -1
- package/lib/api/utils/utils.js +1 -1
- package/lib/builders/Attachment.d.ts +1 -1
- package/lib/builders/Attachment.js +30 -8
- package/lib/builders/MediaGallery.d.ts +2 -2
- package/lib/builders/MediaGallery.js +10 -0
- package/lib/builders/Modal.d.ts +18 -8
- package/lib/builders/Modal.js +36 -7
- package/lib/builders/Poll.js +18 -0
- package/lib/builders/RadioGroup.d.ts +4 -3
- package/lib/builders/RadioGroup.js +24 -3
- package/lib/builders/SelectMenu.d.ts +8 -6
- package/lib/builders/SelectMenu.js +24 -3
- package/lib/builders/types.d.ts +3 -2
- package/lib/cache/adapters/default.d.ts +1 -1
- package/lib/cache/adapters/default.js +23 -26
- package/lib/cache/adapters/limited.d.ts +1 -0
- package/lib/cache/adapters/limited.js +47 -33
- package/lib/cache/index.d.ts +19 -25
- package/lib/cache/index.js +58 -6
- package/lib/cache/resources/bans.d.ts +1 -1
- package/lib/cache/resources/bans.js +4 -4
- package/lib/cache/resources/channels.d.ts +1 -1
- package/lib/cache/resources/channels.js +4 -4
- package/lib/cache/resources/default/base.d.ts +1 -1
- package/lib/cache/resources/default/base.js +8 -8
- package/lib/cache/resources/default/guild-based.d.ts +5 -5
- package/lib/cache/resources/default/guild-based.js +29 -16
- package/lib/cache/resources/default/guild-related.d.ts +5 -5
- package/lib/cache/resources/default/guild-related.js +14 -14
- package/lib/cache/resources/emojis.d.ts +1 -1
- package/lib/cache/resources/emojis.js +4 -4
- package/lib/cache/resources/guilds.js +28 -15
- package/lib/cache/resources/members.d.ts +1 -1
- package/lib/cache/resources/members.js +6 -6
- package/lib/cache/resources/messages.d.ts +7 -2
- package/lib/cache/resources/messages.js +43 -20
- package/lib/cache/resources/overwrites.d.ts +1 -1
- package/lib/cache/resources/overwrites.js +5 -8
- package/lib/cache/resources/roles.d.ts +1 -1
- package/lib/cache/resources/roles.js +4 -4
- package/lib/cache/resources/stickers.d.ts +1 -1
- package/lib/cache/resources/stickers.js +4 -4
- package/lib/cache/resources/users.js +4 -4
- package/lib/cache/resources/voice-states.d.ts +1 -1
- package/lib/cache/resources/voice-states.js +4 -4
- package/lib/client/base.d.ts +83 -24
- package/lib/client/base.js +594 -39
- package/lib/client/client.d.ts +29 -4
- package/lib/client/client.js +38 -13
- package/lib/client/collectors.d.ts +9 -8
- package/lib/client/collectors.js +19 -52
- package/lib/client/httpclient.d.ts +3 -0
- package/lib/client/index.d.ts +3 -1
- package/lib/client/index.js +4 -0
- package/lib/client/intents.d.ts +3 -0
- package/lib/client/intents.js +9 -0
- package/lib/client/plugins/api.d.ts +4 -0
- package/lib/client/plugins/api.js +550 -0
- package/lib/client/plugins/errors.d.ts +25 -0
- package/lib/client/plugins/errors.js +79 -0
- package/lib/client/plugins/order.d.ts +10 -0
- package/lib/client/plugins/order.js +32 -0
- package/lib/client/plugins/registry.d.ts +273 -0
- package/lib/client/plugins/registry.js +868 -0
- package/lib/client/plugins/shared.d.ts +23 -0
- package/lib/client/plugins/shared.js +193 -0
- package/lib/client/plugins/types.d.ts +398 -0
- package/lib/client/plugins/types.js +8 -0
- package/lib/client/plugins.d.ts +78 -0
- package/lib/client/plugins.js +558 -0
- package/lib/client/transformers.d.ts +33 -33
- package/lib/client/workerclient.d.ts +11 -2
- package/lib/client/workerclient.js +33 -22
- package/lib/collection.d.ts +10 -8
- package/lib/collection.js +19 -25
- package/lib/commands/applications/chat.d.ts +20 -18
- package/lib/commands/applications/chat.js +39 -14
- package/lib/commands/applications/chatcontext.d.ts +23 -15
- package/lib/commands/applications/chatcontext.js +23 -2
- package/lib/commands/applications/entryPoint.d.ts +4 -3
- package/lib/commands/applications/entryPoint.js +1 -1
- package/lib/commands/applications/entrycontext.d.ts +7 -9
- package/lib/commands/applications/entrycontext.js +3 -1
- package/lib/commands/applications/menu.d.ts +4 -3
- package/lib/commands/applications/menucontext.d.ts +7 -9
- package/lib/commands/applications/menucontext.js +3 -1
- package/lib/commands/applications/options.d.ts +23 -23
- package/lib/commands/applications/shared.d.ts +39 -17
- package/lib/commands/decorators.d.ts +50 -38
- package/lib/commands/decorators.js +15 -5
- package/lib/commands/handle.d.ts +19 -8
- package/lib/commands/handle.js +224 -143
- package/lib/commands/handler.d.ts +21 -8
- package/lib/commands/handler.js +157 -69
- package/lib/commands/index.d.ts +1 -0
- package/lib/commands/optionresolver.d.ts +2 -2
- package/lib/common/it/colors.js +12 -2
- package/lib/common/it/error.d.ts +9 -0
- package/lib/common/it/error.js +8 -0
- package/lib/common/it/fake-promise.d.ts +4 -0
- package/lib/common/it/fake-promise.js +10 -0
- package/lib/common/it/formatter.d.ts +14 -11
- package/lib/common/it/formatter.js +4 -3
- package/lib/common/it/logger.d.ts +7 -1
- package/lib/common/it/logger.js +24 -6
- package/lib/common/it/utils.d.ts +6 -8
- package/lib/common/it/utils.js +44 -42
- package/lib/common/shorters/application.d.ts +3 -3
- package/lib/common/shorters/application.js +3 -2
- package/lib/common/shorters/bans.d.ts +8 -4
- package/lib/common/shorters/bans.js +13 -5
- package/lib/common/shorters/channels.d.ts +4 -4
- package/lib/common/shorters/channels.js +4 -4
- package/lib/common/shorters/emojis.js +1 -0
- package/lib/common/shorters/guilds.d.ts +8 -8
- package/lib/common/shorters/guilds.js +14 -31
- package/lib/common/shorters/interaction.d.ts +1 -1
- package/lib/common/shorters/invites.d.ts +201 -201
- package/lib/common/shorters/members.d.ts +7 -7
- package/lib/common/shorters/members.js +13 -14
- package/lib/common/shorters/messages.d.ts +2 -2
- package/lib/common/shorters/soundboard.d.ts +5 -5
- package/lib/common/shorters/users.d.ts +1 -1
- package/lib/common/shorters/webhook.d.ts +3 -2
- package/lib/common/shorters/webhook.js +0 -7
- package/lib/common/types/options.d.ts +4 -0
- package/lib/common/types/util.d.ts +8 -0
- package/lib/common/types/write.d.ts +2 -1
- package/lib/components/BaseSelectMenuComponent.d.ts +1 -1
- package/lib/components/BaseSelectMenuComponent.js +1 -1
- package/lib/components/ButtonComponent.d.ts +3 -3
- package/lib/components/ChannelSelectMenuComponent.d.ts +2 -2
- package/lib/components/File.d.ts +1 -1
- package/lib/components/MediaGallery.d.ts +1 -1
- package/lib/components/MentionableSelectMenuComponent.d.ts +1 -1
- package/lib/components/RoleSelectMenuComponent.d.ts +1 -1
- package/lib/components/Separator.d.ts +1 -1
- package/lib/components/StringSelectMenuComponent.d.ts +1 -1
- package/lib/components/TextInputComponent.d.ts +1 -1
- package/lib/components/Thumbnail.d.ts +1 -1
- package/lib/components/UserSelectMenuComponent.d.ts +1 -1
- package/lib/components/componentcommand.d.ts +8 -7
- package/lib/components/componentcontext.d.ts +24 -36
- package/lib/components/componentcontext.js +7 -17
- package/lib/components/handler.d.ts +17 -7
- package/lib/components/handler.js +108 -49
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/interactioncontext.d.ts +45 -0
- package/lib/components/interactioncontext.js +93 -0
- package/lib/components/modalcommand.d.ts +5 -4
- package/lib/components/modalcontext.d.ts +39 -20
- package/lib/components/modalcontext.js +59 -6
- package/lib/events/event.d.ts +9 -3
- package/lib/events/handler.d.ts +51 -6
- package/lib/events/handler.js +165 -36
- package/lib/events/hooks/application_command.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.d.ts +2 -2
- package/lib/events/hooks/guild.d.ts +150 -150
- package/lib/events/hooks/interactions.d.ts +1 -1
- package/lib/events/hooks/invite.d.ts +20 -20
- package/lib/events/hooks/message.d.ts +27 -27
- package/lib/events/hooks/presence.d.ts +11 -11
- package/lib/events/hooks/soundboard.d.ts +6 -6
- package/lib/events/hooks/stage.d.ts +2 -2
- package/lib/events/hooks/subscriptions.d.ts +3 -3
- package/lib/events/hooks/thread.d.ts +30 -30
- package/lib/events/hooks/voice.d.ts +3 -4
- package/lib/events/hooks/voice.js +2 -1
- package/lib/events/utils.d.ts +4 -0
- package/lib/events/utils.js +59 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +14 -8
- package/lib/langs/handler.d.ts +14 -11
- package/lib/langs/handler.js +46 -9
- package/lib/langs/router.d.ts +10 -3
- package/lib/structures/Application.d.ts +1 -1
- package/lib/structures/Emoji.d.ts +3 -3
- package/lib/structures/Emoji.js +2 -2
- package/lib/structures/Guild.d.ts +154 -154
- package/lib/structures/GuildBan.d.ts +4 -4
- package/lib/structures/GuildBan.js +3 -3
- package/lib/structures/GuildMember.d.ts +7 -7
- package/lib/structures/GuildMember.js +28 -7
- package/lib/structures/GuildRole.d.ts +1 -1
- package/lib/structures/GuildRole.js +2 -2
- package/lib/structures/Interaction.d.ts +11 -9
- package/lib/structures/Interaction.js +33 -12
- package/lib/structures/Message.d.ts +21 -14
- package/lib/structures/Message.js +29 -14
- package/lib/structures/User.d.ts +1 -1
- package/lib/structures/VoiceState.d.ts +4 -0
- package/lib/structures/VoiceState.js +13 -1
- package/lib/structures/Webhook.d.ts +9 -1
- package/lib/structures/Webhook.js +4 -1
- package/lib/structures/channels.d.ts +148 -134
- package/lib/structures/channels.js +27 -26
- package/lib/structures/extra/BitField.d.ts +4 -4
- package/lib/structures/extra/BitField.js +20 -4
- package/lib/structures/extra/DiscordBase.js +1 -1
- package/lib/structures/extra/Permissions.d.ts +2 -4
- package/lib/structures/extra/Permissions.js +1 -17
- package/lib/types/payloads/_interactions/responses.d.ts +2 -2
- package/lib/types/payloads/components.d.ts +4 -4
- package/lib/websocket/SharedTypes.d.ts +4 -4
- package/lib/websocket/constants/index.d.ts +1 -1
- package/lib/websocket/constants/index.js +3 -2
- package/lib/websocket/discord/events/memberUpdate.js +2 -2
- package/lib/websocket/discord/heartbeater.d.ts +1 -0
- package/lib/websocket/discord/heartbeater.js +7 -0
- package/lib/websocket/discord/shard.d.ts +2 -2
- package/lib/websocket/discord/shard.js +16 -14
- package/lib/websocket/discord/sharder.d.ts +8 -7
- package/lib/websocket/discord/sharder.js +26 -6
- package/lib/websocket/discord/shared.d.ts +19 -6
- package/lib/websocket/discord/socket/custom.js +5 -0
- package/lib/websocket/discord/worker.d.ts +1 -0
- package/lib/websocket/discord/worker.js +2 -0
- package/lib/websocket/discord/workermanager.d.ts +25 -11
- package/lib/websocket/discord/workermanager.js +41 -10
- package/package.json +13 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuildRelatedResource = void 0;
|
|
4
|
-
const
|
|
4
|
+
const fake_promise_1 = require("../../../common/it/fake-promise");
|
|
5
5
|
class GuildRelatedResource {
|
|
6
6
|
cache;
|
|
7
7
|
client;
|
|
@@ -38,41 +38,41 @@ class GuildRelatedResource {
|
|
|
38
38
|
return this.adapter.get(this.hashId(id));
|
|
39
39
|
}
|
|
40
40
|
bulk(ids) {
|
|
41
|
-
return (0,
|
|
41
|
+
return (0, fake_promise_1.fakePromise)(this.adapter.bulkGet(ids.map(x => this.hashId(x)))).then(x => x.filter(y => y));
|
|
42
42
|
}
|
|
43
43
|
set(from, __keys, guild, data) {
|
|
44
44
|
const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild, from));
|
|
45
45
|
if (!keys.length)
|
|
46
|
-
return (0,
|
|
47
|
-
return (0,
|
|
46
|
+
return (0, fake_promise_1.fakePromise)(undefined).then(() => { });
|
|
47
|
+
return (0, fake_promise_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkSet(keys.map(([key, value]) => {
|
|
48
48
|
return [this.hashId(key), this.parse(value, key, guild)];
|
|
49
49
|
})));
|
|
50
50
|
}
|
|
51
51
|
patch(from, __keys, guild, data) {
|
|
52
52
|
const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild, from));
|
|
53
53
|
if (!keys.length)
|
|
54
|
-
return (0,
|
|
55
|
-
return (0,
|
|
54
|
+
return (0, fake_promise_1.fakePromise)(undefined).then(() => { });
|
|
55
|
+
return (0, fake_promise_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkPatch(keys.map(([key, value]) => {
|
|
56
56
|
return [this.hashId(key), this.parse(value, key, guild)];
|
|
57
57
|
})));
|
|
58
58
|
}
|
|
59
59
|
remove(id, guild) {
|
|
60
60
|
const ids = Array.isArray(id) ? id : [id];
|
|
61
|
-
return (0,
|
|
61
|
+
return (0, fake_promise_1.fakePromise)(this.removeToRelationship(ids, guild)).then(() => this.adapter.bulkRemove(ids.map(x => this.hashId(x))));
|
|
62
62
|
}
|
|
63
63
|
keys(guild) {
|
|
64
64
|
return guild === '*'
|
|
65
65
|
? this.adapter.scan(this.hashId(guild), true)
|
|
66
|
-
: (0,
|
|
66
|
+
: (0, fake_promise_1.fakePromise)(this.adapter.getToRelationship(this.hashId(guild))).then(keys => keys.map(x => `${this.namespace}.${x}`));
|
|
67
67
|
}
|
|
68
68
|
values(guild) {
|
|
69
69
|
return guild === '*'
|
|
70
|
-
? (0,
|
|
71
|
-
: (0,
|
|
70
|
+
? (0, fake_promise_1.fakePromise)(this.adapter.scan(this.hashId(guild))).then(x => x)
|
|
71
|
+
: (0, fake_promise_1.fakePromise)(this.adapter.getToRelationship(this.hashId(guild))).then(keys => this.adapter.bulkGet(keys.map(x => `${this.namespace}.${x}`)));
|
|
72
72
|
}
|
|
73
73
|
count(to) {
|
|
74
74
|
return to === '*'
|
|
75
|
-
? (0,
|
|
75
|
+
? (0, fake_promise_1.fakePromise)(this.keys(to)).then(x => x.length)
|
|
76
76
|
: this.adapter.count(this.hashId(to));
|
|
77
77
|
}
|
|
78
78
|
contains(id, guild) {
|
|
@@ -93,9 +93,9 @@ class GuildRelatedResource {
|
|
|
93
93
|
hashId(id) {
|
|
94
94
|
return id.startsWith(this.namespace) ? id : `${this.namespace}.${id}`;
|
|
95
95
|
}
|
|
96
|
-
flush(guild) {
|
|
97
|
-
return (0,
|
|
98
|
-
return (0,
|
|
96
|
+
flush(guild = '*') {
|
|
97
|
+
return (0, fake_promise_1.fakePromise)(this.keys(guild)).then(keys => {
|
|
98
|
+
return (0, fake_promise_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
|
|
99
99
|
return this.removeRelationship(guild);
|
|
100
100
|
});
|
|
101
101
|
});
|
|
@@ -12,7 +12,7 @@ export declare class Emojis extends GuildRelatedResource<any, APIEmoji | APIAppl
|
|
|
12
12
|
id: string;
|
|
13
13
|
guild_id: string;
|
|
14
14
|
})[]>;
|
|
15
|
-
values(guild: string): ReturnCache<(GuildEmojiStructure | ApplicationEmojiStructure)[]>;
|
|
15
|
+
values(guild: '*' | (string & {})): ReturnCache<(GuildEmojiStructure | ApplicationEmojiStructure)[]>;
|
|
16
16
|
valuesRaw(guild: string): ReturnCache<(((APIEmoji & {
|
|
17
17
|
id: string;
|
|
18
18
|
}) | APIApplicationEmoji) & {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Emojis = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const guild_related_1 = require("./default/guild-related");
|
|
7
7
|
class Emojis extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'emoji';
|
|
@@ -11,7 +11,7 @@ class Emojis extends guild_related_1.GuildRelatedResource {
|
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
14
|
-
return (0,
|
|
14
|
+
return (0, fake_promise_1.fakePromise)(super.get(id)).then(rawEmoji => {
|
|
15
15
|
if (!rawEmoji)
|
|
16
16
|
return undefined;
|
|
17
17
|
if (rawEmoji.guild_id === this.client.applicationId)
|
|
@@ -23,7 +23,7 @@ class Emojis extends guild_related_1.GuildRelatedResource {
|
|
|
23
23
|
return super.get(id);
|
|
24
24
|
}
|
|
25
25
|
bulk(ids) {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(emojis => emojis.map(rawEmoji => {
|
|
27
27
|
if (rawEmoji.guild_id === this.client.applicationId)
|
|
28
28
|
return transformers_1.Transformers.ApplicationEmoji(this.client, rawEmoji);
|
|
29
29
|
return transformers_1.Transformers.GuildEmoji(this.client, rawEmoji, rawEmoji.guild_id);
|
|
@@ -33,7 +33,7 @@ class Emojis extends guild_related_1.GuildRelatedResource {
|
|
|
33
33
|
return super.bulk(ids);
|
|
34
34
|
}
|
|
35
35
|
values(guild) {
|
|
36
|
-
return (0,
|
|
36
|
+
return (0, fake_promise_1.fakePromise)(super.values(guild)).then(emojis => emojis.map(rawEmoji => {
|
|
37
37
|
if (rawEmoji.guild_id === this.client.applicationId)
|
|
38
38
|
return transformers_1.Transformers.ApplicationEmoji(this.client, rawEmoji);
|
|
39
39
|
return transformers_1.Transformers.GuildEmoji(this.client, rawEmoji, rawEmoji.guild_id);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Guilds = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const base_1 = require("./default/base");
|
|
7
7
|
class Guilds extends base_1.BaseResource {
|
|
8
8
|
namespace = 'guild';
|
|
@@ -11,25 +11,43 @@ class Guilds extends base_1.BaseResource {
|
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
14
|
-
return (0,
|
|
14
|
+
return (0, fake_promise_1.fakePromise)(super.get(id)).then(guild => guild ? transformers_1.Transformers.Guild(this.client, guild) : undefined);
|
|
15
15
|
}
|
|
16
16
|
raw(id) {
|
|
17
17
|
return super.get(id);
|
|
18
18
|
}
|
|
19
19
|
bulk(ids) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(guilds => guilds.map(x => transformers_1.Transformers.Guild(this.client, x)));
|
|
21
21
|
}
|
|
22
22
|
bulkRaw(ids) {
|
|
23
23
|
return super.bulk(ids);
|
|
24
24
|
}
|
|
25
25
|
values() {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, fake_promise_1.fakePromise)(super.values()).then(guilds => guilds.map(x => transformers_1.Transformers.Guild(this.client, x)));
|
|
27
27
|
}
|
|
28
28
|
valuesRaw() {
|
|
29
29
|
return super.values();
|
|
30
30
|
}
|
|
31
31
|
async remove(id) {
|
|
32
32
|
const keysChannels = (await this.cache.channels?.keys(id)) ?? [];
|
|
33
|
+
const channelIds = this.cache.channels
|
|
34
|
+
? keysChannels.map(i => i.slice(this.cache.channels.namespace.length + 1))
|
|
35
|
+
: [];
|
|
36
|
+
const overwriteKeys = this.cache.overwrites ? ((await this.cache.overwrites.keys(id)) ?? []) : [];
|
|
37
|
+
const messageKeys = [];
|
|
38
|
+
const messageRelationships = [];
|
|
39
|
+
const overwriteRelationships = this.cache.overwrites ? [this.cache.overwrites.hashId(id)] : [];
|
|
40
|
+
if (this.cache.messages) {
|
|
41
|
+
const messageEntries = await Promise.allSettled(channelIds.map(async (channelId) => ({
|
|
42
|
+
keys: await this.cache.messages.keys(channelId),
|
|
43
|
+
relationship: this.cache.messages.hashId(channelId),
|
|
44
|
+
})));
|
|
45
|
+
for (const { value } of messageEntries.filter(result => result.status === 'fulfilled')) {
|
|
46
|
+
const { keys, relationship } = value;
|
|
47
|
+
messageKeys.push(...keys);
|
|
48
|
+
messageRelationships.push(relationship);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
33
51
|
await this.cache.adapter.bulkRemove((await Promise.all([
|
|
34
52
|
this.cache.members?.keys(id) ?? [],
|
|
35
53
|
this.cache.roles?.keys(id) ?? [],
|
|
@@ -40,17 +58,9 @@ class Guilds extends base_1.BaseResource {
|
|
|
40
58
|
this.cache.presences?.keys(id) ?? [],
|
|
41
59
|
this.cache.stageInstances?.keys(id) ?? [],
|
|
42
60
|
this.cache.bans?.keys(id) ?? [],
|
|
43
|
-
]))
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (const i of keysChannels) {
|
|
47
|
-
const channelId = i.slice(this.cache.channels.namespace.length + 1);
|
|
48
|
-
const messages = await this.cache.messages.keys(channelId);
|
|
49
|
-
keysMessages.push(...messages);
|
|
50
|
-
}
|
|
51
|
-
if (keysMessages.length)
|
|
52
|
-
await this.cache.adapter.bulkRemove(keysMessages);
|
|
53
|
-
}
|
|
61
|
+
]))
|
|
62
|
+
.flat()
|
|
63
|
+
.concat(overwriteKeys, messageKeys));
|
|
54
64
|
await this.cache.adapter.removeRelationship([
|
|
55
65
|
this.cache.members?.hashId(id),
|
|
56
66
|
this.cache.roles?.hashId(id),
|
|
@@ -60,6 +70,9 @@ class Guilds extends base_1.BaseResource {
|
|
|
60
70
|
this.cache.voiceStates?.hashId(id),
|
|
61
71
|
this.cache.presences?.hashId(id),
|
|
62
72
|
this.cache.stageInstances?.hashId(id),
|
|
73
|
+
this.cache.bans?.hashId(id),
|
|
74
|
+
...overwriteRelationships,
|
|
75
|
+
...messageRelationships,
|
|
63
76
|
].filter(x => x !== undefined));
|
|
64
77
|
await super.remove(id);
|
|
65
78
|
}
|
|
@@ -10,7 +10,7 @@ export declare class Members extends GuildBasedResource<any, APIGuildMember> {
|
|
|
10
10
|
raw(id: string, guild: string): ReturnCache<APIGuildMember | undefined>;
|
|
11
11
|
bulk(ids: string[], guild: string): ReturnCache<GuildMemberStructure[]>;
|
|
12
12
|
bulkRaw(ids: string[], guild: string): ReturnCache<Omit<APIGuildMember, 'user'>[]>;
|
|
13
|
-
values(guild: string): ReturnCache<GuildMemberStructure[]>;
|
|
13
|
+
values(guild: '*' | (string & {})): ReturnCache<GuildMemberStructure[]>;
|
|
14
14
|
valuesRaw(guild: string): ReturnCache<Omit<APIGuildMember, 'user'>[]>;
|
|
15
15
|
set(from: CacheFrom, memberId: string, guildId: string, data: any): Promise<void>;
|
|
16
16
|
set(from: CacheFrom, memberId_dataArray: [string, any][], guildId: string): Promise<void>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Members = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const guild_based_1 = require("./default/guild-based");
|
|
7
7
|
class Members extends guild_based_1.GuildBasedResource {
|
|
8
8
|
namespace = 'member';
|
|
@@ -15,11 +15,11 @@ class Members extends guild_based_1.GuildBasedResource {
|
|
|
15
15
|
return rest;
|
|
16
16
|
}
|
|
17
17
|
get(id, guild) {
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, fake_promise_1.fakePromise)(super.get(id, guild)).then(rawMember => (0, fake_promise_1.fakePromise)(this.client.cache.users?.raw(id)).then(user => rawMember && user ? transformers_1.Transformers.GuildMember(this.client, rawMember, user, guild) : undefined));
|
|
19
19
|
}
|
|
20
20
|
raw(id, guild) {
|
|
21
|
-
return (0,
|
|
22
|
-
return (0,
|
|
21
|
+
return (0, fake_promise_1.fakePromise)(super.get(id, guild)).then(rawMember => {
|
|
22
|
+
return (0, fake_promise_1.fakePromise)(this.client.cache.users?.raw(id)).then(user => rawMember && user
|
|
23
23
|
? {
|
|
24
24
|
...rawMember,
|
|
25
25
|
user,
|
|
@@ -28,7 +28,7 @@ class Members extends guild_based_1.GuildBasedResource {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
bulk(ids, guild) {
|
|
31
|
-
return (0,
|
|
31
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids, guild)).then(members => (0, fake_promise_1.fakePromise)(this.client.cache.users?.bulkRaw(ids)).then(users => {
|
|
32
32
|
if (!users)
|
|
33
33
|
return [];
|
|
34
34
|
let usersRecord = {};
|
|
@@ -49,7 +49,7 @@ class Members extends guild_based_1.GuildBasedResource {
|
|
|
49
49
|
return super.bulk(ids, guild);
|
|
50
50
|
}
|
|
51
51
|
values(guild) {
|
|
52
|
-
return (0,
|
|
52
|
+
return (0, fake_promise_1.fakePromise)(super.values(guild)).then(members => (0, fake_promise_1.fakePromise)(this.client.cache.users?.bulkRaw(members.map(member => member.id))).then(users => {
|
|
53
53
|
if (!users)
|
|
54
54
|
return [];
|
|
55
55
|
let usersRecord = {};
|
|
@@ -10,9 +10,14 @@ export declare class Messages extends GuildRelatedResource<any, APIMessage> {
|
|
|
10
10
|
raw(id: string): ReturnCache<APIMessageResource | undefined>;
|
|
11
11
|
bulk(ids: string[]): ReturnCache<MessageStructure[]>;
|
|
12
12
|
bulkRaw(ids: string[]): ReturnCache<APIMessageResource[]>;
|
|
13
|
-
values(channel: string): ReturnCache<MessageStructure[]>;
|
|
13
|
+
values(channel: '*' | (string & {})): ReturnCache<MessageStructure[]>;
|
|
14
14
|
valuesRaw(channel: string): ReturnCache<APIMessageResource[]>;
|
|
15
|
-
keys(channel: string): string[];
|
|
15
|
+
keys(channel: '*' | (string & {})): string[];
|
|
16
|
+
private _buildCacheEntries;
|
|
17
|
+
set(from: CacheFrom, messageId: string, channelId: string, data: any): Promise<void>;
|
|
18
|
+
set(from: CacheFrom, messageDataArray: [string, any][], channelId: string): Promise<void>;
|
|
19
|
+
patch(from: CacheFrom, messageId: string, channelId: string, data: any): Promise<void>;
|
|
20
|
+
patch(from: CacheFrom, messageDataArray: [string, any][], channelId: string): Promise<void>;
|
|
16
21
|
}
|
|
17
22
|
export type APIMessageResource = Omit<APIMessage, 'author' | 'member'> & {
|
|
18
23
|
user_id?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Messages = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const guild_related_1 = require("./default/guild-related");
|
|
7
7
|
class Messages extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'message';
|
|
@@ -17,9 +17,9 @@ class Messages extends guild_related_1.GuildRelatedResource {
|
|
|
17
17
|
return rest;
|
|
18
18
|
}
|
|
19
19
|
get(id) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, fake_promise_1.fakePromise)(super.get(id)).then(rawMessage => {
|
|
21
21
|
return this.cache.users && rawMessage?.user_id
|
|
22
|
-
? (0,
|
|
22
|
+
? (0, fake_promise_1.fakePromise)(this.cache.adapter.get(this.cache.users.hashId(rawMessage.user_id))).then(user => {
|
|
23
23
|
return user ? transformers_1.Transformers.Message(this.client, { ...rawMessage, author: user }) : undefined;
|
|
24
24
|
})
|
|
25
25
|
: undefined;
|
|
@@ -29,31 +29,43 @@ class Messages extends guild_related_1.GuildRelatedResource {
|
|
|
29
29
|
return super.get(id);
|
|
30
30
|
}
|
|
31
31
|
bulk(ids) {
|
|
32
|
-
return (0,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(messages => {
|
|
33
|
+
const hashes = this.cache.users
|
|
34
|
+
? messages.map(x => (x.user_id ? this.cache.users?.hashId(x.user_id) : undefined))
|
|
35
|
+
: [];
|
|
36
|
+
return (0, fake_promise_1.fakePromise)(this.cache.adapter.bulkGet(hashes.filter(x => x !== undefined))).then(users => {
|
|
37
|
+
const userMap = new Map();
|
|
38
|
+
for (const user of users)
|
|
39
|
+
userMap.set(user.id, user);
|
|
40
|
+
const result = [];
|
|
41
|
+
for (const message of messages) {
|
|
42
|
+
const user = message.user_id ? userMap.get(message.user_id) : undefined;
|
|
43
|
+
if (user)
|
|
44
|
+
result.push(transformers_1.Transformers.Message(this.client, { ...message, author: user }));
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
});
|
|
48
|
+
});
|
|
41
49
|
}
|
|
42
50
|
bulkRaw(ids) {
|
|
43
51
|
return super.bulk(ids);
|
|
44
52
|
}
|
|
45
53
|
values(channel) {
|
|
46
|
-
return (0,
|
|
54
|
+
return (0, fake_promise_1.fakePromise)(super.values(channel)).then(messages => {
|
|
47
55
|
const hashes = this.cache.users
|
|
48
56
|
? messages.map(x => (x.user_id ? this.cache.users?.hashId(x.user_id) : undefined))
|
|
49
57
|
: [];
|
|
50
|
-
return (0,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
.
|
|
58
|
+
return (0, fake_promise_1.fakePromise)(this.cache.adapter.bulkGet(hashes.filter(x => x !== undefined))).then(users => {
|
|
59
|
+
const userMap = new Map();
|
|
60
|
+
for (const user of users)
|
|
61
|
+
userMap.set(user.id, user);
|
|
62
|
+
const result = [];
|
|
63
|
+
for (const message of messages) {
|
|
64
|
+
const user = message.user_id ? userMap.get(message.user_id) : undefined;
|
|
65
|
+
if (user)
|
|
66
|
+
result.push(transformers_1.Transformers.Message(this.client, { ...message, author: user }));
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
57
69
|
});
|
|
58
70
|
});
|
|
59
71
|
}
|
|
@@ -63,5 +75,16 @@ class Messages extends guild_related_1.GuildRelatedResource {
|
|
|
63
75
|
keys(channel) {
|
|
64
76
|
return super.keys(channel);
|
|
65
77
|
}
|
|
78
|
+
_buildCacheEntries(from, keys, channelId) {
|
|
79
|
+
return keys.map(([id, value]) => [from, 'messages', value, id, channelId]);
|
|
80
|
+
}
|
|
81
|
+
async set(from, __keys, channelId, data) {
|
|
82
|
+
const keys = Array.isArray(__keys) ? __keys : [[__keys, data]];
|
|
83
|
+
await this.cache.bulkSet(this._buildCacheEntries(from, keys, channelId));
|
|
84
|
+
}
|
|
85
|
+
async patch(from, __keys, channelId, data) {
|
|
86
|
+
const keys = Array.isArray(__keys) ? __keys : [[__keys, data]];
|
|
87
|
+
await this.cache.bulkPatch(this._buildCacheEntries(from, keys, channelId));
|
|
88
|
+
}
|
|
66
89
|
}
|
|
67
90
|
exports.Messages = Messages;
|
|
@@ -16,7 +16,7 @@ export declare class Overwrites extends GuildRelatedResource<any, APIOverwrite[]
|
|
|
16
16
|
allow: PermissionsBitField;
|
|
17
17
|
guildId: string;
|
|
18
18
|
}[] | undefined>;
|
|
19
|
-
values(guild: string): ReturnCache<{
|
|
19
|
+
values(guild: '*' | (string & {})): ReturnCache<{
|
|
20
20
|
type: OverwriteType;
|
|
21
21
|
id: string;
|
|
22
22
|
deny: PermissionsBitField;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Overwrites = void 0;
|
|
4
|
-
const
|
|
4
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
5
5
|
const Permissions_1 = require("../../structures/extra/Permissions");
|
|
6
6
|
const guild_related_1 = require("./default/guild-related");
|
|
7
7
|
class Overwrites extends guild_related_1.GuildRelatedResource {
|
|
@@ -11,16 +11,13 @@ class Overwrites extends guild_related_1.GuildRelatedResource {
|
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
parse(data, _id, guild_id) {
|
|
14
|
-
data.
|
|
15
|
-
x.guild_id = guild_id;
|
|
16
|
-
});
|
|
17
|
-
return data;
|
|
14
|
+
return data.map(x => ({ ...x, guild_id }));
|
|
18
15
|
}
|
|
19
16
|
raw(id) {
|
|
20
17
|
return super.get(id);
|
|
21
18
|
}
|
|
22
19
|
get(id) {
|
|
23
|
-
return (0,
|
|
20
|
+
return (0, fake_promise_1.fakePromise)(super.get(id)).then(rawOverwrites => rawOverwrites
|
|
24
21
|
? rawOverwrites.map(rawOverwrite => ({
|
|
25
22
|
allow: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.allow)),
|
|
26
23
|
deny: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.deny)),
|
|
@@ -31,7 +28,7 @@ class Overwrites extends guild_related_1.GuildRelatedResource {
|
|
|
31
28
|
: undefined);
|
|
32
29
|
}
|
|
33
30
|
values(guild) {
|
|
34
|
-
return (0,
|
|
31
|
+
return (0, fake_promise_1.fakePromise)(super.values(guild)).then(values => values.map(rawOverwrites => rawOverwrites.map(rawOverwrite => ({
|
|
35
32
|
allow: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.allow)),
|
|
36
33
|
deny: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.deny)),
|
|
37
34
|
id: rawOverwrite.id,
|
|
@@ -43,7 +40,7 @@ class Overwrites extends guild_related_1.GuildRelatedResource {
|
|
|
43
40
|
return super.values(guild);
|
|
44
41
|
}
|
|
45
42
|
bulk(ids) {
|
|
46
|
-
return (0,
|
|
43
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(values => values.map(rawOverwrites => rawOverwrites.map(rawOverwrite => ({
|
|
47
44
|
allow: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.allow)),
|
|
48
45
|
deny: new Permissions_1.PermissionsBitField(BigInt(rawOverwrite.deny)),
|
|
49
46
|
id: rawOverwrite.id,
|
|
@@ -9,6 +9,6 @@ export declare class Roles extends GuildRelatedResource<any, APIRole> {
|
|
|
9
9
|
raw(id: string): ReturnCache<APIRole | undefined>;
|
|
10
10
|
bulk(ids: string[]): ReturnCache<GuildRoleStructure[]>;
|
|
11
11
|
bulkRaw(ids: string[]): ReturnCache<APIRole[]>;
|
|
12
|
-
values(guild: string): ReturnCache<GuildRoleStructure[]>;
|
|
12
|
+
values(guild: '*' | (string & {})): ReturnCache<GuildRoleStructure[]>;
|
|
13
13
|
valuesRaw(guild: string): ReturnCache<APIRole[]>;
|
|
14
14
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Roles = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const guild_related_1 = require("./default/guild-related");
|
|
7
7
|
class Roles extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'role';
|
|
@@ -11,19 +11,19 @@ class Roles extends guild_related_1.GuildRelatedResource {
|
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
14
|
-
return (0,
|
|
14
|
+
return (0, fake_promise_1.fakePromise)(super.get(id)).then(rawRole => rawRole ? transformers_1.Transformers.GuildRole(this.client, rawRole, rawRole.guild_id) : undefined);
|
|
15
15
|
}
|
|
16
16
|
raw(id) {
|
|
17
17
|
return super.get(id);
|
|
18
18
|
}
|
|
19
19
|
bulk(ids) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(roles => roles.map(rawRole => transformers_1.Transformers.GuildRole(this.client, rawRole, rawRole.guild_id)));
|
|
21
21
|
}
|
|
22
22
|
bulkRaw(ids) {
|
|
23
23
|
return super.bulk(ids);
|
|
24
24
|
}
|
|
25
25
|
values(guild) {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, fake_promise_1.fakePromise)(super.values(guild)).then(roles => roles.map(rawRole => transformers_1.Transformers.GuildRole(this.client, rawRole, rawRole.guild_id)));
|
|
27
27
|
}
|
|
28
28
|
valuesRaw(guild) {
|
|
29
29
|
return super.values(guild);
|
|
@@ -9,6 +9,6 @@ export declare class Stickers extends GuildRelatedResource<any, APISticker> {
|
|
|
9
9
|
raw(id: string): ReturnCache<APISticker | undefined>;
|
|
10
10
|
bulk(ids: string[]): ReturnCache<StickerStructure[]>;
|
|
11
11
|
bulkRaw(ids: string[]): ReturnCache<APISticker[]>;
|
|
12
|
-
values(guild: string): ReturnCache<StickerStructure[]>;
|
|
12
|
+
values(guild: '*' | (string & {})): ReturnCache<StickerStructure[]>;
|
|
13
13
|
valuesRaw(guild: string): ReturnCache<APISticker[]>;
|
|
14
14
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Stickers = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const guild_related_1 = require("./default/guild-related");
|
|
7
7
|
class Stickers extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'sticker';
|
|
@@ -11,19 +11,19 @@ class Stickers extends guild_related_1.GuildRelatedResource {
|
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
14
|
-
return (0,
|
|
14
|
+
return (0, fake_promise_1.fakePromise)(super.get(id)).then(rawSticker => rawSticker ? transformers_1.Transformers.Sticker(this.client, rawSticker) : undefined);
|
|
15
15
|
}
|
|
16
16
|
raw(id) {
|
|
17
17
|
return super.get(id);
|
|
18
18
|
}
|
|
19
19
|
bulk(ids) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(emojis => emojis.map(rawSticker => transformers_1.Transformers.Sticker(this.client, rawSticker)));
|
|
21
21
|
}
|
|
22
22
|
bulkRaw(ids) {
|
|
23
23
|
return super.bulk(ids);
|
|
24
24
|
}
|
|
25
25
|
values(guild) {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, fake_promise_1.fakePromise)(super.values(guild)).then(emojis => emojis.map(rawSticker => transformers_1.Transformers.Sticker(this.client, rawSticker)));
|
|
27
27
|
}
|
|
28
28
|
valuesRaw(guild) {
|
|
29
29
|
return super.values(guild);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Users = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const base_1 = require("./default/base");
|
|
7
7
|
class Users extends base_1.BaseResource {
|
|
8
8
|
namespace = 'user';
|
|
@@ -11,19 +11,19 @@ class Users extends base_1.BaseResource {
|
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
14
|
-
return (0,
|
|
14
|
+
return (0, fake_promise_1.fakePromise)(super.get(id)).then(rawUser => (rawUser ? transformers_1.Transformers.User(this.client, rawUser) : undefined));
|
|
15
15
|
}
|
|
16
16
|
raw(id) {
|
|
17
17
|
return super.get(id);
|
|
18
18
|
}
|
|
19
19
|
bulk(ids) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(users => users.map(rawUser => transformers_1.Transformers.User(this.client, rawUser)));
|
|
21
21
|
}
|
|
22
22
|
bulkRaw(ids) {
|
|
23
23
|
return super.bulk(ids);
|
|
24
24
|
}
|
|
25
25
|
values() {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, fake_promise_1.fakePromise)(super.values()).then(users => users.map(rawUser => transformers_1.Transformers.User(this.client, rawUser)));
|
|
27
27
|
}
|
|
28
28
|
valuesRaw() {
|
|
29
29
|
return super.values();
|
|
@@ -10,7 +10,7 @@ export declare class VoiceStates extends GuildBasedResource<any, APIVoiceState>
|
|
|
10
10
|
raw(memberId: string, guildId: string): ReturnCache<APIVoiceState | undefined>;
|
|
11
11
|
bulk(ids: string[], guild: string): ReturnCache<VoiceStateStructure[]>;
|
|
12
12
|
bulkRaw(ids: string[], guild: string): ReturnCache<APIVoiceState[]>;
|
|
13
|
-
values(guildId: string): ReturnCache<VoiceStateStructure[]>;
|
|
13
|
+
values(guildId: '*' | (string & {})): ReturnCache<VoiceStateStructure[]>;
|
|
14
14
|
valuesRaw(guildId: string): ReturnCache<APIVoiceState[]>;
|
|
15
15
|
}
|
|
16
16
|
export type VoiceStateResource = Omit<APIVoiceState, 'member'> & {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VoiceStates = void 0;
|
|
4
4
|
const transformers_1 = require("../../client/transformers");
|
|
5
|
-
const
|
|
5
|
+
const fake_promise_1 = require("../../common/it/fake-promise");
|
|
6
6
|
const guild_based_1 = require("./default/guild-based");
|
|
7
7
|
class VoiceStates extends guild_based_1.GuildBasedResource {
|
|
8
8
|
namespace = 'voice_state';
|
|
@@ -15,13 +15,13 @@ class VoiceStates extends guild_based_1.GuildBasedResource {
|
|
|
15
15
|
return rest;
|
|
16
16
|
}
|
|
17
17
|
get(memberId, guildId) {
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, fake_promise_1.fakePromise)(super.get(memberId, guildId)).then(state => state ? transformers_1.Transformers.VoiceState(this.client, state) : undefined);
|
|
19
19
|
}
|
|
20
20
|
raw(memberId, guildId) {
|
|
21
21
|
return super.get(memberId, guildId);
|
|
22
22
|
}
|
|
23
23
|
bulk(ids, guild) {
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, fake_promise_1.fakePromise)(super.bulk(ids, guild)).then(states => states
|
|
25
25
|
.map(state => (state ? transformers_1.Transformers.VoiceState(this.client, state) : undefined))
|
|
26
26
|
.filter(x => x !== undefined));
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ class VoiceStates extends guild_based_1.GuildBasedResource {
|
|
|
29
29
|
return super.bulk(ids, guild);
|
|
30
30
|
}
|
|
31
31
|
values(guildId) {
|
|
32
|
-
return (0,
|
|
32
|
+
return (0, fake_promise_1.fakePromise)(super.values(guildId)).then(states => states.map(state => transformers_1.Transformers.VoiceState(this.client, state)));
|
|
33
33
|
}
|
|
34
34
|
valuesRaw(guildId) {
|
|
35
35
|
return super.values(guildId);
|