seyfert 2.1.1-dev-12485652015.0 → 2.1.1-dev-12489494190.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/index.d.ts +9 -0
- package/lib/cache/index.js +41 -35
- 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 +7 -7
- 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 +7 -7
- 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/client/base.d.ts +0 -2
- package/lib/client/base.js +1 -2
- 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/package.json +1 -1
|
@@ -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) {
|
package/lib/client/base.d.ts
CHANGED
|
@@ -135,10 +135,8 @@ export interface StartOptions {
|
|
|
135
135
|
}
|
|
136
136
|
interface RCLocations extends ExtendedRCLocations {
|
|
137
137
|
base: string;
|
|
138
|
-
output: string;
|
|
139
138
|
commands?: string;
|
|
140
139
|
langs?: string;
|
|
141
|
-
templates?: string;
|
|
142
140
|
events?: string;
|
|
143
141
|
components?: string;
|
|
144
142
|
}
|
package/lib/client/base.js
CHANGED
|
@@ -318,7 +318,6 @@ class BaseClient {
|
|
|
318
318
|
const { locations, debug, ...env } = seyfertConfig;
|
|
319
319
|
const locationsFullPaths = {
|
|
320
320
|
base: locations.base,
|
|
321
|
-
output: locations.output,
|
|
322
321
|
};
|
|
323
322
|
for (const i in locations) {
|
|
324
323
|
const key = i;
|
|
@@ -326,7 +325,7 @@ class BaseClient {
|
|
|
326
325
|
if (key in locationsFullPaths)
|
|
327
326
|
continue;
|
|
328
327
|
if (typeof location === 'string')
|
|
329
|
-
locationsFullPaths[key] = (0, node_path_1.join)(process.cwd(), locations.
|
|
328
|
+
locationsFullPaths[key] = (0, node_path_1.join)(process.cwd(), locations.base, location);
|
|
330
329
|
else
|
|
331
330
|
locationsFullPaths[key] = location;
|
|
332
331
|
}
|
|
@@ -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, 'guild_id' in channel && channel.guild_id ? channel.guild_id : '@me', channel);
|
|
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
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuildShorter = 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 structures_1 = require("../../structures");
|
|
7
8
|
const base_1 = require("./base");
|
|
@@ -13,7 +14,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
13
14
|
*/
|
|
14
15
|
async create(body) {
|
|
15
16
|
const guild = await this.client.proxy.guilds.post({ body });
|
|
16
|
-
await this.client.cache.guilds?.setIfNI('Guilds', guild.id, guild);
|
|
17
|
+
await this.client.cache.guilds?.setIfNI(cache_1.CacheFrom.Rest, 'Guilds', guild.id, guild);
|
|
17
18
|
return transformers_1.Transformers.Guild(this.client, guild);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
@@ -32,7 +33,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
32
33
|
return guild;
|
|
33
34
|
}
|
|
34
35
|
const data = await this.client.proxy.guilds(id).get();
|
|
35
|
-
await this.client.cache.guilds?.patch(id, data);
|
|
36
|
+
await this.client.cache.guilds?.patch(cache_1.CacheFrom.Rest, id, data);
|
|
36
37
|
return (await this.client.cache.guilds?.raw(id)) ?? data;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
@@ -47,7 +48,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
47
48
|
async edit(guildId, body, reason) {
|
|
48
49
|
const guild = await this.client.proxy.guilds(guildId).patch({ body, reason });
|
|
49
50
|
if (!this.client.cache.hasGuildsIntent)
|
|
50
|
-
await this.client.cache.guilds?.patch(guildId, guild);
|
|
51
|
+
await this.client.cache.guilds?.patch(cache_1.CacheFrom.Rest, guildId, guild);
|
|
51
52
|
return new structures_1.Guild(this.client, guild);
|
|
52
53
|
}
|
|
53
54
|
list(query) {
|
|
@@ -63,7 +64,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
63
64
|
return transformers_1.Transformers.GuildMember(this.client, self, self.user, id);
|
|
64
65
|
}
|
|
65
66
|
const self = await this.client.proxy.guilds(id).members(this.client.botId).get();
|
|
66
|
-
await this.client.cache.members?.patch(self.user.id, id, self);
|
|
67
|
+
await this.client.cache.members?.patch(cache_1.CacheFrom.Rest, self.user.id, id, self);
|
|
67
68
|
return transformers_1.Transformers.GuildMember(this.client, self, self.user, id);
|
|
68
69
|
}
|
|
69
70
|
leave(id) {
|
|
@@ -93,7 +94,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
channels = await this.client.proxy.guilds(guildId).channels.get();
|
|
96
|
-
await this.client.cache.channels?.set(channels.map(x => [x.id, x]), guildId);
|
|
97
|
+
await this.client.cache.channels?.set(cache_1.CacheFrom.Rest, channels.map(x => [x.id, x]), guildId);
|
|
97
98
|
return channels.map(m => (0, structures_1.channelFrom)(m, this.client));
|
|
98
99
|
},
|
|
99
100
|
/**
|
|
@@ -111,7 +112,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
111
112
|
return channel;
|
|
112
113
|
}
|
|
113
114
|
channel = await this.client.proxy.channels(channelId).get();
|
|
114
|
-
await this.client.cache.channels?.patch(channelId, guildId, channel);
|
|
115
|
+
await this.client.cache.channels?.patch(cache_1.CacheFrom.Rest, channelId, guildId, channel);
|
|
115
116
|
return (0, structures_1.channelFrom)(channel, this.client);
|
|
116
117
|
},
|
|
117
118
|
/**
|
|
@@ -122,7 +123,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
122
123
|
*/
|
|
123
124
|
create: async (guildId, body) => {
|
|
124
125
|
const res = await this.client.proxy.guilds(guildId).channels.post({ body });
|
|
125
|
-
await this.client.cache.channels?.setIfNI(structures_1.BaseChannel.__intent__(guildId), res.id, guildId, res);
|
|
126
|
+
await this.client.cache.channels?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(guildId), res.id, guildId, res);
|
|
126
127
|
return (0, structures_1.channelFrom)(res, this.client);
|
|
127
128
|
},
|
|
128
129
|
/**
|
|
@@ -147,7 +148,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
147
148
|
*/
|
|
148
149
|
edit: async (guildchannelId, channelId, body, reason) => {
|
|
149
150
|
const res = await this.client.proxy.channels(channelId).patch({ body, reason });
|
|
150
|
-
await this.client.cache.channels?.setIfNI(structures_1.BaseChannel.__intent__(guildchannelId), res.id, guildchannelId, res);
|
|
151
|
+
await this.client.cache.channels?.setIfNI(cache_1.CacheFrom.Rest, structures_1.BaseChannel.__intent__(guildchannelId), res.id, guildchannelId, res);
|
|
151
152
|
return (0, structures_1.channelFrom)(res, this.client);
|
|
152
153
|
},
|
|
153
154
|
/**
|
|
@@ -238,7 +239,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
238
239
|
*/
|
|
239
240
|
list: async (guildId) => {
|
|
240
241
|
const stickers = await this.client.proxy.guilds(guildId).stickers.get();
|
|
241
|
-
await this.client.cache.stickers?.set(stickers.map(st => [st.id, st]), guildId);
|
|
242
|
+
await this.client.cache.stickers?.set(cache_1.CacheFrom.Rest, stickers.map(st => [st.id, st]), guildId);
|
|
242
243
|
return stickers.map(st => transformers_1.Transformers.Sticker(this.client, st));
|
|
243
244
|
},
|
|
244
245
|
/**
|
|
@@ -253,7 +254,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
253
254
|
const sticker = await this.client.proxy
|
|
254
255
|
.guilds(guildId)
|
|
255
256
|
.stickers.post({ reason, body: json, files: [{ ...fileResolve[0], key: 'file' }], appendToFormData: true });
|
|
256
|
-
await this.client.cache.stickers?.setIfNI('GuildExpressions', sticker.id, guildId, sticker);
|
|
257
|
+
await this.client.cache.stickers?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', sticker.id, guildId, sticker);
|
|
257
258
|
return transformers_1.Transformers.Sticker(this.client, sticker);
|
|
258
259
|
},
|
|
259
260
|
/**
|
|
@@ -266,7 +267,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
266
267
|
*/
|
|
267
268
|
edit: async (guildId, stickerId, body, reason) => {
|
|
268
269
|
const sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).patch({ body, reason });
|
|
269
|
-
await this.client.cache.stickers?.setIfNI('GuildExpressions', stickerId, guildId, sticker);
|
|
270
|
+
await this.client.cache.stickers?.setIfNI(cache_1.CacheFrom.Rest, 'GuildExpressions', stickerId, guildId, sticker);
|
|
270
271
|
return transformers_1.Transformers.Sticker(this.client, sticker);
|
|
271
272
|
},
|
|
272
273
|
/**
|
|
@@ -284,7 +285,7 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
284
285
|
return sticker;
|
|
285
286
|
}
|
|
286
287
|
sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).get();
|
|
287
|
-
await this.client.cache.stickers?.patch(stickerId, guildId, sticker);
|
|
288
|
+
await this.client.cache.stickers?.patch(cache_1.CacheFrom.Rest, stickerId, guildId, sticker);
|
|
288
289
|
return transformers_1.Transformers.Sticker(this.client, sticker);
|
|
289
290
|
},
|
|
290
291
|
/**
|
|
@@ -91,7 +91,7 @@ export declare class MemberShorter extends BaseShorter {
|
|
|
91
91
|
listRoles(guildId: string, memberId: string, force?: boolean): Promise<GuildRoleStructure[]>;
|
|
92
92
|
sortRoles(guildId: string, memberId: string, force?: boolean): Promise<GuildRoleStructure[]>;
|
|
93
93
|
permissions(guildId: string, memberId: string, force?: boolean): Promise<PermissionsBitField>;
|
|
94
|
-
presence(memberId: string): import("
|
|
94
|
+
presence(memberId: string): import("../../cache").ReturnCache<(Omit<import("../../types").GatewayPresenceUpdate, "user"> & {
|
|
95
95
|
id: string;
|
|
96
96
|
user_id: string;
|
|
97
97
|
} & {
|