seyfert 2.1.1-dev-12471001861.0 → 2.1.1-dev-12488366079.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cache/adapters/default.d.ts +2 -2
- package/lib/cache/adapters/default.js +2 -8
- package/lib/cache/adapters/limited.d.ts +2 -2
- package/lib/cache/adapters/limited.js +2 -8
- package/lib/cache/adapters/types.d.ts +2 -2
- package/lib/cache/index.d.ts +9 -0
- package/lib/cache/index.js +42 -36
- package/lib/cache/resources/bans.d.ts +2 -2
- package/lib/cache/resources/bans.js +1 -1
- package/lib/cache/resources/channels.d.ts +2 -2
- package/lib/cache/resources/channels.js +1 -1
- package/lib/cache/resources/default/base.d.ts +5 -5
- package/lib/cache/resources/default/base.js +8 -8
- package/lib/cache/resources/default/guild-based.d.ts +7 -7
- package/lib/cache/resources/default/guild-based.js +7 -7
- package/lib/cache/resources/default/guild-related.d.ts +7 -7
- package/lib/cache/resources/default/guild-related.js +10 -15
- package/lib/cache/resources/emojis.d.ts +2 -2
- package/lib/cache/resources/emojis.js +1 -1
- package/lib/cache/resources/guilds.d.ts +4 -4
- package/lib/cache/resources/guilds.js +27 -27
- package/lib/cache/resources/members.d.ts +4 -4
- package/lib/cache/resources/members.js +4 -4
- package/lib/cache/resources/messages.d.ts +2 -2
- package/lib/cache/resources/messages.js +1 -1
- package/lib/cache/resources/overwrites.d.ts +2 -2
- package/lib/cache/resources/overwrites.js +1 -1
- package/lib/cache/resources/presence.d.ts +2 -1
- package/lib/cache/resources/presence.js +1 -1
- package/lib/cache/resources/roles.d.ts +2 -2
- package/lib/cache/resources/roles.js +1 -1
- package/lib/cache/resources/stage-instances.d.ts +2 -1
- package/lib/cache/resources/stage-instances.js +1 -1
- package/lib/cache/resources/stickers.d.ts +2 -2
- package/lib/cache/resources/stickers.js +1 -1
- package/lib/cache/resources/users.d.ts +2 -2
- package/lib/cache/resources/users.js +1 -1
- package/lib/cache/resources/voice-states.d.ts +2 -2
- package/lib/cache/resources/voice-states.js +1 -1
- package/lib/common/shorters/bans.js +3 -2
- package/lib/common/shorters/channels.js +6 -5
- package/lib/common/shorters/emojis.js +4 -3
- package/lib/common/shorters/guilds.js +13 -12
- package/lib/common/shorters/members.d.ts +1 -1
- package/lib/common/shorters/members.js +7 -6
- package/lib/common/shorters/messages.js +5 -4
- package/lib/common/shorters/roles.js +6 -5
- package/lib/common/shorters/threads.js +3 -2
- package/lib/common/shorters/users.js +3 -2
- package/lib/structures/ClientUser.d.ts +1 -1
- package/lib/structures/ClientUser.js +3 -2
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ class GuildRelatedResource {
|
|
|
11
11
|
this.client = client;
|
|
12
12
|
}
|
|
13
13
|
//@ts-expect-error
|
|
14
|
-
filter(data, id, guild_id) {
|
|
14
|
+
filter(data, id, guild_id, from) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
17
|
parse(data, id, guild_id) {
|
|
@@ -28,9 +28,9 @@ class GuildRelatedResource {
|
|
|
28
28
|
return this.remove(id, guildId);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
setIfNI(intent, id, guildId, data) {
|
|
31
|
+
setIfNI(from, intent, id, guildId, data) {
|
|
32
32
|
if (!this.cache.hasIntent(intent)) {
|
|
33
|
-
return this.set(id, guildId, data);
|
|
33
|
+
return this.set(from, id, guildId, data);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
get(id) {
|
|
@@ -39,22 +39,17 @@ class GuildRelatedResource {
|
|
|
39
39
|
bulk(ids) {
|
|
40
40
|
return (0, common_1.fakePromise)(this.adapter.bulkGet(ids.map(x => this.hashId(x)))).then(x => x.filter(y => y));
|
|
41
41
|
}
|
|
42
|
-
set(__keys, guild, data) {
|
|
43
|
-
const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild));
|
|
42
|
+
set(from, __keys, guild, data) {
|
|
43
|
+
const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild, from));
|
|
44
44
|
return (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkSet(keys.map(([key, value]) => {
|
|
45
45
|
return [this.hashId(key), this.parse(value, key, guild)];
|
|
46
46
|
})));
|
|
47
47
|
}
|
|
48
|
-
patch(__keys, guild, data) {
|
|
49
|
-
const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild));
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
})));
|
|
54
|
-
}
|
|
55
|
-
return (0, common_1.fakePromise)(this.adapter.bulkPatch(true, keys.map(([key, value]) => {
|
|
56
|
-
return [this.hashId(key), value];
|
|
57
|
-
}))).then(x => x);
|
|
48
|
+
patch(from, __keys, guild, data) {
|
|
49
|
+
const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild, from));
|
|
50
|
+
return (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkPatch(keys.map(([key, value]) => {
|
|
51
|
+
return [this.hashId(key), this.parse(value, key, guild)];
|
|
52
|
+
})));
|
|
58
53
|
}
|
|
59
54
|
remove(id, guild) {
|
|
60
55
|
const ids = Array.isArray(id) ? id : [id];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '../..';
|
|
2
2
|
import { type GuildEmojiStructure } from '../../client/transformers';
|
|
3
3
|
import type { APIEmoji } from '../../types';
|
|
4
4
|
import { GuildRelatedResource } from './default/guild-related';
|
|
5
5
|
export declare class Emojis extends GuildRelatedResource<any, APIEmoji> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APIEmoji, id: string, guild_id
|
|
7
|
+
filter(data: APIEmoji, id: string, guild_id: string, from: CacheFrom): boolean;
|
|
8
8
|
get(id: string): ReturnCache<GuildEmojiStructure | undefined>;
|
|
9
9
|
raw(id: string): ReturnCache<APIEmoji | undefined>;
|
|
10
10
|
bulk(ids: string[]): ReturnCache<GuildEmojiStructure[]>;
|
|
@@ -7,7 +7,7 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
7
7
|
class Emojis extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'emoji';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id, guild_id) {
|
|
10
|
+
filter(data, id, guild_id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '..';
|
|
2
2
|
import { type GuildStructure } from '../../client/transformers';
|
|
3
3
|
import type { APIGuild, GatewayGuildCreateDispatchData } from '../../types';
|
|
4
4
|
import { BaseResource } from './default/base';
|
|
5
5
|
export declare class Guilds extends BaseResource<any, APIGuild | GatewayGuildCreateDispatchData> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APIGuild, id: string): boolean;
|
|
7
|
+
filter(data: APIGuild, id: string, from: CacheFrom): boolean;
|
|
8
8
|
get(id: string): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
9
9
|
raw(id: string): ReturnCache<APIGuild | undefined>;
|
|
10
10
|
bulk(ids: string[]): ReturnCache<GuildStructure<'cached'>[]>;
|
|
@@ -12,6 +12,6 @@ export declare class Guilds extends BaseResource<any, APIGuild | GatewayGuildCre
|
|
|
12
12
|
values(): ReturnCache<GuildStructure<'cached'>[]>;
|
|
13
13
|
valuesRaw(): ReturnCache<APIGuild[]>;
|
|
14
14
|
remove(id: string): Promise<void>;
|
|
15
|
-
set(id: string, data: any): Promise<void>;
|
|
16
|
-
patch(id: string, data: any): Promise<void>;
|
|
15
|
+
set(from: CacheFrom, id: string, data: any): Promise<void>;
|
|
16
|
+
patch(from: CacheFrom, id: string, data: any): Promise<void>;
|
|
17
17
|
}
|
|
@@ -7,7 +7,7 @@ const base_1 = require("./default/base");
|
|
|
7
7
|
class Guilds extends base_1.BaseResource {
|
|
8
8
|
namespace = 'guild';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id) {
|
|
10
|
+
filter(data, id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
@@ -63,83 +63,83 @@ class Guilds extends base_1.BaseResource {
|
|
|
63
63
|
].filter(x => x !== undefined));
|
|
64
64
|
await super.remove(id);
|
|
65
65
|
}
|
|
66
|
-
async set(id, data) {
|
|
66
|
+
async set(from, id, data) {
|
|
67
67
|
const bulkData = [];
|
|
68
68
|
for (const member of data.members ?? []) {
|
|
69
69
|
if (!member.user?.id) {
|
|
70
70
|
continue;
|
|
71
71
|
}
|
|
72
|
-
bulkData.push(['members', member, member.user.id, id]);
|
|
73
|
-
bulkData.push(['users', member.user, member.user.id]);
|
|
72
|
+
bulkData.push([from, 'members', member, member.user.id, id]);
|
|
73
|
+
bulkData.push([from, 'users', member.user, member.user.id]);
|
|
74
74
|
}
|
|
75
75
|
for (const role of data.roles ?? []) {
|
|
76
|
-
bulkData.push(['roles', role, role.id, id]);
|
|
76
|
+
bulkData.push([from, 'roles', role, role.id, id]);
|
|
77
77
|
}
|
|
78
78
|
for (const channel of data.channels ?? []) {
|
|
79
|
-
bulkData.push(['channels', channel, channel.id, id]);
|
|
79
|
+
bulkData.push([from, 'channels', channel, channel.id, id]);
|
|
80
80
|
if (channel.permission_overwrites?.length)
|
|
81
|
-
bulkData.push(['overwrites', channel.permission_overwrites, channel.id, id]);
|
|
81
|
+
bulkData.push([from, 'overwrites', channel.permission_overwrites, channel.id, id]);
|
|
82
82
|
}
|
|
83
83
|
for (const thread of data.threads ?? []) {
|
|
84
|
-
bulkData.push(['channels', thread, thread.id, id]);
|
|
84
|
+
bulkData.push([from, 'channels', thread, thread.id, id]);
|
|
85
85
|
}
|
|
86
86
|
for (const emoji of data.emojis ?? []) {
|
|
87
|
-
bulkData.push(['emojis', emoji, emoji.id, id]);
|
|
87
|
+
bulkData.push([from, 'emojis', emoji, emoji.id, id]);
|
|
88
88
|
}
|
|
89
89
|
for (const sticker of data.stickers ?? []) {
|
|
90
|
-
bulkData.push(['stickers', sticker, sticker.id, id]);
|
|
90
|
+
bulkData.push([from, 'stickers', sticker, sticker.id, id]);
|
|
91
91
|
}
|
|
92
92
|
for (const voiceState of data.voice_states ?? []) {
|
|
93
|
-
bulkData.push(['voiceStates', voiceState, voiceState.user_id, id]);
|
|
93
|
+
bulkData.push([from, 'voiceStates', voiceState, voiceState.user_id, id]);
|
|
94
94
|
}
|
|
95
95
|
for (const presence of data.presences ?? []) {
|
|
96
|
-
bulkData.push(['presences', presence, presence.user.id, id]);
|
|
96
|
+
bulkData.push([from, 'presences', presence, presence.user.id, id]);
|
|
97
97
|
}
|
|
98
98
|
for (const instance of data.stage_instances ?? []) {
|
|
99
|
-
bulkData.push(['stageInstances', instance, instance.id, id]);
|
|
99
|
+
bulkData.push([from, 'stageInstances', instance, instance.id, id]);
|
|
100
100
|
}
|
|
101
101
|
const { voice_states, members, channels, threads, presences, stage_instances, guild_scheduled_events, roles, emojis, stickers, guild_hashes, ...guild } = data;
|
|
102
|
-
bulkData.push(['guilds', guild, id]);
|
|
102
|
+
bulkData.push([from, 'guilds', guild, id]);
|
|
103
103
|
await this.cache.bulkSet(bulkData);
|
|
104
104
|
}
|
|
105
|
-
async patch(id, data) {
|
|
105
|
+
async patch(from, id, data) {
|
|
106
106
|
const bulkData = [];
|
|
107
107
|
for (const member of data.members ?? []) {
|
|
108
108
|
if (!member.user?.id) {
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
111
|
-
bulkData.push(['members', member, member.user.id, id]);
|
|
112
|
-
bulkData.push(['users', member.user, member.user.id]);
|
|
111
|
+
bulkData.push([from, 'members', member, member.user.id, id]);
|
|
112
|
+
bulkData.push([from, 'users', member.user, member.user.id]);
|
|
113
113
|
}
|
|
114
114
|
for (const role of data.roles ?? []) {
|
|
115
|
-
bulkData.push(['roles', role, role.id, id]);
|
|
115
|
+
bulkData.push([from, 'roles', role, role.id, id]);
|
|
116
116
|
}
|
|
117
117
|
for (const channel of data.channels ?? []) {
|
|
118
|
-
bulkData.push(['channels', channel, channel.id, id]);
|
|
118
|
+
bulkData.push([from, 'channels', channel, channel.id, id]);
|
|
119
119
|
if (channel.permission_overwrites?.length) {
|
|
120
|
-
bulkData.push(['overwrites', channel.permission_overwrites, channel.id, id]);
|
|
120
|
+
bulkData.push([from, 'overwrites', channel.permission_overwrites, channel.id, id]);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
for (const thread of data.threads ?? []) {
|
|
124
|
-
bulkData.push(['channels', thread, thread.id, id]);
|
|
124
|
+
bulkData.push([from, 'channels', thread, thread.id, id]);
|
|
125
125
|
}
|
|
126
126
|
for (const emoji of data.emojis ?? []) {
|
|
127
|
-
bulkData.push(['emojis', emoji, emoji.id, id]);
|
|
127
|
+
bulkData.push([from, 'emojis', emoji, emoji.id, id]);
|
|
128
128
|
}
|
|
129
129
|
for (const sticker of data.stickers ?? []) {
|
|
130
|
-
bulkData.push(['stickers', sticker, sticker.id, id]);
|
|
130
|
+
bulkData.push([from, 'stickers', sticker, sticker.id, id]);
|
|
131
131
|
}
|
|
132
132
|
for (const voiceState of data.voice_states ?? []) {
|
|
133
|
-
bulkData.push(['voiceStates', voiceState, voiceState.user_id, id]);
|
|
133
|
+
bulkData.push([from, 'voiceStates', voiceState, voiceState.user_id, id]);
|
|
134
134
|
}
|
|
135
135
|
for (const presence of data.presences ?? []) {
|
|
136
|
-
bulkData.push(['presences', presence, presence.user.id, id]);
|
|
136
|
+
bulkData.push([from, 'presences', presence, presence.user.id, id]);
|
|
137
137
|
}
|
|
138
138
|
for (const instance of data.stage_instances ?? []) {
|
|
139
|
-
bulkData.push(['stageInstances', instance, instance.id, id]);
|
|
139
|
+
bulkData.push([from, 'stageInstances', instance, instance.id, id]);
|
|
140
140
|
}
|
|
141
141
|
const { voice_states, members, channels, threads, presences, stage_instances, guild_scheduled_events, roles, emojis, stickers, guild_hashes, ...guild } = data;
|
|
142
|
-
bulkData.push(['guilds', guild, id]);
|
|
142
|
+
bulkData.push([from, 'guilds', guild, id]);
|
|
143
143
|
await this.cache.bulkPatch(bulkData);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '../..';
|
|
2
2
|
import { type GuildMemberStructure } from '../../client/transformers';
|
|
3
3
|
import type { APIGuildMember } from '../../types';
|
|
4
4
|
import { GuildBasedResource } from './default/guild-based';
|
|
5
5
|
export declare class Members extends GuildBasedResource<any, APIGuildMember> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APIGuildMember, id: string, guild_id: string): boolean;
|
|
7
|
+
filter(data: APIGuildMember, id: string, guild_id: string, from: CacheFrom): boolean;
|
|
8
8
|
parse(data: any, key: string, guild_id: string): any;
|
|
9
9
|
get(id: string, guild: string): ReturnCache<GuildMemberStructure | undefined>;
|
|
10
10
|
raw(id: string, guild: string): ReturnCache<APIGuildMember | undefined>;
|
|
@@ -12,6 +12,6 @@ export declare class Members extends GuildBasedResource<any, APIGuildMember> {
|
|
|
12
12
|
bulkRaw(ids: string[], guild: string): ReturnCache<Omit<APIGuildMember, 'user'>[]>;
|
|
13
13
|
values(guild: string): ReturnCache<GuildMemberStructure[]>;
|
|
14
14
|
valuesRaw(guild: string): ReturnCache<Omit<APIGuildMember, 'user'>[]>;
|
|
15
|
-
set(memberId: string, guildId: string, data: any): Promise<void>;
|
|
16
|
-
set(memberId_dataArray: [string, any][], guildId: string): Promise<void>;
|
|
15
|
+
set(from: CacheFrom, memberId: string, guildId: string, data: any): Promise<void>;
|
|
16
|
+
set(from: CacheFrom, memberId_dataArray: [string, any][], guildId: string): Promise<void>;
|
|
17
17
|
}
|
|
@@ -7,7 +7,7 @@ const guild_based_1 = require("./default/guild-based");
|
|
|
7
7
|
class Members extends guild_based_1.GuildBasedResource {
|
|
8
8
|
namespace = 'member';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id, guild_id) {
|
|
10
|
+
filter(data, id, guild_id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
parse(data, key, guild_id) {
|
|
@@ -49,13 +49,13 @@ class Members extends guild_based_1.GuildBasedResource {
|
|
|
49
49
|
valuesRaw(guild) {
|
|
50
50
|
return super.values(guild);
|
|
51
51
|
}
|
|
52
|
-
async set(__keys, guild, data) {
|
|
52
|
+
async set(from, __keys, guild, data) {
|
|
53
53
|
const keys = Array.isArray(__keys) ? __keys : [[__keys, data]];
|
|
54
54
|
const bulkData = [];
|
|
55
55
|
for (const [id, value] of keys) {
|
|
56
56
|
if (value.user) {
|
|
57
|
-
bulkData.push(['members', value, id, guild]);
|
|
58
|
-
bulkData.push(['users', value.user, id]);
|
|
57
|
+
bulkData.push([from, 'members', value, id, guild]);
|
|
58
|
+
bulkData.push([from, 'users', value.user, id]);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
await this.cache.bulkSet(bulkData);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { MessageData, ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, MessageData, ReturnCache } from '../..';
|
|
2
2
|
import { type MessageStructure } from '../../client/transformers';
|
|
3
3
|
import type { APIMessage } from '../../types';
|
|
4
4
|
import { GuildRelatedResource } from './default/guild-related';
|
|
5
5
|
export declare class Messages extends GuildRelatedResource<any, APIMessage> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: MessageData, id: string, channel_id
|
|
7
|
+
filter(data: MessageData, id: string, channel_id: string, from: CacheFrom): boolean;
|
|
8
8
|
parse(data: any, _key: string, _channel_id: string): any;
|
|
9
9
|
get(id: string): ReturnCache<MessageStructure | undefined>;
|
|
10
10
|
raw(id: string): ReturnCache<APIMessageResource | undefined>;
|
|
@@ -7,7 +7,7 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
7
7
|
class Messages extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'message';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id, channel_id) {
|
|
10
|
+
filter(data, id, channel_id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
parse(data, _key, _channel_id) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '../..';
|
|
2
2
|
import { PermissionsBitField } from '../../structures/extra/Permissions';
|
|
3
3
|
import type { APIOverwrite } from '../../types';
|
|
4
4
|
import { GuildRelatedResource } from './default/guild-related';
|
|
5
5
|
export declare class Overwrites extends GuildRelatedResource<any, APIOverwrite[]> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APIOverwrite[], id: string, guild_id
|
|
7
|
+
filter(data: APIOverwrite[], id: string, guild_id: string, from: CacheFrom): boolean;
|
|
8
8
|
parse(data: any[], _id: string, guild_id: string): any[];
|
|
9
9
|
raw(id: string): ReturnCache<(APIOverwrite & {
|
|
10
10
|
guild_id: string;
|
|
@@ -7,7 +7,7 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
7
7
|
class Overwrites extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'overwrite';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id, guild_id) {
|
|
10
|
+
filter(data, id, guild_id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
parse(data, _id, guild_id) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { CacheFrom } from '../..';
|
|
1
2
|
import type { GatewayPresenceUpdate } from '../../types';
|
|
2
3
|
import { GuildRelatedResource } from './default/guild-related';
|
|
3
4
|
export declare class Presences extends GuildRelatedResource<PresenceResource, GatewayPresenceUpdate> {
|
|
4
5
|
namespace: string;
|
|
5
|
-
filter(data: GatewayPresenceUpdate, id: string, guild_id
|
|
6
|
+
filter(data: GatewayPresenceUpdate, id: string, guild_id: string, from: CacheFrom): boolean;
|
|
6
7
|
parse(data: any, key: string, guild_id: string): PresenceResource;
|
|
7
8
|
}
|
|
8
9
|
export type PresenceResource = Omit<GatewayPresenceUpdate, 'user'> & {
|
|
@@ -5,7 +5,7 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
5
5
|
class Presences extends guild_related_1.GuildRelatedResource {
|
|
6
6
|
namespace = 'presence';
|
|
7
7
|
//@ts-expect-error
|
|
8
|
-
filter(data, id, guild_id) {
|
|
8
|
+
filter(data, id, guild_id, from) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
|
11
11
|
parse(data, key, guild_id) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '../..';
|
|
2
2
|
import { type GuildRoleStructure } from '../../client/transformers';
|
|
3
3
|
import type { APIRole } from '../../types';
|
|
4
4
|
import { GuildRelatedResource } from './default/guild-related';
|
|
5
5
|
export declare class Roles extends GuildRelatedResource<any, APIRole> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APIRole, id: string, guild_id
|
|
7
|
+
filter(data: APIRole, id: string, guild_id: string, from: CacheFrom): boolean;
|
|
8
8
|
get(id: string): ReturnCache<GuildRoleStructure | undefined>;
|
|
9
9
|
raw(id: string): ReturnCache<APIRole | undefined>;
|
|
10
10
|
bulk(ids: string[]): ReturnCache<GuildRoleStructure[]>;
|
|
@@ -7,7 +7,7 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
7
7
|
class Roles extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'role';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id, guild_id) {
|
|
10
|
+
filter(data, id, guild_id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { CacheFrom } from '../..';
|
|
1
2
|
import type { APIStageInstance } from '../../types';
|
|
2
3
|
import { GuildRelatedResource } from './default/guild-related';
|
|
3
4
|
export declare class StageInstances extends GuildRelatedResource<APIStageInstance, APIStageInstance> {
|
|
4
5
|
namespace: string;
|
|
5
|
-
filter(data: APIStageInstance, id: string, guild_id
|
|
6
|
+
filter(data: APIStageInstance, id: string, guild_id: string, from: CacheFrom): boolean;
|
|
6
7
|
}
|
|
@@ -5,7 +5,7 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
5
5
|
class StageInstances extends guild_related_1.GuildRelatedResource {
|
|
6
6
|
namespace = 'stage_instance';
|
|
7
7
|
//@ts-expect-error
|
|
8
|
-
filter(data, id, guild_id) {
|
|
8
|
+
filter(data, id, guild_id, from) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '../..';
|
|
2
2
|
import { type StickerStructure } from '../../client/transformers';
|
|
3
3
|
import type { APISticker } from '../../types';
|
|
4
4
|
import { GuildRelatedResource } from './default/guild-related';
|
|
5
5
|
export declare class Stickers extends GuildRelatedResource<any, APISticker> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APISticker, id: string, guild_id
|
|
7
|
+
filter(data: APISticker, id: string, guild_id: string, from: CacheFrom): boolean;
|
|
8
8
|
get(id: string): ReturnCache<StickerStructure | undefined>;
|
|
9
9
|
raw(id: string): ReturnCache<APISticker | undefined>;
|
|
10
10
|
bulk(ids: string[]): ReturnCache<StickerStructure[]>;
|
|
@@ -7,7 +7,7 @@ const guild_related_1 = require("./default/guild-related");
|
|
|
7
7
|
class Stickers extends guild_related_1.GuildRelatedResource {
|
|
8
8
|
namespace = 'sticker';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id, guild_id) {
|
|
10
|
+
filter(data, id, guild_id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
get(id) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '../..';
|
|
2
2
|
import { type UserStructure } from '../../client/transformers';
|
|
3
3
|
import type { APIUser } from '../../types';
|
|
4
4
|
import { BaseResource } from './default/base';
|
|
5
5
|
export declare class Users extends BaseResource<any, APIUser> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APIUser, id: string): boolean;
|
|
7
|
+
filter(data: APIUser, id: string, from: CacheFrom): boolean;
|
|
8
8
|
get(id: string): ReturnCache<UserStructure | undefined>;
|
|
9
9
|
raw(id: string): ReturnCache<APIUser | undefined>;
|
|
10
10
|
bulk(ids: string[]): ReturnCache<UserStructure[]>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReturnCache } from '../..';
|
|
1
|
+
import type { CacheFrom, ReturnCache } from '../..';
|
|
2
2
|
import { type VoiceStateStructure } from '../../client/transformers';
|
|
3
3
|
import type { APIVoiceState } from '../../types';
|
|
4
4
|
import { GuildBasedResource } from './default/guild-based';
|
|
5
5
|
export declare class VoiceStates extends GuildBasedResource<any, APIVoiceState> {
|
|
6
6
|
namespace: string;
|
|
7
|
-
filter(data: APIVoiceState, id: string, guild_id: string): boolean;
|
|
7
|
+
filter(data: APIVoiceState, id: string, guild_id: string, from: CacheFrom): boolean;
|
|
8
8
|
parse(data: any, id: string, guild_id: string): any;
|
|
9
9
|
get(memberId: string, guildId: string): ReturnCache<VoiceStateStructure | undefined>;
|
|
10
10
|
raw(memberId: string, guildId: string): ReturnCache<APIVoiceState | undefined>;
|
|
@@ -7,7 +7,7 @@ const guild_based_1 = require("./default/guild-based");
|
|
|
7
7
|
class VoiceStates extends guild_based_1.GuildBasedResource {
|
|
8
8
|
namespace = 'voice_state';
|
|
9
9
|
//@ts-expect-error
|
|
10
|
-
filter(data, id, guild_id) {
|
|
10
|
+
filter(data, id, guild_id, from) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
parse(data, id, guild_id) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BanShorter = void 0;
|
|
4
|
+
const cache_1 = require("../../cache");
|
|
4
5
|
const transformers_1 = require("../../client/transformers");
|
|
5
6
|
const base_1 = require("./base");
|
|
6
7
|
class BanShorter extends base_1.BaseShorter {
|
|
@@ -51,7 +52,7 @@ class BanShorter extends base_1.BaseShorter {
|
|
|
51
52
|
return ban;
|
|
52
53
|
}
|
|
53
54
|
ban = await this.client.proxy.guilds(guildId).bans(userId).get();
|
|
54
|
-
await this.client.cache.members?.set(ban.user.id, guildId, ban);
|
|
55
|
+
await this.client.cache.members?.set(cache_1.CacheFrom.Rest, ban.user.id, guildId, ban);
|
|
55
56
|
return transformers_1.Transformers.GuildBan(this.client, ban, guildId);
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
@@ -71,7 +72,7 @@ class BanShorter extends base_1.BaseShorter {
|
|
|
71
72
|
bans = await this.client.proxy.guilds(guildId).bans.get({
|
|
72
73
|
query,
|
|
73
74
|
});
|
|
74
|
-
await this.client.cache.bans?.set(bans.map(x => [x.user.id, x]), guildId);
|
|
75
|
+
await this.client.cache.bans?.set(cache_1.CacheFrom.Rest, bans.map(x => [x.user.id, x]), guildId);
|
|
75
76
|
return bans.map(m => transformers_1.Transformers.GuildBan(this.client, m, guildId));
|
|
76
77
|
}
|
|
77
78
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChannelShorter = void 0;
|
|
4
|
+
const cache_1 = require("../../cache");
|
|
4
5
|
const transformers_1 = require("../../client/transformers");
|
|
5
6
|
const structures_1 = require("../../structures");
|
|
6
7
|
const Permissions_1 = require("../../structures/extra/Permissions");
|
|
@@ -29,7 +30,7 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
channel = await this.client.proxy.channels(id).get();
|
|
32
|
-
await this.client.cache.channels?.patch(id,
|
|
33
|
+
await this.client.cache.channels?.patch(cache_1.CacheFrom.Rest, id, 'guild_id' in channel && channel.guild_id ? channel.guild_id : '@me', channel);
|
|
33
34
|
return channel;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
@@ -54,9 +55,9 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
54
55
|
async edit(id, body, optional = { guildId: '@me' }) {
|
|
55
56
|
const options = (0, utils_1.MergeOptions)({ guildId: '@me' }, optional);
|
|
56
57
|
const res = await this.client.proxy.channels(id).patch({ body, reason: options.reason });
|
|
57
|
-
await this.client.cache.channels?.setIfNI(structures_1.BaseChannel.__intent__(options.guildId), res.id, options.guildId, res);
|
|
58
|
+
await this.client.cache.channels?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(options.guildId), res.id, options.guildId, res);
|
|
58
59
|
if (body.permission_overwrites && 'permission_overwrites' in res && res.permission_overwrites)
|
|
59
|
-
await this.client.cache.overwrites?.setIfNI(structures_1.BaseChannel.__intent__(options.guildId), res.id, options.guildId, res.permission_overwrites);
|
|
60
|
+
await this.client.cache.overwrites?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(options.guildId), res.id, options.guildId, res.permission_overwrites);
|
|
60
61
|
return (0, structures_1.channelFrom)(res, this.client);
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
@@ -69,7 +70,7 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
69
70
|
}
|
|
70
71
|
async pins(channelId) {
|
|
71
72
|
const messages = await this.client.proxy.channels(channelId).pins.get();
|
|
72
|
-
await this.client.cache.messages?.patch(messages.map(x => {
|
|
73
|
+
await this.client.cache.messages?.patch(cache_1.CacheFrom.Rest, messages.map(x => {
|
|
73
74
|
return [x.id, x];
|
|
74
75
|
}), channelId);
|
|
75
76
|
return messages.map(message => transformers_1.Transformers.Message(this.client, message));
|
|
@@ -158,7 +159,7 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
158
159
|
const result = await this.client.proxy.channels(channelId).messages.get({
|
|
159
160
|
query,
|
|
160
161
|
});
|
|
161
|
-
await this.client.cache.messages?.patch(result.map(x => {
|
|
162
|
+
await this.client.cache.messages?.patch(cache_1.CacheFrom.Rest, result.map(x => {
|
|
162
163
|
return [x.id, x];
|
|
163
164
|
}), channelId);
|
|
164
165
|
return result.map(message => transformers_1.Transformers.Message(this.client, message));
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmojiShorter = void 0;
|
|
4
4
|
const builders_1 = require("../../builders");
|
|
5
|
+
const cache_1 = require("../../cache");
|
|
5
6
|
const transformers_1 = require("../../client/transformers");
|
|
6
7
|
const base_1 = require("./base");
|
|
7
8
|
class EmojiShorter extends base_1.BaseShorter {
|
|
@@ -20,7 +21,7 @@ class EmojiShorter extends base_1.BaseShorter {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
emojis = await this.client.proxy.guilds(guildId).emojis.get();
|
|
23
|
-
await this.client.cache.emojis?.set(emojis.map(x => [x.id, x]), guildId);
|
|
24
|
+
await this.client.cache.emojis?.set(cache_1.CacheFrom.Rest, emojis.map(x => [x.id, x]), guildId);
|
|
24
25
|
return emojis.map(m => transformers_1.Transformers.GuildEmoji(this.client, m, guildId));
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
@@ -34,7 +35,7 @@ class EmojiShorter extends base_1.BaseShorter {
|
|
|
34
35
|
const emoji = await this.client.proxy.guilds(guildId).emojis.post({
|
|
35
36
|
body: bodyResolved,
|
|
36
37
|
});
|
|
37
|
-
await this.client.cache.emojis?.setIfNI('GuildExpressions', emoji.id, guildId, emoji);
|
|
38
|
+
await this.client.cache.emojis?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', emoji.id, guildId, emoji);
|
|
38
39
|
return transformers_1.Transformers.GuildEmoji(this.client, emoji, guildId);
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
@@ -74,7 +75,7 @@ class EmojiShorter extends base_1.BaseShorter {
|
|
|
74
75
|
*/
|
|
75
76
|
async edit(guildId, emojiId, body, reason) {
|
|
76
77
|
const emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).patch({ body, reason });
|
|
77
|
-
await this.client.cache.emojis?.setIfNI('GuildExpressions', emoji.id, guildId, emoji);
|
|
78
|
+
await this.client.cache.emojis?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', emoji.id, guildId, emoji);
|
|
78
79
|
return transformers_1.Transformers.GuildEmoji(this.client, emoji, guildId);
|
|
79
80
|
}
|
|
80
81
|
}
|